agent_cooper 0.0.6 → 0.0.7.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.gitignore +0 -1
  2. data/.rvmrc +1 -0
  3. data/.travis.yml +2 -0
  4. data/README.md +6 -4
  5. data/Rakefile +2 -0
  6. data/agent_cooper.gemspec +16 -14
  7. data/features/finder.feature +1 -1
  8. data/features/support/env.rb +1 -5
  9. data/features/support/vcr.rb +2 -6
  10. data/lib/agent_cooper.rb +13 -15
  11. data/lib/agent_cooper/builder.rb +46 -0
  12. data/lib/agent_cooper/config.rb +6 -1
  13. data/lib/agent_cooper/request.rb +54 -30
  14. data/lib/agent_cooper/requests/finder.rb +12 -15
  15. data/lib/agent_cooper/requests/merchandiser.rb +15 -16
  16. data/lib/agent_cooper/requests/shopper.rb +14 -14
  17. data/lib/agent_cooper/response.rb +9 -10
  18. data/lib/agent_cooper/synchrony.rb +22 -9
  19. data/lib/agent_cooper/version.rb +1 -1
  20. data/spec/agent_cooper/config_spec.rb +36 -0
  21. data/spec/agent_cooper/request_spec.rb +17 -106
  22. data/spec/agent_cooper/requests/finder_spec.rb +11 -8
  23. data/spec/agent_cooper/requests/merchandiser_spec.rb +13 -7
  24. data/spec/agent_cooper/requests/shopper_spec.rb +12 -7
  25. data/spec/agent_cooper/response_spec.rb +21 -53
  26. data/spec/agent_cooper_spec.rb +5 -2
  27. data/spec/fixtures/cassettes/finder/find_items_advanced/0612b88aa6d3bcece0d88b587267b6de.yml +590 -0
  28. data/spec/fixtures/cassettes/finder/find_items_by_category/e782300f74c9c6669d5c0d9719d03853.yml +420 -0
  29. data/spec/fixtures/cassettes/finder/find_items_by_keywords/a6e74b4aff9c701b73db82def8b31bc8.yml +632 -0
  30. data/spec/fixtures/cassettes/finder/find_items_by_product/9dd9b3128cbf3cda22e027207825c4c0.yml +684 -0
  31. data/spec/fixtures/cassettes/finder/find_items_in_ebay_stores/6514aa6b1db3f9fbddcfbb32b58fb67e.yml +464 -0
  32. data/spec/fixtures/cassettes/finder/get_histograms/{80bd04d96cd529af4148866a2d28f079.yml → 1cc52302ce2de278051c3b6be90ccd36.yml} +11 -11
  33. data/spec/fixtures/cassettes/finder/get_search_keywords_recommendation/{ec96bf3af091373de08550ff46f86c87.yml → 85a972f0b32d1e011b2c8b74fff19261.yml} +6 -6
  34. data/spec/fixtures/cassettes/merchandiser/get_most_watched_items/66600b7c4cb52b32e517f3e5563463e1.yml +51 -0
  35. data/spec/fixtures/cassettes/merchandiser/get_related_category_items/{c949e90fb2bd975020df657a4348328d.yml → c74a3e3dff9ffb3e5a84c057d1a88bf3.yml} +6 -6
  36. data/spec/fixtures/cassettes/merchandiser/get_similar_items/{56c2c41a60135db83d359053778a065f.yml → 943af1f951bf437e72a0d6325bc167af.yml} +6 -6
  37. data/spec/fixtures/cassettes/merchandiser/get_top_selling_products/323d900971616df3712c8bc7737a70f1.yml +51 -0
  38. data/spec/fixtures/cassettes/shopper/find_half_products/{77ad8a2ade8e4efadef07346677e43a9.yml → 7bf13f5c5fad44a19d46d68168dc05a3.yml} +15 -15
  39. data/spec/fixtures/cassettes/shopper/find_popular_items/67c26e00c0be5bfa5994b1ae408517f7.yml +258 -0
  40. data/spec/fixtures/cassettes/shopper/find_popular_searches/{6db9b375ea610e870e7a4ca4e20974ec.yml → bcf07f2cb90cae7cb40f2252dde126a6.yml} +8 -8
  41. data/spec/fixtures/cassettes/shopper/find_products/{3fd6d6000037cd409ab1ef18a6075257.yml → b1001bc7a19381f533b36d7b40daedd7.yml} +16 -16
  42. data/spec/fixtures/cassettes/shopper/find_reviews_and_guides/{8586a984e122cb84136d3cc0bb8bec77.yml → ceb14bd40e2371d3e58e9c4645e857f2.yml} +16 -16
  43. data/spec/fixtures/cassettes/shopper/get_item_status/{f34cf10c602f9fec7a388297888b4299.yml → 83876f24642637642979b09a6475b475.yml} +8 -8
  44. data/spec/fixtures/cassettes/shopper/get_multiple_items/{c1183c23add6cad9afbb73f986c2692e.yml → 1f42d0c0fe105f8c0ad79d08f1900738.yml} +8 -8
  45. data/spec/fixtures/cassettes/shopper/get_shipping_costs/{e7de18031f266637414155639797c097.yml → 9ca24c61a943a3f6647e45b0ae30261f.yml} +8 -8
  46. data/spec/fixtures/cassettes/shopper/get_single_item/{d4a895de6b214907c47a0b32ab630b9a.yml → d50997fefbf6099325c3c01ef2a4cb51.yml} +8 -8
  47. data/spec/fixtures/cassettes/shopper/get_user_profile/{dccabbf426bfeba4d898ca546e17dd4b.yml → a5a8fd7e8aeaea9a16dc09c6cb8f3092.yml} +8 -8
  48. data/spec/spec_helper.rb +2 -1
  49. data/spec/support/shared/request.rb +67 -0
  50. metadata +83 -92
  51. data/lib/agent_cooper/nokogiri_decorator.rb +0 -47
  52. data/spec/fixtures/cassettes/finder/find_items_advanced/d49218a9522a4a055e31fc6b88c3a2b5.yml +0 -528
  53. data/spec/fixtures/cassettes/finder/find_items_by_category/85e07de9993e68d09e895f1b01234c5a.yml +0 -463
  54. data/spec/fixtures/cassettes/finder/find_items_by_keywords/91d7d9b4b62b82877604465a20f9ffa9.yml +0 -668
  55. data/spec/fixtures/cassettes/finder/find_items_by_product/59ee1391b6dfc2a93e30c8911942fc71.yml +0 -744
  56. data/spec/fixtures/cassettes/finder/find_items_in_ebay_stores/c7d658804b6353fda03809c21b183af2.yml +0 -472
  57. data/spec/fixtures/cassettes/merchandiser/get_most_watched_items/3c0cb6fb7bb94b384cae15be175e9640.yml +0 -51
  58. data/spec/fixtures/cassettes/merchandiser/get_top_selling_products/a82dcb1f094754e54f2a5de191818c3f.yml +0 -53
  59. data/spec/fixtures/cassettes/shopper/find_popular_items/532fcb32fee187bdc6cc5fb7e4336992.yml +0 -258
  60. data/spec/fixtures/ebay.yml.sample +0 -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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=FindPopularSearches&QueryKeywords=dell&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=FindPopularSearches&QueryKeywords=dell&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,26 +17,26 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:25 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14025482_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdDdlaHFg
