summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2009-11-23 18:11:41 +0100
committerChristoph Helma <helma@in-silico.de>2009-11-23 18:11:41 +0100
commitf5a9d52b26f0890157ec7ff6d2e461b1509bdf34 (patch)
tree5286f042d53df829f0a35d52fb02eb8949f5eafe
parentd4be95beec0040f96dc943028d36874234206f3f (diff)
modified for OpenTox API1.1
-rw-r--r--application.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/application.rb b/application.rb
index eb927e0..3fbc9fb 100644
--- a/application.rb
+++ b/application.rb
@@ -22,6 +22,20 @@ get %r{/(.+)} do |inchi| # catches all remaining get requests
end
post '/?' do
+
+ input = request.env["rack.input"].read
+ case request.content_type
+ when /chemical\/x-daylight-smiles/
+ OpenTox::Compound.new(:smiles => input).uri
+ when /chemical\/x-inchi/
+ OpenTox::Compound.new(:inchi => input).uri
+ when /text\/plain/
+ OpenTox::Compound.new(:name => input).uri
+ else
+ status 400
+ "Unsupported MIME type #{request.content_type}"
+ end
+=begin
if params[:smiles]
OpenTox::Compound.new(:smiles => params[:smiles]).uri
elsif params[:inchi]
@@ -29,4 +43,5 @@ post '/?' do
elsif params[:name]
OpenTox::Compound.new(:name => params[:name]).uri
end
+=end
end