diff options
author | Christoph Helma <helma@in-silico.ch> | 2019-09-03 13:45:36 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2019-09-03 13:45:36 +0200 |
commit | d1032e4f40d9fbb212e85e0db4f0ecd2e8ac9a88 (patch) | |
tree | 48922d60d750839dacd5d0a4a6e50ea3fe68da63 /lib/report.rb | |
parent | 5bb4c24c6cfc1ddfae14eb9543b283baae2d75be (diff) | |
parent | a84d9eabf1b921086a688f81df28b0f21ba4df19 (diff) |
development merged, git links in FAQ.md fixed1.4.0
Diffstat (limited to 'lib/report.rb')
-rw-r--r-- | lib/report.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/report.rb b/lib/report.rb new file mode 100644 index 0000000..7c06d60 --- /dev/null +++ b/lib/report.rb @@ -0,0 +1,29 @@ +# Get a list of all possible reports to prediction models +# @param [Header] Accept one of text/uri-list, +# @return [text/uri-list] list of all prediction models +get "/api/report/?" do + models = Model::Validation.all + case @accept + when "text/uri-list" + uri_list = models.collect{|model| uri("/api/report/#{model.model_id}")} + return uri_list.join("\n") + "\n" + when "application/json" + models = JSON.parse models.to_json + list = [] + models.each{|m| list << uri("/api/report/#{m["_id"]["$oid"]}")} + return list.to_json + else + halt 400, "Mime type #{@accept} is not supported." + end +end + +get "/api/report/:id/?" do + case @accept + when "application/xml" + report = qmrf_report params[:id] + return report.to_xml + else + halt 400, "Mime type #{@accept} is not supported." + end + +end |