29
29
  x-ebay-api-server-name:
30
- - ___dW0ucm83Nyg2MWE8MjQ1Kjc3LTMoNjQ2KDMwPz43OzU=
30
+ - ___dW0ucnAqMzVjMWI1MygyNSgxLTc2NS00MjE5PTY/Mw==
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:5CD0BB9874BFF7D9EB27285028377285391969966676
32
+ - urn:uuid:22667A74B6C5FB748436593776732353636-2062244449
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:12 GMT
34
+ - Sat, 12 Nov 2011 07:58:25 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <FindPopularSearchesResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.577Z</Timestamp>\n
39
- \ <Ack>Success</Ack>\n <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:25.597Z</Timestamp>\n
39
+ \ <Ack>Success</Ack>\n <Build>E745_CORE_BUNDLED_14025482_R1</Build>\n <Version>745</Version>\n
40
40
  \ <PopularSearchResult>\n <QueryKeywords>dell</QueryKeywords>\n <AlternativeSearches>dell
41
41
  laptop;dell desktop;laptop;dell xps;dell inspiron</AlternativeSearches>\n <RelatedSearches>hp;dell
42
42
  axim x30;dell latitude;acer;dell phone;dell optiplex;alienware laptop;dell precision;dell
@@ -2,7 +2,7 @@
2
2
  - !ruby/struct:VCR::HTTPInteraction
3
3
  request: !ruby/struct:VCR::Request
4
4
  method: :get
5
- uri: http://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=FindProducts&QueryKeywords=harry%20potter&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=FindProducts&QueryKeywords=harry%20potter&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,36 +17,36 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:24 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14025482_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdDdlaHFg
29
29
  x-ebay-api-server-name:
30
- - ___dW0ucm43Nyg/MzZxcXNiKjc3LTMoMTorPjM5PTY/Mw==
30
+ - ___dW0ucm83Nyhtdm5paH51Kjc3LTMoNjQ2KDQwPz43OzU=
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:0818EFD69DD414CBF6269545847914785511118903125
32
+ - urn:uuid:19CEF3E19DBAF77BD4369242182238222751559774535
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:11 GMT
34
+ - Sat, 12 Nov 2011 07:58:23 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <FindProductsResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.285Z</Timestamp>\n
39
- \ <Ack>Success</Ack>\n <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
40
- \ <ApproximatePages>1170</ApproximatePages>\n <MoreResults>true</MoreResults>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:24.223Z</Timestamp>\n
39
+ \ <Ack>Success</Ack>\n <Build>E745_CORE_BUNDLED_14025482_R1</Build>\n <Version>745</Version>\n
40
+ \ <ApproximatePages>1250</ApproximatePages>\n <MoreResults>true</MoreResults>\n
41
41
  \ <PageNumber>1</PageNumber>\n <Product>\n <DomainName>DVDs</DomainName>\n
42
- \ <DetailsURL>http://syicatalogs.ebay.com/ws/eBayISAPI.dll?PageSyiProductDetails&amp;IncludeAttributes=1&amp;ShowAttributesTable=1&amp;ProductMementoString=115979:2:1049:1597262630:336208740:1b8ed71676cebc1fb9211d3c1eee0b4a:1:1:1:1415162318</DetailsURL>\n
43
- \ <DisplayStockPhotos>true</DisplayStockPhotos>\n <ProductID type=\"Reference\">99846530</ProductID>\n
44
- \ <ProductID type=\"UPC\">883929139446</ProductID>\n <ItemSpecifics>\n
42
+ \ <DetailsURL>http://syicatalogs.ebay.com/ws/eBayISAPI.dll?PageSyiProductDetails&amp;IncludeAttributes=1&amp;ShowAttributesTable=1&amp;ProductMementoString=118656:2:1049:4276817045:390427655:3f5acce195ccfcf94a20bffcb51bf332:1:1:1:5000000672452</DetailsURL>\n
43
+ \ <DisplayStockPhotos>true</DisplayStockPhotos>\n <ProductID type=\"Reference\">110288225</ProductID>\n
44
+ \ <ProductID type=\"UPC\">883929140459</ProductID>\n <ItemSpecifics>\n
45
45
  \ <NameValueList>\n <Name>Format</Name>\n <Value>DVD</Value>\n
46
46
  \ </NameValueList>\n <NameValueList>\n <Name>Rating</Name>\n <Value>PG-13</Value>\n
47
47
  \ </NameValueList>\n <NameValueList>\n <Name>Leading Role</Name>\n
48
- \ </NameValueList>\n </ItemSpecifics>\n <ReviewCount>84</ReviewCount>\n
49
- \ <StockPhotoURL>http://i.ebayimg.com/00/$(KGrHqF,!l0E2DwP)(v!BNo16imfYQ~~_6.JPG?set_id=89040003C1</StockPhotoURL>\n
50
- \ <Title>Harry Potter and the Deathly Hallows: Part I (DVD, 2011)</Title>\n
51
- \ </Product>\n <TotalProducts>1170</TotalProducts>\n </FindProductsResponse>\n "
48
+ \ </NameValueList>\n </ItemSpecifics>\n <ReviewCount>0</ReviewCount>\n
49
+ \ <StockPhotoURL>http://i.ebayimg.com/00/$(KGrHqMOKooE6eVU7UV4BOuWWY5i!g~~_6.JPG?set_id=89040003C1</StockPhotoURL>\n
50
+ \ <Title>Harry Potter and the Deathly Hallows: Part II (DVD, 2011)</Title>\n
51
+ \ </Product>\n <TotalProducts>1250</TotalProducts>\n </FindProductsResponse>\n "
52
52
  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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=FindReviewsAndGuides&CategoryID=177&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=FindReviewsAndGuides&CategoryID=177&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,29 +17,29 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:26 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14025482_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdDdlaHFg
29
29
  x-ebay-api-server-name:
30
- - ___dW0ucm83Nyg2MTY0MzIzKjc3LTMoNjQ2KDU0Pz43OzU=
30
+ - ___dW0ucm83Nyhtdm5paH51Kjc3LTMoNjQ2KDQwPz43OzU=
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:5CD0BB9874BFF7D9EB2728502858908350760218944
32
+ - urn:uuid:62CB515CDAAA1C5553376291529040009361332262564
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:12 GMT
34
+ - Sat, 12 Nov 2011 07:58:25 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <FindReviewsAndGuidesResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.926Z</Timestamp>\n
39
- \ <Ack>Success</Ack>\n <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
40
- \ <BuyingGuideCount>596</BuyingGuideCount>\n <ReviewsAndGuidesURL>http://search.reviews.ebay.com/_PC+Laptops+%26+Netbooks_W0QQuqtZgQQucatZ177</ReviewsAndGuidesURL>\n
41
- \ <PageNumber>1</PageNumber>\n <TotalPages>120</TotalPages>\n <BuyingGuideDetails>\n
42
- \ <BuyingGuide>\n <Name>Laptops</Name>\n <URL>http://reviews.ebay.com/Laptops-Buying-Guide_W0QQugidZ10000000000025018</URL>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:26.317Z</Timestamp>\n
39
+ \ <Ack>Success</Ack>\n <Build>E745_CORE_BUNDLED_14025482_R1</Build>\n <Version>745</Version>\n
40
+ \ <BuyingGuideCount>620</BuyingGuideCount>\n <ReviewsAndGuidesURL>http://search.reviews.ebay.com/_PC+Laptops+%26+Netbooks?uqt=g&amp;ucat=177</ReviewsAndGuidesURL>\n
41
+ \ <PageNumber>1</PageNumber>\n <TotalPages>124</TotalPages>\n <BuyingGuideDetails>\n
42
+ \ <BuyingGuide>\n <Name>Laptops</Name>\n <URL>http://reviews.ebay.com/Laptops-Buying-Guide?ugid=10000000000025018</URL>\n
43
43
  \ <CategoryID>177</CategoryID>\n <Title>Laptops Buying Guide</Title>\n
44
44
  \ <Text>&lt;html&gt;&lt;a name=&quot;top&quot;&gt;&lt;/a&gt;&lt;head&gt;\n
45
45
  \ &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html;
@@ -63,7 +63,7 @@
63
63
  type=&quot;text/javascript&quot;&gt;eventDispatcher.attachHandlerToElement(&apos;body&apos;,&apos;onload&apos;,new
64
64
  jsEvt0());\n\n&lt;/script&gt;&lt;span class=&quot;ebay&quot;&gt;&lt;div id=&quot;gnheader&quot;
65
65
  clas...</Text>\n <CreationTime>2005-10-13T10:14:38.000Z</CreationTime>\n
66
- \ </BuyingGuide>\n <BuyingGuide>\n <Name>Laptops</Name>\n <URL>http://reviews.ebay.com/Laptops-Buying-Guide_W0QQugidZ10000000000000932</URL>\n
66
+ \ </BuyingGuide>\n <BuyingGuide>\n <Name>Laptops</Name>\n <URL>http://reviews.ebay.com/Laptops-Buying-Guide?ugid=10000000000000932</URL>\n
67
67
  \ <CategoryID>177</CategoryID>\n <Title>Laptops Buying Guide</Title>\n
68
68
  \ <Text>&lt;html xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;&lt;a
69
69
  name=&quot;top&quot;&gt;&lt;/a&gt;&lt;head&gt;\n &lt;meta http-equiv=&quot;Content-Type&quot;
@@ -85,7 +85,7 @@
85
85
  class=&quot;ebay&quot;&gt;&lt;form class=&quot;nomargin&quot; method=&quot;get&quot;
86
86
  name=&quot;headerSearch&quot; onsubmit=&quot;ebay.oDocument._getControl(&apos;searchHeader&apos;)._...</Text>\n
