0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Make API responses hella simple
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

RespondWith Test Status

The respond_with gem is an extension of Sinatra. It is intended to make API responses dead simple.

Installation

respond_with relies on the serialize gem which is still in development so you'll need to install that from git.

Add these lines to your application's Gemfile:

gem 'respond_with', :git => 'git://github.com/daneharrigan/respond_with.git'
gem 'serialize',    :git => 'git://github.com/daneharrigan/serialize.git'

And then execute:

$ bundle

Usage

require "sinatra"
require "respond_with"

# in a sinatra app
get "/resources/:id.?:format?" do
  @resource = Resource.find(params[:id])
  respond_with ResourceSerializer.new(@resource)
end

Notice we're using a ResourceSerializer. This is built with the serialize gem.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request