diff options
author | Christoph Helma <helma@in-silico.ch> | 2010-07-20 11:31:27 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2010-07-20 11:31:27 +0200 |
commit | 5f243f1e9e0a8e12cd8a2267bcec3140d21bf445 (patch) | |
tree | e755d51a453ed710dd4d78437b197c408d5687eb /report/report_application.rb | |
parent | 2963e4f7c355394130297ad181cd30f5e78d1017 (diff) | |
parent | 2a4fe800d1fad7da3a835f664ce1af864e827c0f (diff) |
Merge commit 'mguetlein/test'
Conflicts:
application.rb
Diffstat (limited to 'report/report_application.rb')
-rw-r--r-- | report/report_application.rb | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/report/report_application.rb b/report/report_application.rb index 27c44b6..efa0298 100644 --- a/report/report_application.rb +++ b/report/report_application.rb @@ -60,14 +60,21 @@ get '/report/:type/:id' do end #request.env['HTTP_ACCEPT'] = "application/pdf" - report = rs.get_report(params[:type],params[:id],accept_header) - format = Reports::ReportFormat.get_format(accept_header) - content_type format - #PENDING: get_report should return file or string, check for result.is_file instead of format - if format=="application/x-yaml" or format=="application/rdf+xml" - report + #QMRF-STUB + if params[:type] == Reports::ReportFactory::RT_QMRF + #raise Reports::BadRequest.new("only 'application/qmrf-xml' provided so far") if accept_header != "application/qmrf-xml" + content_type "application/qmrf-xml" + result = body(OpenTox::RestClientWrapper.get("http://ecb.jrc.ec.europa.eu/qsar/qsar-tools/qrf/QMRF_v1.2_FishTox.xml")) else - result = body(File.new(report)) + report = rs.get_report(params[:type],params[:id],accept_header) + format = Reports::ReportFormat.get_format(accept_header) + content_type format + #PENDING: get_report should return file or string, check for result.is_file instead of format + if format=="application/x-yaml" or format=="application/rdf+xml" + report + else + result = body(File.new(report)) + end end end end @@ -99,3 +106,17 @@ post '/report/:type' do end halt 202,task_uri end + + +post '/report/:type/:id' do + perform do |rs| + #QMRF-STUB + if params[:type] == Reports::ReportFactory::RT_QMRF + #raise Reports::BadRequest.new("only 'application/qmrf-xml' provided so far") if request.content_type != "application/qmrf-xml" + input = request.env["rack.input"].read + "save qmrf would have been successfull, received data with "+input.to_s.size.to_s+" characters, this is just a stub, changes discarded" + else + "operation not supported yet" + end + end +end |