Sha256: b12efb55467fb94aace4c12d06a056624085294de22880ae79ae05a0cb65ea37
Contents?: true
Size: 1.09 KB
Versions: 1
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-batch-2.1.1 | spec/api.rb |