Giter Club home page Giter Club logo

restfulie's Introduction

Status

Restfulie Ruby is not being actively maintained. Restfulie C# and Java (through VRaptor) support can be found on the mailing list.

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.

restfulie's People

Contributors

abstractj avatar akitaonrails avatar andersonleite avatar bernardeli avatar bguthrie avatar brunoadacosta avatar caike avatar candesce avatar caueguerra avatar davidpaniz avatar dcrec1 avatar fmeyer avatar georgeguimaraes avatar guilhermesilveira avatar jeroenvandijk avatar josedonizetti avatar leandrosilva avatar lfcipriani avatar nuxlli avatar pahagon avatar qmx avatar r2berto avatar rhaiger avatar samuelportela avatar steveklabnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

restfulie's Issues

should check if "link" is a real atom link

when de-serializing a link, it should check if the namespace atom was added to the xml or if the link contains an namespace attribute to the atom specification, otherwise its a simple link attribute

implement controller methods

there should be automatic filtering for transition methods were one would check for the objects possible transition state.

tutorial

create a tutorial and break the main docs in 3 parts

one media type

suggest on docs that if you have only one media type, you can easily do it without tokamak

programmatic view generation

based on your models, you can generate your json without any extra cnfiguration. all fields will be included.

update MattPulver's code

To... have less bugs on to_hash and from_xml
As... guilherme
I want to... update MattPulver's with its last version from his blog

GET support to json

while making a get request it should automatically load the json object as it does with the xml counterpart

Split request and response stack

The request and response stack should be split in two. Take a look on the Java implementation which is better written in this way :)

remove restbuy test interaction

the restfulie restbuy project requires human interaction on localhost:3000/admin
instead of waiting it shoul do a straight request tothe admin interface to settle the payment and then check again!

respond_to does not understand HTTP accept formats

The problem appeared after updating from 0.4 to 0.6 when requesting a resource from a xml representation.

  • Server response code: 406 - Not Acceptable
  • Client request accept header: application/xml
  • Controller's code

Firing up console and running "Restfulie.at('http://localhost:3000/orders/1').get" gives me back an Hashi::CustomHash object with resource's html representation. A solution proposed by Guilherme that fixed the problem for show action was to use render_resource instead of respond_to. I haven't updated the rest of controller's code to use render_created and render_collection to find out what happens.

Don't know if it helps but trying to fix the bug I've found out that commenting lines below this one makes respond_to work properly again.

tokamak Rails3 compliance warning

hi there,

thanks for your great set of useful hypermedia gems. we will release a geodatabase service and wrapper gem soon, utilizing restfulie.

since we are developing in 1.9.2 and rails3 we encountered the warning:

DEPRECATION WARNING: exempt_from_layout is no longer needed, because layouts in Rails 3 are restricted to the content-type of the template that was rendered.

/lib/tokamak/hook/rails.rb:73

In Rails3 it works fine just without the line so there could simply be added a condition to exclude this in a rails 3 gem stack.

keep up the great work!

kind regards,
Frederik

Add rails routes DSL for automatic generation of restful routes

Instead of creating every route needed to implement access to resource links, the server should offer a route DSL to be used in routes.rb file that will generate all routes needed by a resource. Something similar with map.resources for example.

There is no suggestion yet for DSL syntax.

transform it into a gem

transforming it into a gem will make our development / test process easier

we should use jeweler / gemcutter

create and document method can_xxx

the server side code provides a method named can_"state"? but it still not implemented. implement it, make it work through the order server side example and document it

Implement POST, PUT request parameters parsing driven by media types

Rails already offer a way to set a media type parameter parsing scheme, as the documentation shows:

 # Assign a new param parser to a new content type
ActionController::Base.param_parsers['application/atom+xml'] = Proc.new do |data| 
    node = REXML::Document.new(post) 
   { node.root.name => node.root }
end

Therefore, Restfulie must implement a way to enable the user to set specific media types and also support the common ones.

Rails already support XML, JSON and YAML. This feature should also include atom+xml.

support atom namespace in header

while serializing, there should be an option to save the atom namespace definition in the xml header, so the code is smaller.

unit testing

pick a feature/anything.rb and implement unit test for it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.