Sha256: 1d228dba72f903cb155d2034a281b2056a4a6712a49b4be67eb37b9ffddc36c6
Contents?: true
Size: 1.09 KB
Versions: 7
Compression:
Stored size: 1.09 KB
Contents
module Twitter class API < Grape::API version 'v1', using: :path format :json prefix 'api' resource :hello do get do 'world' end post do 'world' end end resource :failure do desc 'Failure' get do error!('Failed as expected', 503) end end resource :user do params do requires :id, type: Integer, desc: "User id." end route_param :id do get do "user #{params[:id]}" end end end resource :complex do params do requires :a, type: Hash end get do "hash #{params[:a][:b][:c]}" end end resource :status do params do requires :id, type: Integer, desc: "User id." end get do "status #{params[:id]}" end params do requires :id, type: Integer, desc: "User id." end post do "status #{params[:id]}" end end # 404 # route :any, '*path' do error!("#{@env['PATH_INFO']} not found", 404) end end end
Version data entries
7 entries across 7 versions & 1 rubygems