Sha256: 7504f930813a9bf899d9a93d4d2bfe55ade3eacf9fd4f24dcaed961d8616eba2

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

class SampleApi < Grape::API
  resource 'widgets' do
    desc 'widgets list'
    get  '/' do
    end

    desc 'individual widget'
    get ':id' do
    end

    desc 'create a widget'
    params do
      requires :name,
               type: 'string',
               desc: 'the widgets name',
               documentation: { example: 'super widget' }
      optional :description,
               type: 'string',
               desc: 'the widgets name',
               documentation: { example: 'the best widget ever made' }
    end
    post '/' do
    end

    desc 'update a widget'
    params do
      optional :name, type: 'string', desc: 'the widgets name'
      optional :description, type: 'string', desc: 'the widgets name'
    end
    put  ':id' do
    end
  end

  resource '/widgets/:widget_id/sprockets' do
    desc 'create a sprocket for a specific widget'
    params do
      requires :name,
               type: 'string',
               desc: 'the widgets name',
               documentation: { example: 'super widget' }
    end
    post '/' do
    end

    desc 'updates a sprocket for a specific widget'
    params do
      requires :name,
               type: 'string',
               desc: 'the widgets name',
               documentation: { example: 'super widget' }
    end
    put ':id' do
    end
  end

  resource 'admin' do
    get '/' do
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
grape-slate-0.0.5 spec/support/sample_api.rb
grape-markdown-0.0.6 spec/support/sample_api.rb
grape-slate-0.0.4 spec/support/sample_api.rb