Created
June 9, 2010 00:44
-
-
Save guilhermesilveira/430873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'restfulie' | |
# retrieves the list | |
resource = Restfulie.at("http://localhost:3000/items").accepts("application/xml").get | |
# picks the first item | |
basket = {"basket" => {"items" => [{"id" => resource.items.item.first["id"]}]}} | |
# creates the basket | |
resource = resource.items.links.basket.post! basket | |
# prepares the payment | |
payment = {"payment" => {"cardnumber" => "4850000000000001", "cardholder" => "guilherme silveira", :amount => resource.basket.price}} | |
# creates the payment | |
resource = resource.basket.links.payment.post! payment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment