Sha256: 8f04f4c4e64a6c3ae969c54d6e5ac2fc75262bc9b2511d1011c2480d45d82c8f

Contents?: true

Size: 468 Bytes

Versions: 7

Compression:

Stored size: 468 Bytes

Contents

class API < Grape::API
  prefix 'api'

  namespace :foos do
    desc 'Get foos.'
    get do
      [{ id: 1, name: 'Foo' }]
    end

    desc 'Get a foo.'
    params do
      requires :id, type: String, desc: 'Foo id.'
    end
    get :id do
      { id: 1, name: 'Foo' }
    end
  end

  desc 'Get headers.'
  get '/headers' do
    request.headers.as_json
  end

  desc 'Get params.'
  get '/params' do
    request.params.as_json
  end

  add_swagger_documentation
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
grape-swagger-rails-0.4.0 spec/dummy/app/api/api.rb
grape-swagger-rails-0.3.1 spec/dummy/app/api/api.rb
grape-swagger-rails-0.3.0 spec/dummy/app/api/api.rb
grape-swagger-rails-0.2.2 spec/dummy/app/api/api.rb
grape-swagger-rails-0.2.1 spec/dummy/app/api/api.rb
grape-swagger-rails-0.2.0 spec/dummy/app/api/api.rb
grape-swagger-rails-0.1.0 spec/dummy/app/api/api.rb