summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2009-12-15 13:02:49 +0100
committerChristoph Helma <helma@in-silico.de>2009-12-15 13:02:49 +0100
commitc72d67848f2b339e7ae3dfc985bbd318c55aa999 (patch)
tree433c47547b0da6130d9ac1e48173aeb51d992fb6
parent57459b03f52865989f3ae5fde0b0e8f30eeef0ba (diff)
parent80f84ea9d016f457eee1647592bcee985195edd7 (diff)
merge conflict ressolved
-rw-r--r--README4
-rw-r--r--application.rb5
2 files changed, 5 insertions, 4 deletions
diff --git a/README b/README
index 55d4b51..30b3e36 100644
--- a/README
+++ b/README
@@ -6,8 +6,8 @@ OpenTox Compounds
REST operations:
-Get the representation of a compound GET /compound/{id} - Compound representation 200,404,503
-Create a new compound POST /compound Compound representation URIs for new compounds 200,400,503
+Get the representation of a compound GET /compound/{id} - Compound representation 200,404,500
+Create a new compound POST /compound Compound representation URIs for new compounds 200,400,500
Supported MIME formats (http://chemical-mime.sourceforge.net/):
diff --git a/application.rb b/application.rb
index 0748c6b..4ee4522 100644
--- a/application.rb
+++ b/application.rb
@@ -5,7 +5,7 @@ require 'opentox-ruby-api-wrapper'
CACTUS_URI="http://cactus.nci.nih.gov/chemical/structure/"
get %r{/(.+)} do |inchi| # catches all remaining get requests
- inchi = URI.unescape request.env['REQUEST_URI'].sub(/^\//,'') # hack to avoid sinatra's URI/CGI unescaping, splitting, ..."
+ inchi = URI.unescape request.env['REQUEST_URI'].sub(/^\//,'').sub(/.*\/compound\//,'') # hack to avoid sinatra's URI/CGI unescaping, splitting, ..."
case request.env['HTTP_ACCEPT']
when "*/*"
OpenTox::Compound.new(:inchi => inchi).smiles
@@ -18,7 +18,8 @@ get %r{/(.+)} do |inchi| # catches all remaining get requests
when "image/gif"
"#{CACTUS_URI}#{inchi}/image"
when "text/plain"
- RestClient.get("#{CACTUS_URI}#{inchi}/names").to_s
+ uri = File.join CACTUS_URI,inchi,"names"
+ RestClient.get(uri).to_s
else
status 400
"Unsupported MIME type '#{request.content_type}'"