refine params

This commit is contained in:
Gwenhael Le Moine 2014-07-27 10:10:02 +02:00
parent 39b7f6128d
commit b61021f4b9

4
app.rb
View file

@ -22,19 +22,19 @@ class LedgerRbApp < Sinatra::Base
get '/api/ledger/accounts/depth/:depth' do
content_type :json
param :depth, Integer
param :depth, Integer, required: true
Ledger.accounts( params[ :depth ] ).to_json
end
get '/api/ledger/monthly/?' do
content_type :json
param :categories, Array
params[ :categories ].map do |category|
{ category: category,
data: Ledger.monthly_register( category ).to_json }
end
param :categories, Array, default: Ledger.accounts( 1 )
end
get '/api/ledger/version/?' do