Skip to content

Grape Integration

Seth Herr edited this page Oct 18, 2015 · 8 revisions

Use with grape to build an auto-documented API

Check out the sample app

The sample app is a Rails 4 template with everything necessary to create an autodocumented, secured API in Grape with doorkeeper.

There is also a wiki page with details for how to add this to an existing application.

  • grape a REST-like API micro-framework for Ruby. Makes building APIs easier and faster.

  • grape swagger The grape-swagger gem provides autogenerated swagger documentation (it's magical).

  • swagger ui rails The swagger-ui_rails gem provides asset pipeline assets for swagger-ui - beautiful, interactive documentation.

  • wine_bouncer The wine_bouncer gem protects grape with Doorkeeper, documents it in swagger, and permits scoping-based protection.

====

Using the grape helpers

Doorkeeper also comes with grape helpers for simple authentication, which can be used like this:

require 'doorkeeper/grape/helpers'

module API
  module V1
    class Users < Grape::API
      helpers Doorkeeper::Grape::Helpers

      before do
        doorkeeper_authorize!
      end

      # ...

    end
  end
end
You can’t perform that action at this time.