summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb7
1 files changed, 4 insertions, 3 deletions
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}'"