diff options
author | Christoph Helma <ch@in-silico.ch> | 2009-12-15 12:19:38 +0100 |
---|---|---|
committer | Christoph Helma <ch@in-silico.ch> | 2009-12-15 12:19:38 +0100 |
commit | 80f84ea9d016f457eee1647592bcee985195edd7 (patch) | |
tree | 38b728676a1145cf5f403862f9ae8ed8ad1011e5 | |
parent | 4d098a0e2aa494d1a151c8e691ee5fc8cfbcf253 (diff) |
InChI creation with sub URIs fixed
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | application.rb | 7 |
2 files changed, 6 insertions, 5 deletions
@@ -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 275f6af..8fce15d 100644 --- a/application.rb +++ b/application.rb @@ -1,11 +1,11 @@ require 'rubygems' -gem 'opentox-ruby-api-wrapper', '=1.1.3' +#gem 'opentox-ruby-api-wrapper', '=1.1.3' 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}'" |