Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (38 sloc) 1.26 kb

RestfulSpec

Restful spec is an easy way to add a machine readable, comprehensive specification to your apis, without having to write a lot of documentation. The gem automatically discovers routes and builds out resources accordingly. With the option to customize a bit with a handy DSL.

Installation

Add this line to your application's Gemfile:

gem 'restful_spec'

And then execute:

$ bundle

Or install it yourself as:

$ gem install restful_spec

Usage

Include the Module

class MyController < ApplicationController
  include RestfulSpec

  # ...
end

Add a bit of customization. Only if you want!

class MyController < ApplicationController
  include RestfulSpec

  specification do
    description "An API for MyController"
    attributes except: [:id, :created_at]
    accepts_formats :json, :xml
    accepts_parameters attributes: :all, for: 'POST /my'
    responds_with :collection, for: 'GET /my'
    responds_with :member, for: 'GET /my/:id'
  end

  #...

end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Jump to Line
Something went wrong with that request. Please try again.