Sha256: 3831829debf7a6ad743831231df7e94198f718b47c2ec839e42f8fb57a9fe25d
Contents?: true
Size: 963 Bytes
Versions: 4
Compression:
Stored size: 963 Bytes
Contents
# api routes module Sabisu # server class class Server get '/api/events' do params = request.env['rack.request.query_hash'] events = Event.all(params) JSON.pretty_generate(events) end get '/api/events/search' do params = request.env['rack.request.query_hash'] if params.key?('query') query = params['query'] params.delete('query') else return 'Must supply \'query\' parameter' end events = Event.search(query, params) JSON.pretty_generate(events) end get '/api/events/stale' do params = request.env['rack.request.query_hash'] stale = Event.stale(params) JSON.pretty_generate(stale: stale) end get '/api/events/changes' do params = request.env['rack.request.query_hash'] JSON.pretty_generate(CURRENT_DB.changes(params)) end get '/api/configuration/fields' do JSON.pretty_generate(FIELDS) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
sabisu-0.1.3 | lib/sabisu/routes/api.rb |
sabisu-0.1.2 | lib/sabisu/routes/api.rb |
sabisu-0.1.1 | lib/sabisu/routes/api.rb |
sabisu-0.1.0 | lib/sabisu/routes/api.rb |