sucker 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/README.md +17 -54
  2. data/lib/sucker/hash.rb +1 -0
  3. data/lib/sucker/hash.rbc +26 -26
  4. data/lib/sucker/parameters.rb +4 -0
  5. data/lib/sucker/parameters.rbc +95 -30
  6. data/lib/sucker/request.rb +35 -12
  7. data/lib/sucker/request.rbc +420 -244
  8. data/lib/sucker/response.rb +3 -3
  9. data/lib/sucker/response.rbc +91 -65
  10. data/lib/sucker/version.rb +1 -1
  11. data/lib/sucker/version.rbc +1 -1
  12. data/lib/sucker.rb +1 -1
  13. data/spec/fixtures/cassette_library/cartcreate/e3e2f9b71afba67619a95c7178178595.yml +26 -0
  14. data/spec/fixtures/cassette_library/cartcreate/f8fe45cc6b78ac1aac675a8f76d5f7d9.yml +26 -0
  15. data/spec/fixtures/cassette_library/{0415246334.yml → itemlookup/0547439fa22ec1178508f61bc8fb1dfb.yml} +3 -3
  16. data/spec/fixtures/cassette_library/itemlookup/2656b1813249aff0d4febb01044962ff.yml +26 -0
  17. data/spec/fixtures/cassette_library/itemlookup/4908294851a4df13269707e9f6507f91.yml +26 -0
  18. data/spec/fixtures/cassette_library/itemlookup/49690856d2b9cb358fc505dc52862acf.yml +26 -0
  19. data/spec/fixtures/cassette_library/itemlookup/5670727fa0cb9f30464e41aa1346c91c.yml +26 -0
  20. data/spec/fixtures/cassette_library/{b000aspues.yml → itemlookup/67b3c825b2902b511412057442db6e91.yml} +3 -3
  21. data/spec/fixtures/cassette_library/itemlookup/6e6b1dc74378e2e1118713e254191fc0.yml +26 -0
  22. data/spec/fixtures/cassette_library/itemlookup/742f3458144935c0a3320be6e842a17c.yml +26 -0
  23. data/spec/fixtures/cassette_library/itemlookup/76f548183c2804a74d0ed7e0bfbd6d4a.yml +26 -0
  24. data/spec/fixtures/cassette_library/itemlookup/8286b763b726d3dc1fc992023e639b9b.yml +151 -0
  25. data/spec/fixtures/cassette_library/{816614024.yml → itemlookup/9853d1f8ae05d5501df4e4390c5abeae.yml} +18 -18
  26. data/spec/fixtures/cassette_library/itemlookup/9d82768fe80b09c4a3697c608e5edebe.yml +26 -0
  27. data/spec/fixtures/cassette_library/{482224816x.yml → itemlookup/b6c76ad93b17b86adb932b9b97c1f019.yml} +3 -3
  28. data/spec/fixtures/cassette_library/itemlookup/d3d6ea869d31173526f48907bff752a3.yml +26 -0
  29. data/spec/fixtures/cassette_library/itemlookup/d8ad346710c3b479febcf58e67fea7ef.yml +26 -0
  30. data/spec/fixtures/cassette_library/{0394751221.yml → itemlookup/e880c4cb3dd56cdfa2161a71fece15ac.yml} +3 -3
  31. data/spec/fixtures/cassette_library/itemsearch/1c4db6b83580a7498b87d7502c249307.yml +26 -0
  32. data/spec/fixtures/cassette_library/itemsearch/295b9eadfb69d55e1c0acb06220e0b6e.yml +26 -0
  33. data/spec/fixtures/cassette_library/itemsearch/30d2bff757af125e31b82c47380b98ba.yml +26 -0
  34. data/spec/fixtures/cassette_library/itemsearch/34098006ffbbd9570b2c2f9ce23df9f3.yml +26 -0
  35. data/spec/fixtures/cassette_library/itemsearch/4c1e50d070821f4eb9fe3961aba105ee.yml +26 -0
  36. data/spec/fixtures/cassette_library/itemsearch/5a15430433ab94c70466eb61c919a028.yml +26 -0
  37. data/spec/fixtures/cassette_library/itemsearch/8fd40b929a9ed46e2b38ac905c8ab53a.yml +26 -0
  38. data/spec/fixtures/cassette_library/itemsearch/e9a6659c2b464d7388c3831c6425a526.yml +26 -0
  39. data/spec/fixtures/cassette_library/sellerlistingsearch/6b38af058d6a0bda696f49de13cfd343.yml +26 -0
  40. data/spec/fixtures/cassette_library/{a2h6nh4sqyfz4m.yml → sellerlistingsearch/c92200a4bd3d6d9023fa6317a780589b.yml} +3 -3
  41. data/spec/fixtures/cassette_library/sellerlistingsearch/cb25caadce96ac3de70b69b76431d730.yml +26 -0
  42. data/spec/fixtures/cassette_library/sellerlistingsearch/e1261838e1754870ffd309dd78eb7374.yml +26 -0
  43. data/spec/fixtures/cassette_library/spec/sucker/request.yml +4 -4
  44. data/spec/fixtures/cassette_library/spec/sucker/response.yml +3 -3
  45. data/spec/sucker/request_spec.rb +35 -15
  46. data/spec/sucker/request_spec.rbc +660 -166
  47. data/spec/sucker/response_spec.rb +4 -4
  48. data/spec/sucker/response_spec.rbc +133 -269
  49. metadata +75 -36
  50. data/spec/fixtures/cassette_library/0679753354.yml +0 -26
  51. data/spec/fixtures/cassette_library/0816614024-0007218095.yml +0 -26
  52. data/spec/fixtures/cassette_library/0816614024-0143105825.yml +0 -26
  53. data/spec/fixtures/cassette_library/0816614024.yml +0 -26
  54. data/spec/fixtures/cassette_library/a2jyso6w6kep83.yml +0 -26
  55. data/spec/fixtures/cassette_library/author-lacan-or-deleuze-and-not-fiction.yml +0 -26
  56. data/spec/fixtures/cassette_library/deleuze-binding-kindle.yml +0 -26
  57. data/spec/fixtures/cassette_library/deleuze.yml +0 -26
  58. data/spec/fixtures/cassette_library/george-orwell.yml +0 -26
  59. data/spec/fixtures/cassette_library/offer-listing-id.yml +0 -26
