README.md in sucker-0.6.6 vs README.md in sucker-0.7.0
- old
+ new
@@ -20,21 +20,26 @@
worker.curl { |c| c.interface = "eth1" }
Set up a request.
worker << {
- "Operation" => "ItemLookup",
- "IdType" => "ASIN",
- "ItemId" => asin_batch
+ "Operation" => "ItemLookup",
+ "IdType" => "ASIN",
+ "ItemId" => asin_batch,
+ "ResponseGroup" => ["ItemAttributes", "OfferFull"] }
Hit Amazon and do something with the response.
response = worker.get
- p response.code
- p response.time
- p response.body
+
+ # Response internals
+ p response.code,
+ response.time,
+ response.body,
+ response.xml
- response.to_h["ItemLookupResponse"]["Items"]["Item"].each { ... }
+ response.to_h("Item").each { |book| do_something }
+ response.to_h("Error").each { |error| p error["Message"] }
Hit Amazon again.
worker << { "ItemId" => another_asin_batch }
response = worker.get