From f5a9d52b26f0890157ec7ff6d2e461b1509bdf34 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Mon, 23 Nov 2009 18:11:41 +0100 Subject: modified for OpenTox API1.1 --- application.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- cgit v1.2.3