Skip to content

CRUD through HTTP is a good step forward to using resources and becoming RESTful. Another step further into it is to make use of hypermedia-based services and the Restfulie gem allows you to do it very quickly.

License

Notifications You must be signed in to change notification settings

jonseaberg/restfulie

 
 

Repository files navigation

Web site

Restfulie’s site has a lot of information on Restfulie itself

Quit pretending

CRUD through HTTP and web services (aka Rest) in Rails is a good step forward to using resources and becoming RESTful, another step further into it is to make use of hypermedia and semantic meaningful media types: this gem allows you to do it really fast. Go go go!

Bite me!

One liners for your pleasure. First, how to let restfulie know which media types you can handle:

class ItemsController < ...
  respond_to :atom, :html, :xml, :commerce, :opensearch
end

Now let’s handle them all:

def index
  respond_with @orders = Order.all
end

And what is the first difference between simple web services with Rails and a REST architecture? Let’s add hypermedia to the game:

memeber(@order) do |order|
  order.link "payment", payment_url(order)
end

There you go, hypermedia, on the fly. You can also throw in link headers and much more fun for your life when maintaining your services. Lets grab it and navigate!

response = Restfulie.at('http://localhost:3030/orders').get
puts response.code

orders = response.resource
response = orders.link(payment).follow.post {creditcard => 4444}

That was it for your first hypermedia introduction with Restfulie. Now its time for the real deal.

Download it, install it, use it, ask questions in the mailing list and read the documentation on Restfulie’s website!

Installing

Execute:

gem install restfulie

For use in Rails 2.3, make sure to require the responders_backport gem in addition to the restfulie gem, either in environment.rb or in the Gemfile.

Building the project

If you want to build the project and run its tests, remember to install all (client and server) required gem.
Bundler is required to easily manage dependencies

bundle install
rake test:spec test:integration

Contributions

Restfulie was created and is maintained by Caelum, and has received enormous contributions from all those developers:

Project Leader
Guilherme Silveira, Caelum

Caue Guerra, caelum
George Guimaraes, abril and plataforma
Fabio Akita
Diego Carrion
Leandro Silva
Gavin-John Noonan
Antonio Marques
Luis Cipriani, abril
Everton Ribeiro, abril
Paulo Ahagon, abril
Elomar França
Thomas Stefano
David Paniz
Caike Souza

Rails 2

If you want to use Restfulie with Rails2, please use any release up to 0.9.2 and its minor releases.

About

CRUD through HTTP is a good step forward to using resources and becoming RESTful. Another step further into it is to make use of hypermedia-based services and the Restfulie gem allows you to do it very quickly.

Resources

License

Stars

Watchers

Forks

Packages

No packages published