87
87
  \ <CreationTime>2005-09-22T20:41:32.000Z</CreationTime>\n </BuyingGuide>\n
88
- \ <BuyingGuide>\n <Name>How to buy a noteboo...</Name>\n <URL>http://reviews.ebay.com/How-to-buy-a-notebook-computer_W0QQugidZ10000000000068196</URL>\n
88
+ \ <BuyingGuide>\n <Name>How to buy a noteboo...</Name>\n <URL>http://reviews.ebay.com/How-to-buy-a-notebook-computer?ugid=10000000000068196</URL>\n
89
89
  \ <CategoryID>177</CategoryID>\n <Title>How to buy a notebook computer.</Title>\n
90
90
  \ <Text>(1)&amp;nbsp;&amp;nbsp; &amp;nbsp;Before you buy&amp;nbsp;a computer
91
91
  you need to decide what your needs are. The first decision is whether you want
@@ -113,7 +113,7 @@
113
113
  not be moving the notebook often, I chose to get a desktop replacement notebook.
114
114
  The ability to pick up the whole computer and put i...</Text>\n <CreationTime>2005-11-20T09:31:23.000Z</CreationTime>\n
115
115
  \ <UserID>danielnyc</UserID>\n </BuyingGuide>\n <BuyingGuide>\n <Name>Simple
116
- Laptop Buying...</Name>\n <URL>http://reviews.ebay.com/Simple-Laptop-Buying-Numbers-Aren-apos-t-Everything_W0QQugidZ10000000000790441</URL>\n
116
+ Laptop Buying...</Name>\n <URL>http://reviews.ebay.com/Simple-Laptop-Buying-Numbers-Aren-apos-t-Everything?ugid=10000000000790441</URL>\n
117
117
  \ <CategoryID>177</CategoryID>\n <Title>Simple Laptop Buying: Numbers
118
118
  Aren&apos;t Everything</Title>\n <Text>I started out looking for a laptop
119
119
  for school: I gave myself a budget and said to myself, &quot;Buy the best laptop
@@ -142,7 +142,7 @@
142
142
  gives me more options (but see below in the &quot;advanced stuff&quot;).&lt;br&gt;&lt;br&gt;-
143
143
  Centrino: This is a common label emphasize...</Text>\n <CreationTime>2006-03-12T03:06:34.000Z</CreationTime>\n
144
144
  \ <UserID>oprya001</UserID>\n </BuyingGuide>\n <BuyingGuide>\n <Name>Best
145
- Laptops 2006 - ...</Name>\n <URL>http://reviews.ebay.com/Best-Laptops-2006-Buying-Guide_W0QQugidZ10000000001420898</URL>\n
145
+ Laptops 2006 - ...</Name>\n <URL>http://reviews.ebay.com/Best-Laptops-2006-Buying-Guide?ugid=10000000001420898</URL>\n
146
146
  \ <CategoryID>177</CategoryID>\n <Title>Best Laptops 2006 - Buying Guide</Title>\n
147
147
  \ <Text>&lt;h2 style=&quot;margin-left: 40px;&quot;&gt;Best Laptops of 2006&lt;br&gt;&lt;/h2&gt;Of
148
148
  course, everyone is entitled to bias when it comes to picking their laptop.
@@ -169,6 +169,6 @@
169
169
  are many brands to begin with, most of them offer similar specs.&lt;br&gt;&lt;br&gt;Most
170
170
  popular laptop brands are (in no particular order): Dell, Apple, Lenovo (IBM
171
171
  Thinkpad), HP, Fujitsu, Sony, Gateway, Alienware, Acer, and ...</Text>\n <CreationTime>2006-07-20T20:33:38.000Z</CreationTime>\n
172
- \ <UserID>aquacs</UserID>\n </BuyingGuide>\n <BuyingGuideHub>http://search.reviews.ebay.com/_PC-Laptops-Netbooks_W0QQucatZ177QQuqtZg</BuyingGuideHub>\n
172
+ \ <UserID>aquacs</UserID>\n </BuyingGuide>\n <BuyingGuideHub>http://search.reviews.ebay.com/?ucat=177&amp;uqt=g</BuyingGuideHub>\n
173
173
  \ </BuyingGuideDetails>\n </FindReviewsAndGuidesResponse>\n "
