restrict possible period param values

This commit is contained in:
Gwenhael Le Moine 2014-07-28 16:51:55 +02:00
parent 84e9350676
commit a2faa6b144

2
app.rb
View file

@ -30,7 +30,7 @@ class LedgerRbApp < Sinatra::Base
end
get '/api/ledger/register/:period/?' do
param :period, String, required: true # TODO: restrict possible values to [ 'yearly', 'monthly' ]
param :period, String, required: true, within: [ 'yearly', 'monthly' ]
param :categories, Array, default: Ledger.accounts( 1 )
params[ :categories ].map do