diff options
author | Micha Rautenberg <rautenberg@in-silico.ch> | 2016-08-29 10:11:36 +0200 |
---|---|---|
committer | Micha Rautenberg <rautenberg@in-silico.ch> | 2016-08-29 10:11:36 +0200 |
commit | 4c887c2e5d4091edee007ac4e262117a00e63025 (patch) | |
tree | af2111f96b0caebb9993e71d9c236e0be57d715e | |
parent | a1487810527c92ec28b35588c886563162f967d7 (diff) |
add more validation routes
-rw-r--r-- | application.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/application.rb b/application.rb index 6fc5936..0d0cb63 100644 --- a/application.rb +++ b/application.rb @@ -83,10 +83,27 @@ end VALIDATION_TYPES = ["repeatedcrossvalidation", "leaveoneout", "crossvalidation", "regressioncrossvalidation"] + +# Get a list of ayll possible validation types +# @param [Header] Accept one of text/uri-list, application/json +# @return [text/uri-list] URI list of all validation types +get "/validation/?" do + case @accept + when "text/uri-list" + uri_list = VALIDATION_TYPES.collect{|validationtype| uri("/validation/#{validationtype}")} + return uri_list.join("\n") + "\n" + when "application/json" + return VALIDATION_TYPES.to_json + else + bad_request_error "Mime type #{@accept} is not supported." + end +end + + # Get a list of all validations # @param [Header] Accept one of text/uri-list, application/json # @param [Path] Validationtype One of "repeatedcrossvalidation", "leaveoneout", "crossvalidation", "regressioncrossvalidation" -# @return [text/uri-list] list of all prediction models +# @return [text/uri-list] list of all validations of a validation type get "/validation/:validationtype/?" do bad_request_error "There is no such validation type as: #{params[:validationtype]}" unless VALIDATION_TYPES.include? params[:validationtype] case params[:validationtype] |