174
174
  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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=GetItemStatus&ItemID=110089122715&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=GetItemStatus&ItemID=110089122715&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,29 +17,29 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:24 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14011937_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdGZpdWY=
29
29
  x-ebay-api-server-name:
30
- - ___dW0ucnA3MyhgNWU2MDRmKjc3LTQ3KTc3KDUyMTw/Mz02
30
+ - ___dWsucnA3MyhgNDdhZDI1Kjc3LTw2KTIzPik1PDw/Mz02
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:6474491A39FA1E55992798996069531006081665340
32
+ - urn:uuid:22667A74B6C5FB748436593776008238219-578238108
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:12 GMT
34
+ - Sat, 12 Nov 2011 07:58:24 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <GetItemStatusResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.274Z</Timestamp>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:24.871Z</Timestamp>\n
39
39
  \ <Ack>Failure</Ack>\n <Errors>\n <ShortMessage>Invalid item ID.</ShortMessage>\n
40
40
  \ <LongMessage>Invalid or non-existent item ID.</LongMessage>\n <ErrorCode>10.12</ErrorCode>\n
41
41
  \ <SeverityCode>Error</SeverityCode>\n <ErrorParameters ParamID=\"0\">\n
42
42
  \ <Value>110089122715</Value>\n </ErrorParameters>\n <ErrorClassification>RequestError</ErrorClassification>\n
43
- \ </Errors>\n <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
43
+ \ </Errors>\n <Build>E745_CORE_BUNDLED_14011937_R1</Build>\n <Version>745</Version>\n
44
44
  \ </GetItemStatusResponse>\n "
45
45
  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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=GetMultipleItems&ItemID=190000456297,280000052600,9600579283&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=GetMultipleItems&ItemID=190000456297,280000052600,9600579283&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,30 +17,30 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:25 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14011937_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdGZpdWY=
29
29
  x-ebay-api-server-name:
30
- - ___dWsucnA3MygxPjtjMWVgKjc3LTw2KTIzPik7MTw/Mz02
30
+ - ___dm8ucm83Nyg2MWRiNzM7Kjc3LTQyKTA1KD4xPz43OzU=
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:0818EFD69DD414CBF6269545852485728101187420567
32
+ - urn:uuid:22667A74B6C5FB748436593776381129442985779073
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:11 GMT
34
+ - Sat, 12 Nov 2011 07:58:25 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <GetMultipleItemsResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.436Z</Timestamp>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:25.028Z</Timestamp>\n
39
39
  \ <Ack>Failure</Ack>\n <Errors>\n <ShortMessage>Invalid item ID.</ShortMessage>\n
40
40
  \ <LongMessage>Invalid or non-existent item ID.</LongMessage>\n <ErrorCode>10.12</ErrorCode>\n
41
41
  \ <SeverityCode>Error</SeverityCode>\n <ErrorParameters ParamID=\"0\">\n
42
42
  \ <Value>9600579283,190000456297,280000052600</Value>\n </ErrorParameters>\n
43
43
  \ <ErrorClassification>RequestError</ErrorClassification>\n </Errors>\n
44
- \ <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
44
+ \ <Build>E745_CORE_BUNDLED_14011937_R1</Build>\n <Version>745</Version>\n
45
45
  \ </GetMultipleItemsResponse>\n "
46
46
  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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=GetShippingCosts&DestinationCountryCode=US&DestinationPostalCode=98122&ItemID=110089122715&QuantitySold=1&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=GetShippingCosts&DestinationCountryCode=US&DestinationPostalCode=98122&ItemID=110089122715&QuantitySold=1&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,29 +17,29 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:11 GMT
20
+ - Sat, 12 Nov 2011 07:58:24 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14011937_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdGZpdWY=
29
29
  x-ebay-api-server-name:
30
- - ___dm8ucm83Nyg2MWRiNzI2Kjc3LTQyKTA1KDYwMzw/Mz02
30
+ - ___dm8ucm83Nyg2MWRiNzM7Kjc3LTQyKTA1KD4xPz43OzU=
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:5CD0BB9874BFF7D9EB27285028133348264-1387613499
32
+ - urn:uuid:62CB515CDAAA1C5553376291517569272681626728057
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:11 GMT
34
+ - Sat, 12 Nov 2011 07:58:24 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <GetShippingCostsResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:11.903Z</Timestamp>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:24.840Z</Timestamp>\n
39
39
  \ <Ack>Failure</Ack>\n <Errors>\n <ShortMessage>Invalid item ID.</ShortMessage>\n
