Skip to content

Instantly share code, notes, and snippets.

@hemalich
Created April 27, 2011 08:17
Show Gist options
  • Save hemalich/943903 to your computer and use it in GitHub Desktop.
Save hemalich/943903 to your computer and use it in GitHub Desktop.
irb(main)> response = Restfulie.at('http://localhost:3000/items').accepts('application/json').get
Output:
ready to execute request using stack
typeRestfulie::Client::Feature::BaseRequestargstypeRestfulie::Client::Feature::RescueExceptionargstypeRestfulie::Client::Feature::SetupHeaderargstypeRestfulie::Client::Feature::SerializeBodyargstypeRestfulie::Client::Feature::EnhanceResponseargstypeRestfulie::Client::Feature::FollowRequestargs
invoking filter Restfulie::Client::Feature::FollowRequest with #<Restfulie::Client::Dsl:0xb6a12d5c> at
invoking filter Restfulie::Client::Feature::EnhanceResponse with #<Restfulie::Client::Dsl:0xb6a12d5c> at
invoking filter Restfulie::Client::Feature::SerializeBody with #<Restfulie::Client::Dsl:0xb6a12d5c> at
invoking filter Restfulie::Client::Feature::SetupHeader with #<Restfulie::Client::Dsl:0xb6a12d5c> at
invoking filter Restfulie::Client::Feature::RescueException with #<Restfulie::Client::Dsl:0xb6a12d5c> at
invoking filter Restfulie::Client::Feature::BaseRequest with #<Restfulie::Client::Dsl:0xb6a12d5c> at
GET /items
=> #<Net::HTTPOK 200 OK readbody=true>
irb(main)> puts response.response.headers['content-type']
application/json; charset=utf-8
=> nil
irb(main)> puts response.size
2
=> nil
irb(main)> puts response
#<Net::HTTPOK:0xb70e2d08>
[{"item":{"name":"Pendrive","price":500,"created_at":"2011-02-20T08:23:39Z","updated_at":"2011-02-20T08:23:39Z","id":1}},{"item":{"name":"Laptop","price":25000,"created_at":"2010-02-20T08:23:39Z","updated_at":"2010-02-20T08:23:39Z","id":2}}]
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment