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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request