40
40
  \ <LongMessage>Invalid or non-existent item ID.</LongMessage>\n <ErrorCode>10.12</ErrorCode>\n
41
41
  \ <SeverityCode>Error</SeverityCode>\n <ErrorParameters ParamID=\"0\">\n
42
42
  \ <Value>110089122715</Value>\n </ErrorParameters>\n <ErrorClassification>RequestError</ErrorClassification>\n
43
- \ </Errors>\n <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
43
+ \ </Errors>\n <Build>E745_CORE_BUNDLED_14011937_R1</Build>\n <Version>745</Version>\n
44
44
  \ </GetShippingCostsResponse>\n "
45
45
  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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=GetSingleItem&ItemID=110089122715&RESPONSEENCODING=XML&SITEID=0&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=GetSingleItem&ItemID=110089122715&RESPONSEENCODING=XML&SITEID=0&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,28 +17,28 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:24 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14011937_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdGZpdWY=
29
29
  x-ebay-api-server-name:
30
- - ___dm8ucm83Nyg2MWRiNjE6Kjc3LTQyKTA1KDY3NTw/Mz02
30
+ - ___dWsucnAqZTA/YjY9NSgyNSg+Mys3NDorNDY7Pz43OzU=
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:0818EFD69DD414CBF626954585064478704-181179025
32
+ - urn:uuid:22667A74B6C5FB748436593775820028116-770311095
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:11 GMT
34
+ - Sat, 12 Nov 2011 07:58:24 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <GetSingleItemResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.072Z</Timestamp>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:24.129Z</Timestamp>\n
39
39
  \ <Ack>Failure</Ack>\n <Errors>\n <ShortMessage>Invalid item ID.</ShortMessage>\n
40
40
  \ <LongMessage>Invalid or non-existent item ID.</LongMessage>\n <ErrorCode>10.12</ErrorCode>\n
41
41
  \ <SeverityCode>Error</SeverityCode>\n <ErrorClassification>RequestError</ErrorClassification>\n
42
- \ </Errors>\n <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
42
+ \ </Errors>\n <Build>E745_CORE_BUNDLED_14011937_R1</Build>\n <Version>745</Version>\n
43
43
  \ </GetSingleItemResponse>\n "
44
44
  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://open.api.ebay.com:80/shopping?APPID=YOUR-APP-ID&CALLNAME=GetUserProfile&RESPONSEENCODING=XML&SITEID=0&UserID=TESTUSER_magicalbookseller&VERSION=717
5
+ uri: http://open.api.ebay.com:80/shopping?APPID=Bookswap-5e09-4740-8ee6-a6b26090fd69&CALLNAME=GetUserProfile&RESPONSEENCODING=XML&SITEID=0&UserID=TESTUSER_magicalbookseller&VERSION=745
6
6
  body: !!null
7
7
  headers: !!null
8
8
  response: !ruby/struct:VCR::Response
@@ -17,31 +17,31 @@
17
17
  expires:
18
18
  - Sat, 25 Dec 1999 00:00:00 GMT
19
19
  last-modified:
20
- - Sat, 23 Jul 2011 18:25:12 GMT
20
+ - Sat, 12 Nov 2011 07:58:25 GMT
21
21
  pragma:
22
22
  - no-cache
23
23
  server:
24
24
  - Apache-Coyote/1.1
25
25
  x-ebay-api-build-tag:
26
- - E731_CORE_BUNDLED_13527319_R1
26
+ - E745_CORE_BUNDLED_14011937_R1
27
27
  x-ebay-api-pool-name:
28
28
  - ___cDRidW9rdGZpdWY=
29
29
  x-ebay-api-server-name:
30
- - ___dn8ucnJibnU2NzQqNzctNyg2MzcoPzQ/Pjc7NQ==
30
+ - ___dWsucnA3Myg+Pjs8MWVnKjc3LTw2KTIzMCk1Mjw/Mz02
31
31
  x-ebay-esb-guid:
32
- - urn:uuid:0818EFD69DD414CBF626954585369502873-816390653
32
+ - urn:uuid:62CB515CDAAA1C5553376291521315074951358613858
33
33
  date:
