Test for Pruner

This commit is contained in:
Senad Uka
2018-08-13 18:54:12 +02:00
parent 5684e58826
commit 973f1e1093
15 changed files with 2888 additions and 53 deletions

View File

@@ -6,27 +6,26 @@ require_relative '../exceptions'
module Pruning
module API
# Handles general concers regarding API calls
class App < Sinatra::Base
before { content_type :json }
after { serialise_response }
set :show_exceptions, true
error Pruning::Exceptions::UnexpectedError do
error Pruning::Exceptions::UnexpectedError do
status 500
end
error Pruning::Exceptions::OriginCannotFindTheResource do
status 404
status 404
end
get '/' do
"Try /tree/:name"
'Try /tree/:name?indicator_ids[]=32&indicator_ids[]=31'
end
private
def serialise_response
return unless content_type == 'application/json'
response.body = [JSON(response.body)]