@@ -0,0 +1,26 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://ecs.amazonaws.com:80/onca/xml?AWSAccessKeyId=0ZVSQ33MDFPQS8H2PM02&AssociateTag=&Operation=SellerListingSearch&SellerId=A2XAZ8JI5FY49I&Service=AWSECommerceService&Signature=W+Cwq79UMGoajIHDEjs5tyLMUES046ezYiX1HDl07aY=&Timestamp=2011-04-26T08:51:48Z&Version=2010-11-01
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ content-type:
14
+ - text/xml;charset=UTF-8
15
+ server:
16
+ - Server
17
+ date:
18
+ - Tue, 26 Apr 2011 08:51:47 GMT
19
+ nncoection:
20
+ - close
21
+ vary:
22
+ - Accept-Encoding,User-Agent
23
+ transfer-encoding:
24
+ - chunked
25
+ body: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><SellerListingSearchResponse xmlns=\"http://webservices.amazon.com/AWSECommerceService/2010-11-01\"><OperationRequest><HTTPHeaders><Header Name=\"UserAgent\" Value=\"Jakarta Commons-HttpClient/3.0.1\"></Header></HTTPHeaders><RequestId>1K25Z8JPWF93FSK5936M</RequestId><Arguments><Argument Name=\"AssociateTag\"></Argument><Argument Name=\"Service\" Value=\"AWSECommerceService\"></Argument><Argument Name=\"Signature\" Value=\"W+Cwq79UMGoajIHDEjs5tyLMUES046ezYiX1HDl07aY=\"></Argument><Argument Name=\"SellerId\" Value=\"A2XAZ8JI5FY49I\"></Argument><Argument Name=\"Operation\" Value=\"SellerListingSearch\"></Argument><Argument Name=\"AWSAccessKeyId\" Value=\"0ZVSQ33MDFPQS8H2PM02\"></Argument><Argument Name=\"Timestamp\" Value=\"2011-04-26T08:51:48Z\"></Argument><Argument Name=\"Version\" Value=\"2010-11-01\"></Argument></Arguments><RequestProcessingTime>0.216216087341309</RequestProcessingTime></OperationRequest><SellerListings><Request><IsValid>True</IsValid><SellerListingSearchRequest><SellerId>A2XAZ8JI5FY49I</SellerId></SellerListingSearchRequest></Request><TotalResults>3362</TotalResults><TotalPages>337</TotalPages><SellerListing><ExchangeId>Y17M4659665M0155541</ExchangeId><ListingId>1112G011DVV</ListingId><ASIN>0571202284</ASIN><SKU>111220101</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>The Animator's Survival Kit [Paperback] by Williams, Richard</Title><Price><Amount>1699</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$16.99</FormattedPrice></Price><StartDate>2010-12-30</StartDate><Status>Open</Status><Quantity>1</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M5347709M8380406</ExchangeId><ListingId>1211GHJ8CBP</ListingId><ASIN>0896896870</ASIN><SKU>SKU121120100037</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Warman's Vintage Quilts: Identification And Price Guide [Paperback]</Title><Price><Amount>400</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$4.00</FormattedPrice></Price><StartDate>2010-12-11</StartDate><Status>Open</Status><Quantity>5</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M5350811M1807685</ExchangeId><ListingId>1211GHJ8D91</ListingId><ASIN>1440304297</ASIN><SKU>SKU121120100038</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Great Graphic Design on a Budget: How to Do More with Less [Paperback]</Title><Price><Amount>547</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$5.47</FormattedPrice></Price><StartDate>2010-12-11</StartDate><Status>Open</Status><Quantity>11</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M5284093M6355378</ExchangeId><ListingId>1211GHJHBM1</ListingId><ASIN>1440202427</ASIN><SKU>SKU121120100061</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Your Eco-friendly Yard: Sustainable Ideas to Save You Time, Money and the Earth</Title><Price><Amount>400</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$4.00</FormattedPrice></Price><StartDate>2010-12-11</StartDate><Status>Open</Status><Quantity>1</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M5678770M4997920</ExchangeId><ListingId>1211GHJHC7P</ListingId><ASIN>1581806493</ASIN><SKU>SKU121120100047</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Secrets to Realistic Drawing [Paperback] by Parks, Carrie Stuart and Parks, Rick</Title><Price><Amount>887</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$8.87</FormattedPrice></Price><StartDate>2010-12-11</StartDate><Status>Open</Status><Quantity>5</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M5681442M1360823</ExchangeId><ListingId>1211GHJHCVV</ListingId><ASIN>1600610102</ASIN><SKU>SKU121120100048</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>John Howe Fantasy Art Workshop [Paperback] by Howe, John</Title><Price><Amount>400</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$4.00</FormattedPrice></Price><StartDate>2010-12-11</StartDate><Status>Open</Status><Quantity>9</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M5372347M4467082</ExchangeId><ListingId>1211GHJHGMV</ListingId><ASIN>1440305382</ASIN><SKU>SKU121120100068</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Take-Along Knitting: 20+ Easy Portable Projects from Your Favorite Authors</Title><Price><Amount>400</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$4.00</FormattedPrice></Price><StartDate>2010-12-11</StartDate><Status>Open</Status><Quantity>1</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M3226964M7287342</ExchangeId><ListingId>1214GJ15D31</ListingId><ASIN>1600619126</ASIN><SKU>SKU121320100018</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Pouring Light [Paperback] by Grastorf, Jean</Title><Price><Amount>417</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$4.17</FormattedPrice></Price><StartDate>2010-12-14</StartDate><Status>Open</Status><Quantity>5</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M3083841M4058014</ExchangeId><ListingId>1214GJ15EMV</ListingId><ASIN>1581806493</ASIN><SKU>SKU121320100001</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>Secrets to Realistic Drawing [Paperback] by Parks, Carrie Stuart and Parks, Rick</Title><Price><Amount>887</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$8.87</FormattedPrice></Price><StartDate>2010-12-14</StartDate><Status>Open</Status><Quantity>3</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing><SellerListing><ExchangeId>Y17M3216751M5745469</ExchangeId><ListingId>1214GJ15FED</ListingId><ASIN>0891345728</ASIN><SKU>SKU121320100019</SKU><WillShipExpedited>0</WillShipExpedited><WillShipInternational>0</WillShipInternational><Title>The Art of Painting Animals on Rocks [Paperback] by Wellford, Lin</Title><Price><Amount>400</Amount><CurrencyCode>USD</CurrencyCode><FormattedPrice>$4.00</FormattedPrice></Price><StartDate>2010-12-14</StartDate><Status>Open</Status><Quantity>3</Quantity><Condition>new</Condition><SubCondition>new</SubCondition><Seller><SellerId>A2XAZ8JI5FY49I</SellerId><Nickname>Marlton Books</Nickname></Seller></SellerListing></SellerListings></SellerListingSearchResponse>"
26
+ http_version: "1.1"
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://ecs.amazonaws.com:80/onca/xml?AWSAccessKeyId=key&AssociateTag=&Service=AWSECommerceService&Signature=FgjzkV75NM8eJv2Bpl8pj3j+y/a8QNwSlwrYgJgGF9s=&Timestamp=2011-02-17T11:55:53Z&Version=2010-11-01
5
+ uri: http://ecs.amazonaws.com:80/onca/xml?AWSAccessKeyId=key&AssociateTag=&Service=AWSECommerceService&Signature=T8UVnbr8mVovMeUBQNddEHRfCBCGZnoNt7xKM0QwCWE=&Timestamp=2011-04-04T22:54:13Z&Version=2010-11-01
6
6
  body:
7
7
  headers:
8
8
  response: !ruby/struct:VCR::Response
@@ -11,13 +11,13 @@
11
11
  message: OK
12
12
  headers:
13
13
  date:
14
- - Thu, 17 Feb 2011 11:55:53 GMT
14
+ - Mon, 04 Apr 2011 22:54:13 GMT
15
15
  server:
16
16
  - Server
17
17
  x-amz-id-1:
18
- - 18602B1C1V75TMSMFS2H
18
+ - 0VR34BN3AF872DQJX8F4
19
19
  x-amz-id-2:
20
- - 7lHWs8KypbjeedCbJBz4LWH8B3iKTa3QJBlpEUgyEa4=
20
+ - GceQEQ2ty5ALf+AGiiTOVLnfZ+Y1ZPzeObq8gIxb7JI=
21
21
  nncoection:
22
22
  - close
23
23
  - close
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://ecs.amazonaws.com:80/onca/xml?AWSAccessKeyId=0ZVSQ33MDFPQS8H2PM02&AssociateTag=&IdType=ASIN&ItemId=0816614024,0143105825&Operation=ItemLookup&Service=AWSECommerceService&Signature=Aw/zi49BcLgyKZEJgpLK12FLvQMdXwc1W8DTax0Yf8Q=&Timestamp=2011-02-17T12:04:03Z&Version=2010-11-01
5
+ uri: http://ecs.amazonaws.com:80/onca/xml?AWSAccessKeyId=0ZVSQ33MDFPQS8H2PM02&AssociateTag=&IdType=ASIN&ItemId=0816614024,0143105825&Operation=ItemLookup&Service=AWSECommerceService&Signature=yk2BUlVaBNJ7Kbl+pMCaUfTT1mJjsD9rtLLlo381BX8=&Timestamp=2011-04-06T11:45:15Z&Version=2010-11-01
6
6
  body:
7
7
  headers:
8
8
  response: !ruby/struct:VCR::Response
@@ -11,7 +11,7 @@
11
11
  message: OK
12
12
  headers:
13
13
  date:
14
- - Thu, 17 Feb 2011 12:04:03 GMT
14
+ - Wed, 06 Apr 2011 11:45:15 GMT
15
15
  server:
16
16
  - Server
17
17
  content-type:
@@ -22,5 +22,5 @@
22
22
  - close
23
23
  transfer-encoding:
24
24
  - chunked
25
- body: "<?xml version=\"1.0\" ?><ItemLookupResponse xmlns=\"http://webservices.amazon.com/AWSECommerceService/2010-11-01\"><OperationRequest><HTTPHeaders><Header Name=\"UserAgent\" Value=\"Ruby\"></Header></HTTPHeaders><RequestId>730660e8-a2a5-4284-ae36-2c3271109059</RequestId><Arguments><Argument Name=\"Operation\" Value=\"ItemLookup\"></Argument><Argument Name=\"Service\" Value=\"AWSECommerceService\"></Argument><Argument Name=\"Signature\" Value=\"Aw/zi49BcLgyKZEJgpLK12FLvQMdXwc1W8DTax0Yf8Q=\"></Argument><Argument Name=\"AssociateTag\"></Argument><Argument Name=\"Version\" Value=\"2010-11-01\"></Argument><Argument Name=\"ItemId\" Value=\"0816614024,0143105825\"></Argument><Argument Name=\"IdType\" Value=\"ASIN\"></Argument><Argument Name=\"AWSAccessKeyId\" Value=\"0ZVSQ33MDFPQS8H2PM02\"></Argument><Argument Name=\"Timestamp\" Value=\"2011-02-17T12:04:03Z\"></Argument></Arguments><RequestProcessingTime>0.0863870000000000</RequestProcessingTime></OperationRequest><Items><Request><IsValid>True</IsValid><ItemLookupRequest><Condition>New</Condition><DeliveryMethod>Ship</DeliveryMethod><IdType>ASIN</IdType><MerchantId>Amazon</MerchantId><OfferPage>1</OfferPage><ItemId>0816614024</ItemId><ItemId>0143105825</ItemId><ResponseGroup>Small</ResponseGroup><ReviewPage>1</ReviewPage><ReviewSort>-SubmissionDate</ReviewSort><VariationPage>All</VariationPage></ItemLookupRequest></Request><Item><ASIN>0816614024</ASIN><DetailPageURL>http://www.amazon.com/Thousand-Plateaus-Schizophrenia-Gilles-Deleuze/dp/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0816614024</DetailPageURL><ItemLinks><ItemLink><Description>Technical Details</Description><URL>http://www.amazon.com/Thousand-Plateaus-Schizophrenia-Gilles-Deleuze/dp/tech-data/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Add To Baby Registry</Description><URL>http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0816614024%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Add To Wedding Registry</Description><URL>http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0816614024%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Add To Wishlist</Description><URL>http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0816614024%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Tell A Friend</Description><URL>http://www.amazon.com/gp/pdp/taf/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>All Customer Reviews</Description><URL>http://www.amazon.com/review/product/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>All Offers</Description><URL>http://www.amazon.com/gp/offer-listing/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink></ItemLinks><ItemAttributes><Author>Gilles Deleuze</Author><Creator Role=\"Contributor\">Felix Guattari</Creator><Manufacturer>Univ Of Minnesota Press</Manufacturer><ProductGroup>Book</ProductGroup><Title>Thousand Plateaus: Capitalism and Schizophrenia</Title></ItemAttributes></Item><Item><ASIN>0143105825</ASIN><DetailPageURL>http://www.amazon.com/Anti-Oedipus-Capitalism-Schizophrenia-Penguin-Classics/dp/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0143105825</DetailPageURL><ItemLinks><ItemLink><Description>Technical Details</Description><URL>http://www.amazon.com/Anti-Oedipus-Capitalism-Schizophrenia-Penguin-Classics/dp/tech-data/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Add To Baby Registry</Description><URL>http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0143105825%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Add To Wedding Registry</Description><URL>http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0143105825%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Add To Wishlist</Description><URL>http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0143105825%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Tell A Friend</Description><URL>http://www.amazon.com/gp/pdp/taf/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>All Customer Reviews</Description><URL>http://www.amazon.com/review/product/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>All Offers</Description><URL>http://www.amazon.com/gp/offer-listing/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink></ItemLinks><ItemAttributes><Author>Gilles Deleuze</Author><Author>Felix Guattari</Author><Creator Role=\"Translator\">Robert Hurley</Creator><Creator Role=\"Translator\">Mark Seem</Creator><Creator Role=\"Introduction\">Mark Seem</Creator><Creator Role=\"Translator\">Helen Lane</Creator><Creator Role=\"Preface\">Michel Foucault</Creator><Manufacturer>Penguin Classics</Manufacturer><ProductGroup>Book</ProductGroup><Title>Anti-Oedipus: Capitalism and Schizophrenia (Penguin Classics)</Title></ItemAttributes></Item></Items></ItemLookupResponse>"
25
+ body: "<?xml version=\"1.0\" ?><ItemLookupResponse xmlns=\"http://webservices.amazon.com/AWSECommerceService/2010-11-01\"><OperationRequest><HTTPHeaders><Header Name=\"UserAgent\" Value=\"Ruby\"></Header></HTTPHeaders><RequestId>4552f365-b7b9-49fb-b5aa-b3ab0973c6e4</RequestId><Arguments><Argument Name=\"Operation\" Value=\"ItemLookup\"></Argument><Argument Name=\"Service\" Value=\"AWSECommerceService\"></Argument><Argument Name=\"Signature\" Value=\"yk2BUlVaBNJ7Kbl+pMCaUfTT1mJjsD9rtLLlo381BX8=\"></Argument><Argument Name=\"AssociateTag\"></Argument><Argument Name=\"Version\" Value=\"2010-11-01\"></Argument><Argument Name=\"ItemId\" Value=\"0816614024,0143105825\"></Argument><Argument Name=\"IdType\" Value=\"ASIN\"></Argument><Argument Name=\"AWSAccessKeyId\" Value=\"0ZVSQ33MDFPQS8H2PM02\"></Argument><Argument Name=\"Timestamp\" Value=\"2011-04-06T11:45:15Z\"></Argument></Arguments><RequestProcessingTime>0.0233890000000000</RequestProcessingTime></OperationRequest><Items><Request><IsValid>True</IsValid><ItemLookupRequest><Condition>New</Condition><DeliveryMethod>Ship</DeliveryMethod><IdType>ASIN</IdType><MerchantId>Amazon</MerchantId><OfferPage>1</OfferPage><ItemId>0816614024</ItemId><ItemId>0143105825</ItemId><ResponseGroup>Small</ResponseGroup><ReviewPage>1</ReviewPage><ReviewSort>-SubmissionDate</ReviewSort><VariationPage>All</VariationPage></ItemLookupRequest></Request><Item><ASIN>0816614024</ASIN><DetailPageURL>http://www.amazon.com/Thousand-Plateaus-Schizophrenia-Gilles-Deleuze/dp/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0816614024</DetailPageURL><ItemLinks><ItemLink><Description>Technical Details</Description><URL>http://www.amazon.com/Thousand-Plateaus-Schizophrenia-Gilles-Deleuze/dp/tech-data/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Add To Baby Registry</Description><URL>http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0816614024%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Add To Wedding Registry</Description><URL>http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0816614024%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Add To Wishlist</Description><URL>http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0816614024%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>Tell A Friend</Description><URL>http://www.amazon.com/gp/pdp/taf/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>All Customer Reviews</Description><URL>http://www.amazon.com/review/product/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink><ItemLink><Description>All Offers</Description><URL>http://www.amazon.com/gp/offer-listing/0816614024%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0816614024</URL></ItemLink></ItemLinks><ItemAttributes><Author>Gilles Deleuze</Author><Creator Role=\"Contributor\">Felix Guattari</Creator><Manufacturer>Univ Of Minnesota Press</Manufacturer><ProductGroup>Book</ProductGroup><Title>Thousand Plateaus: Capitalism and Schizophrenia</Title></ItemAttributes></Item><Item><ASIN>0143105825</ASIN><DetailPageURL>http://www.amazon.com/Anti-Oedipus-Capitalism-Schizophrenia-Penguin-Classics/dp/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0143105825</DetailPageURL><ItemLinks><ItemLink><Description>Technical Details</Description><URL>http://www.amazon.com/Anti-Oedipus-Capitalism-Schizophrenia-Penguin-Classics/dp/tech-data/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Add To Baby Registry</Description><URL>http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0143105825%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Add To Wedding Registry</Description><URL>http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0143105825%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Add To Wishlist</Description><URL>http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0143105825%26SubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>Tell A Friend</Description><URL>http://www.amazon.com/gp/pdp/taf/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>All Customer Reviews</Description><URL>http://www.amazon.com/review/product/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink><ItemLink><Description>All Offers</Description><URL>http://www.amazon.com/gp/offer-listing/0143105825%3FSubscriptionId%3D0ZVSQ33MDFPQS8H2PM02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0143105825</URL></ItemLink></ItemLinks><ItemAttributes><Author>Gilles Deleuze</Author><Author>Felix Guattari</Author><Creator Role=\"Translator\">Robert Hurley</Creator><Creator Role=\"Translator\">Mark Seem</Creator><Creator Role=\"Introduction\">Mark Seem</Creator><Creator Role=\"Translator\">Helen Lane</Creator><Creator Role=\"Preface\">Michel Foucault</Creator><Manufacturer>Penguin Classics</Manufacturer><ProductGroup>Book</ProductGroup><Title>Anti-Oedipus: Capitalism and Schizophrenia (Penguin Classics)</Title></ItemAttributes></Item></Items></ItemLookupResponse>"
26
26
  http_version: "1.1"