34
- - Sat, 23 Jul 2011 18:25:11 GMT
34
+ - Sat, 12 Nov 2011 07:58:24 GMT
35
35
  transfer-encoding:
36
36
  - chunked
37
37
  body: ! "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n <GetUserProfileResponse
38
- xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-07-23T18:25:12.514Z</Timestamp>\n
38
+ xmlns=\"urn:ebay:apis:eBLBaseComponents\">\n <Timestamp>2011-11-12T07:58:25.418Z</Timestamp>\n
39
39
  \ <Ack>Failure</Ack>\n <Errors>\n <ShortMessage>Input data is invalid.</ShortMessage>\n
40
40
  \ <LongMessage>Input data for tag UserID has invalid value(s) TESTUSER_magicalbookseller</LongMessage>\n
41
41
  \ <ErrorCode>10.47</ErrorCode>\n <SeverityCode>Error</SeverityCode>\n <ErrorParameters
42
42
  ParamID=\"0\">\n <Value>UserID</Value>\n </ErrorParameters>\n <ErrorParameters
43
43
  ParamID=\"1\">\n <Value>TESTUSER_magicalbookseller</Value>\n </ErrorParameters>\n
44
44
  \ <ErrorClassification>RequestError</ErrorClassification>\n </Errors>\n
45
- \ <Build>E731_CORE_BUNDLED_13527319_R1</Build>\n <Version>731</Version>\n
45
+ \ <Build>E745_CORE_BUNDLED_14011937_R1</Build>\n <Version>745</Version>\n
46
46
  \ </GetUserProfileResponse>\n "
47
47
  http_version: '1.1'
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,8 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'rspec'
4
4
 
5
- require File.expand_path('../../lib/agent_cooper', __FILE__)
5
+ require File.expand_path('../../lib/agent_cooper', __FILE__)
6
+ require File.expand_path('../support/shared/request.rb', __FILE__)
6
7
 
7
8
  RSpec.configure do |c|
8
9
  c.treat_symbols_as_metadata_keys_with_true_values = true
@@ -0,0 +1,67 @@
1
+ shared_examples_for "Request" do
2
+
3
+ before do
4
+ AgentCooper::Config.stub(:app_id).and_return(app_id)
5
+ end
6
+
7
+ let(:app_id) { "12345ABCDE" }
8
+ let(:host) { described_class::HOST }
9
+ let(:path) { described_class::PATH }
10
+
11
+ let(:encoding) { described_class::ENCODING }
12
+ let(:version) { described_class::VERSION }
13
+
14
+ its(:app_id) { should eql(app_id) }
15
+ its(:host) { should eql(host) }
16
+ its(:path) { should eql(path) }
17
+
18
+ its(:query_parameters) { should eql({}) }
19
+ its(:request_adapter) { should be_a(HTTPClient) }
20
+
21
+ describe "#reset!" do
22
+ it "sets the request parameters to a blank hash" do
23
+ subject.should_receive(:query_parameters=).with({})
24
+ subject.reset!
25
+ end
26
+ end
27
+
28
+ describe "<<" do
29
+ let(:parameters) do
30
+ { "SECURITY-APPNAME" => app_id }
31
+ end
32
+
33
+ it { (subject << parameters).should eql(parameters) }
34
+
35
+ context "parameters is not a Hash" do
36
+ let(:parameters) { "" }
37
+
38
+ specify do
39
+ expect { subject << parameters }.to raise_error
40
+ end
41
+ end
42
+ end
43
+
44
+ describe "#get" do
45
+ let(:request_adapter) { mock(HTTPClient) }
46
+ let(:url) { "http://dummy.com/1234" }
47
+
48
+ let(:response) { mock(:response) }
49
+
50
+ before do
51
+ subject.stub(:request_adapter).and_return(request_adapter)
52
+ subject.stub(:url).and_return(url)
53
+
54
+ request_adapter.stub(:get).with(url).and_return(response)
55
+ end
56
+
57
+ it "gets a request" do
58
+ request_adapter.should_receive(:get).with(url)
59
+ subject.get
60
+ end
61
+
62
+ it "initializes a new Response" do
63
+ AgentCooper::Response.should_receive(:new).with(:response => response)
64
+ subject.get
65
+ end
66
+ end
67
+ end