./lib/helios/backend/passbook.rb in helios-0.0.5 vs ./lib/helios/backend/passbook.rb in helios-0.1.1

- old
+ new

@@ -1,10 +1,20 @@ require 'rack/passbook' +require 'sinatra/param' -class Helios::Backend::Passbook < Rack::Passbook +class Helios::Backend::Passbook < Sinatra::Base + helpers Sinatra::Param + + def initialize(app, options = {}) + super(Rack::Passbook.new) + end + get '/passes' do - passes = Rack::Passbook::Pass.dataset + param :q, String + passes = Rack::Passbook::Pass.dataset + passes = passes.filter("tsv @@ to_tsquery('english', ?)", "#{params[:q]}:*") if params[:q] and not params[:q].empty? + if params[:page] or params[:per_page] param :page, Integer, default: 1, min: 1 param :per_page, Integer, default: 100, in: (1..100) {