@@ -4,36 +4,56 @@ module Sucker
4
4
  describe Request do
5
5
  use_vcr_cassette 'spec/sucker/request', :record => :new_episodes
6
6
 
7
- let(:worker) do
7
+ let(:request) do
8
8
  Sucker.new(
9
9
  :locale => :us,
10
10
  :key => 'key',
11
11
  :secret => 'secret')
12
12
  end
13
13
 
14
+ describe ".locales" do
15
+ it "returns available locales" do
16
+ Request.locales.should =~ [:us, :uk, :de, :ca, :fr, :jp]
17
+ end
18
+ end
19
+
14
20
  describe '#<<' do
15
21
  it 'merges a hash into the existing parameters' do
16
- worker << { 'foo' => 'bar' }
17
- worker.parameters['foo'].should eql 'bar'
22
+ request << { 'foo' => 'bar' }
23
+ request.parameters['foo'].should eql 'bar'
18
24
  end
19
25
  end
20
26
 
21
27
  describe '#get' do
22
28
  it 'returns a response' do
23
- worker.get.class.ancestors.should include Response
29
+ request.get.class.ancestors.should include Response
30
+ end
31
+ end
32
+
33
+ describe "#reset" do
34
+ it "returns parameters to a pristine state" do
35
+ request << { 'foo' => 'bar' }
36
+ request.reset
37
+
38
+ request.parameters.should have_key 'Service'
39
+ request.parameters.should_not have_key 'foo'
40
+ end
41
+
42
+ it "returns the request object" do
43
+ request.reset.should be_a Request
24
44
  end
25
45
  end
26
46
 
27
47
  describe '#version=' do
28
48
  it 'sets the Amazon API version' do
29
- worker.version = 'foo'
30
- worker.parameters['Version'].should eql 'foo'
49
+ request.version = 'foo'
50
+ request.parameters['Version'].should eql 'foo'
31
51
  end
32
52
  end
33
53
 
34
54
  describe '#build_query' do
35
55
  let(:query) do
36
- worker.send(:build_query)
56
+ request.send(:build_query)
37
57
  end
38
58
 
39
59
  it 'canonicalizes query' do
@@ -45,40 +65,40 @@ module Sucker
45
65
  end
46
66
 
47
67
  it 'sorts query' do
48
- worker.parameters['A'] = 'foo'
68
+ request.parameters['A'] = 'foo'
49
69
  query.should match /^A=foo/
50
70
  end
51
71
  end
52
72
 
53
73
  describe '#build_signed_query' do
54
- let(:query) { worker.send(:build_signed_query) }
74
+ let(:query) { request.send(:build_signed_query) }
55
75
 
56
76
  it 'includes the key for the current locale' do
57
- worker.key = 'foo'
77
+ request.key = 'foo'
58
78
  query.should include 'AWSAccessKeyId=foo'
59
79
  end
60
80
 
61
81
  it 'includes the associate tag for the current locale' do
62
- worker.associate_tag = 'foo'
82
+ request.associate_tag = 'foo'
63
83
  query.should include 'AssociateTag=foo'
64
84
  end
65
85
 
66
86
  it 'returns a signed query string' do
67
- query = worker.send :build_signed_query
87
+ query = request.send :build_signed_query
68
88
  query.should include 'Signature='
69
89
  end
70
90
  end
71
91
 
72
92
  describe '#escape' do
73
93
  it 'URL-encodes a string' do
74
- worker.send(:escape, 'foo,bar').should eql 'foo%2Cbar'
94
+ request.send(:escape, 'foo,bar').should eql 'foo%2Cbar'
75
95
  end
76
96
  end
77
97
 
78
98
  describe '#host' do
79
99
  it 'returns a host' do
80
- worker.locale = :fr
81
- worker.send(:host).should eql 'ecs.amazonaws.fr'
100
+ request.locale = :fr
101
+ request.send(:host).should eql 'ecs.amazonaws.fr'
82
102
  end
83
103
  end
84
104
  end