peddler 0.6.5 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +62 -81
  4. data/lib/mws/cart_information.rb +13 -0
  5. data/lib/mws/customer_information.rb +16 -0
  6. data/lib/mws/feeds.rb +110 -1
  7. data/lib/mws/fulfillment_inbound_shipment.rb +13 -1
  8. data/lib/mws/fulfillment_inventory.rb +15 -1
  9. data/lib/mws/fulfillment_outbound_shipment.rb +17 -1
  10. data/lib/mws/off_amazon_payments.rb +15 -1
  11. data/lib/mws/orders.rb +100 -1
  12. data/lib/mws/products.rb +238 -1
  13. data/lib/mws/recommendations.rb +13 -1
  14. data/lib/mws/reports.rb +221 -1
  15. data/lib/mws/sellers.rb +40 -1
  16. data/lib/mws/subscriptions.rb +175 -1
  17. data/lib/peddler/client.rb +77 -37
  18. data/lib/peddler/csv_parser.rb +42 -0
  19. data/lib/peddler/operation.rb +44 -0
  20. data/lib/peddler/parser.rb +21 -0
  21. data/lib/peddler/structured_list.rb +22 -0
  22. data/lib/peddler/version.rb +1 -1
  23. data/lib/peddler/xml_parser.rb +25 -0
  24. data/lib/peddler.rb +2 -0
  25. data/test/helper.rb +1 -1
  26. data/test/integration/test_feeds.rb +18 -0
  27. data/test/integration/test_orders.rb +22 -0
  28. data/test/integration/test_products.rb +53 -0
  29. data/test/integration/test_reports.rb +47 -0
  30. data/test/integration/test_sellers.rb +18 -0
  31. data/test/integration/test_subscriptions.rb +26 -0
  32. data/test/integration_helper.rb +41 -8
  33. data/test/mws.yml +32 -0
  34. data/test/mws.yml.example +4 -0
  35. data/test/unit/peddler/test_client.rb +97 -0
  36. data/test/unit/peddler/test_csv_parser.rb +24 -0
  37. data/test/unit/peddler/test_operation.rb +34 -0
  38. data/test/{peddler/request → unit/peddler}/test_structured_list.rb +5 -5
  39. data/test/unit/peddler/test_xml_parser.rb +19 -0
  40. data/test/{test_peddler.rb → unit/test_peddler.rb} +2 -2
  41. data/test/vcr_cassettes/Feeds.yml +695 -0
  42. data/test/vcr_cassettes/Orders.yml +29855 -0
  43. data/test/vcr_cassettes/Products.yml +8597 -0
  44. data/test/vcr_cassettes/Reports.yml +1881 -0
  45. data/test/vcr_cassettes/Sellers.yml +697 -0
  46. data/test/vcr_cassettes/Subscriptions.yml +1369 -0
  47. metadata +91 -297
  48. data/lib/mws/feeds/client.rb +0 -116
  49. data/lib/mws/feeds/parsers/feed.rb +0 -14
  50. data/lib/mws/feeds/parsers/feed_submission_count.rb +0 -10
  51. data/lib/mws/feeds/parsers/feed_submission_info.rb +0 -25
  52. data/lib/mws/feeds/parsers/feed_submission_list.rb +0 -23
  53. data/lib/mws/feeds/parsers/feed_submission_result.rb +0 -10
  54. data/lib/mws/feeds/parsers/feed_submissions.rb +0 -18
  55. data/lib/mws/feeds/requests/feed.rb +0 -38
  56. data/lib/mws/feeds/requests/feed_submission_count.rb +0 -20
  57. data/lib/mws/feeds/requests/feed_submission_list.rb +0 -30
  58. data/lib/mws/feeds/requests/feed_submission_result.rb +0 -18
  59. data/lib/mws/feeds/requests/feed_submissions.rb +0 -20
  60. data/lib/mws/fulfillment_inbound_shipment/client.rb +0 -7
  61. data/lib/mws/fulfillment_inventory/client.rb +0 -7
  62. data/lib/mws/fulfillment_outbound_shipment/client.rb +0 -7
  63. data/lib/mws/off_amazon_payments/client.rb +0 -7
  64. data/lib/mws/orders/client.rb +0 -98
  65. data/lib/mws/orders/parsers/invoice_data.rb +0 -25
  66. data/lib/mws/orders/parsers/order.rb +0 -113
  67. data/lib/mws/orders/parsers/order_item.rb +0 -110
  68. data/lib/mws/orders/parsers/order_items.rb +0 -23
  69. data/lib/mws/orders/parsers/orders.rb +0 -23
  70. data/lib/mws/orders/parsers/payment_execution_detail.rb +0 -20
  71. data/lib/mws/orders/parsers/payment_execution_detail_item.rb +0 -17
  72. data/lib/mws/orders/parsers/service_status.rb +0 -36
  73. data/lib/mws/orders/parsers/service_status_message.rb +0 -17
  74. data/lib/mws/orders/parsers/shipping_address.rb +0 -37
  75. data/lib/mws/orders/requests/order_items.rb +0 -28
  76. data/lib/mws/orders/requests/orders.rb +0 -41
  77. data/lib/mws/orders/requests/service_status.rb +0 -15
  78. data/lib/mws/products/client.rb +0 -7
  79. data/lib/mws/recommendations/client.rb +0 -7
  80. data/lib/mws/reports/client.rb +0 -249
  81. data/lib/mws/reports/parsers/report.rb +0 -10
  82. data/lib/mws/reports/parsers/report_acknowledgements.rb +0 -20
  83. data/lib/mws/reports/parsers/report_count.rb +0 -10
  84. data/lib/mws/reports/parsers/report_info.rb +0 -29
  85. data/lib/mws/reports/parsers/report_list.rb +0 -23
  86. data/lib/mws/reports/parsers/report_request.rb +0 -14
  87. data/lib/mws/reports/parsers/report_request_count.rb +0 -10
  88. data/lib/mws/reports/parsers/report_request_info.rb +0 -49
  89. data/lib/mws/reports/parsers/report_request_list.rb +0 -23
  90. data/lib/mws/reports/parsers/report_requests.rb +0 -18
  91. data/lib/mws/reports/parsers/report_schedule.rb +0 -21
  92. data/lib/mws/reports/parsers/report_schedule_count.rb +0 -10
  93. data/lib/mws/reports/parsers/report_schedule_list.rb +0 -23
  94. data/lib/mws/reports/parsers/report_scheduler.rb +0 -19
  95. data/lib/mws/reports/requests/report.rb +0 -18
  96. data/lib/mws/reports/requests/report_acknowledgements.rb +0 -27
  97. data/lib/mws/reports/requests/report_count.rb +0 -20
  98. data/lib/mws/reports/requests/report_list.rb +0 -30
  99. data/lib/mws/reports/requests/report_request.rb +0 -21
  100. data/lib/mws/reports/requests/report_request_count.rb +0 -20
  101. data/lib/mws/reports/requests/report_request_list.rb +0 -30
  102. data/lib/mws/reports/requests/report_requests.rb +0 -20
  103. data/lib/mws/reports/requests/report_schedule_count.rb +0 -19
  104. data/lib/mws/reports/requests/report_schedule_list.rb +0 -23
  105. data/lib/mws/reports/requests/report_scheduler.rb +0 -29
  106. data/lib/mws/sellers/client.rb +0 -53
  107. data/lib/mws/sellers/parsers/marketplace.rb +0 -33
  108. data/lib/mws/sellers/parsers/marketplace_participations.rb +0 -32
  109. data/lib/mws/sellers/parsers/participation.rb +0 -21
  110. data/lib/mws/sellers/parsers/service_status.rb +0 -36
  111. data/lib/mws/sellers/parsers/service_status_message.rb +0 -17
  112. data/lib/mws/sellers/requests/marketplace_participations.rb +0 -27
  113. data/lib/mws/sellers/requests/service_status.rb +0 -15
  114. data/lib/mws/subscriptions/client.rb +0 -7
  115. data/lib/peddler/parsers/base.rb +0 -15
  116. data/lib/peddler/parsers/collection.rb +0 -23
  117. data/lib/peddler/parsers/counter.rb +0 -13
  118. data/lib/peddler/parsers/model.rb +0 -42
  119. data/lib/peddler/parsers/text.rb +0 -8
  120. data/lib/peddler/parsers/tokenable.rb +0 -13
  121. data/lib/peddler/parsers/xml.rb +0 -30
  122. data/lib/peddler/request/parameters.rb +0 -57
  123. data/lib/peddler/request/structured_list.rb +0 -48
  124. data/lib/peddler/request.rb +0 -52
  125. data/lib/peddler/response/base.rb +0 -0
  126. data/lib/peddler/response/payload/base.rb +0 -0
  127. data/lib/peddler/response/payload/csv.rb +0 -0
  128. data/lib/peddler/response/payload/xml.rb +0 -0
  129. data/lib/peddler/response.rb +0 -27
  130. data/test/fixtures/feeds/feed_submission.xml +0 -14
  131. data/test/fixtures/feeds/feed_submission_count.xml +0 -9
  132. data/test/fixtures/feeds/feed_submission_list.xml +0 -17
  133. data/test/fixtures/feeds/feed_submissions.xml +0 -15
  134. data/test/fixtures/mws.yml +0 -12
  135. data/test/fixtures/mws.yml.example +0 -4
  136. data/test/fixtures/orders/order_items.xml +0 -83
  137. data/test/fixtures/orders/orders.xml +0 -109
  138. data/test/fixtures/orders/service_status.xml +0 -19
  139. data/test/fixtures/reports/report.xml +0 -8
  140. data/test/fixtures/reports/report_acknowledgements.xml +0 -18
  141. data/test/fixtures/reports/report_count.xml +0 -9
  142. data/test/fixtures/reports/report_list.xml +0 -17
  143. data/test/fixtures/reports/report_request_count.xml +0 -9
  144. data/test/fixtures/reports/report_request_list.xml +0 -24
  145. data/test/fixtures/reports/report_requests.xml +0 -19
  146. data/test/fixtures/reports/report_schedule_count.xml +0 -10
  147. data/test/fixtures/reports/report_schedule_list.xml +0 -16
  148. data/test/fixtures/reports/report_scheduler.xml +0 -15
  149. data/test/fixtures/sellers/market_participations.xml +0 -27
  150. data/test/fixtures/sellers/service_status.xml +0 -9
  151. data/test/integration/feeds/test_feed_submission_count.rb +0 -13
  152. data/test/integration/feeds/test_feed_submission_list.rb +0 -17
  153. data/test/integration/feeds/test_feed_submission_result.rb +0 -15
  154. data/test/integration/orders/test_order_items.rb +0 -19
  155. data/test/integration/orders/test_orders.rb +0 -23
  156. data/test/integration/orders/test_service_status.rb +0 -12
  157. data/test/integration/reports/test_report.rb +0 -15
  158. data/test/integration/reports/test_report_count.rb +0 -13
  159. data/test/integration/reports/test_report_list.rb +0 -17
  160. data/test/integration/reports/test_report_request_count.rb +0 -13
  161. data/test/integration/reports/test_report_request_list.rb +0 -17
  162. data/test/integration/reports/test_report_schedule_count.rb +0 -13
  163. data/test/integration/reports/test_report_schedule_list.rb +0 -13
  164. data/test/integration/reports/test_report_scheduler.rb +0 -16
  165. data/test/integration/sellers/test_marketplace_participations.rb +0 -13
  166. data/test/integration/sellers/test_service_status.rb +0 -12
  167. data/test/mws/feeds/parsers/test_feed.rb +0 -13
  168. data/test/mws/feeds/parsers/test_feed_submission_count.rb +0 -13
  169. data/test/mws/feeds/parsers/test_feed_submission_info.rb +0 -25
  170. data/test/mws/feeds/parsers/test_feed_submission_list.rb +0 -18
  171. data/test/mws/feeds/parsers/test_feed_submission_result.rb +0 -13
  172. data/test/mws/feeds/parsers/test_feed_submissions.rb +0 -17
  173. data/test/mws/feeds/requests/test_feed.rb +0 -63
  174. data/test/mws/feeds/requests/test_feed_submission_count.rb +0 -23
  175. data/test/mws/feeds/requests/test_feed_submission_list.rb +0 -37
  176. data/test/mws/feeds/requests/test_feed_submissions.rb +0 -29
  177. data/test/mws/orders/parsers/test_order.rb +0 -86
  178. data/test/mws/orders/parsers/test_order_item.rb +0 -69
  179. data/test/mws/orders/parsers/test_order_items.rb +0 -18
  180. data/test/mws/orders/parsers/test_orders.rb +0 -18
  181. data/test/mws/orders/parsers/test_payment_execution_detail.rb +0 -14
  182. data/test/mws/orders/parsers/test_payment_execution_detail_item.rb +0 -17
  183. data/test/mws/orders/parsers/test_service_status.rb +0 -39
  184. data/test/mws/orders/parsers/test_service_status_message.rb +0 -17
  185. data/test/mws/orders/parsers/test_shipping_address.rb +0 -36
  186. data/test/mws/orders/requests/test_order_items.rb +0 -36
  187. data/test/mws/orders/requests/test_orders.rb +0 -46
  188. data/test/mws/orders/requests/test_service_status.rb +0 -25
  189. data/test/mws/reports/parsers/test_report_acknowledgments.rb +0 -14
  190. data/test/mws/reports/parsers/test_report_count.rb +0 -13
  191. data/test/mws/reports/parsers/test_report_info.rb +0 -29
  192. data/test/mws/reports/parsers/test_report_list.rb +0 -18
  193. data/test/mws/reports/parsers/test_report_request.rb +0 -13
  194. data/test/mws/reports/parsers/test_report_request_count.rb +0 -13
  195. data/test/mws/reports/parsers/test_report_request_info.rb +0 -49
  196. data/test/mws/reports/parsers/test_report_request_list.rb +0 -18
  197. data/test/mws/reports/parsers/test_report_requests.rb +0 -17
  198. data/test/mws/reports/parsers/test_report_schedule_count.rb +0 -13
  199. data/test/mws/reports/parsers/test_report_schedule_list.rb +0 -18
  200. data/test/mws/reports/parsers/test_report_scheduler.rb +0 -17
  201. data/test/mws/reports/requests/test_acknowledgements.rb +0 -36
  202. data/test/mws/reports/requests/test_report_count.rb +0 -23
  203. data/test/mws/reports/requests/test_report_list.rb +0 -39
  204. data/test/mws/reports/requests/test_report_request.rb +0 -31
  205. data/test/mws/reports/requests/test_report_request_count.rb +0 -23
  206. data/test/mws/reports/requests/test_report_request_list.rb +0 -44
  207. data/test/mws/reports/requests/test_report_requests.rb +0 -29
  208. data/test/mws/reports/requests/test_report_schedule_count.rb +0 -22
  209. data/test/mws/reports/requests/test_report_schedule_list.rb +0 -36
  210. data/test/mws/reports/requests/test_report_scheduler.rb +0 -33
  211. data/test/mws/sellers/parsers/test_market_participations.rb +0 -19
  212. data/test/mws/sellers/parsers/test_service_status.rb +0 -35
  213. data/test/mws/sellers/requests/test_marketplace_participation_list.rb +0 -39
  214. data/test/mws/sellers/requests/test_service_status.rb +0 -25
  215. data/test/parser_helper.rb +0 -11
  216. data/test/peddler/parsers/test_collection.rb +0 -8
  217. data/test/peddler/parsers/test_model.rb +0 -70
  218. data/test/peddler/request/test_parameters.rb +0 -35
  219. data/test/peddler/test_client.rb +0 -42
  220. data/test/request_helper.rb +0 -20
@@ -1,15 +0,0 @@
1
- <?xml version="1.0"?>
2
- <ManageReportScheduleResponse xmlns="http://mws.amazonservices.com/
3
- doc/2009-01-01/">
4
- <ManageReportScheduleResult>
5
- <Count>1</Count>
6
- <ReportSchedule>
7
- <ReportType>_GET_ORDERS_DATA_</ReportType>
8
- <Schedule>_30_DAYS_</Schedule>
9
- <ScheduledDate>2009-02-20T02:10:42+00:00</ScheduledDate>
10
- </ReportSchedule>
11
- </ManageReportScheduleResult>
12
- <ResponseMetadata>
13
- <RequestId>7ee1bc50-5a13-4db1-afd7-1386e481984e</RequestId>
14
- </ResponseMetadata>
15
- </ManageReportScheduleResponse>
@@ -1,27 +0,0 @@
1
- <?xml version="1.0"?>
2
- <ListMarketplaceParticipationsResponse
3
- xmlns="https://mws.amazonservices.com/Sellers/2011-07-01">
4
- <ListMarketplaceParticipationsResult>
5
- <NextToken>MRgZW55IGNhcm5hbCBwbGVhc3VyZS6=</NextToken>
6
- <ListParticipations>
7
- <Participation>
8
- <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
9
- <SellerId>A135KKEKJAIBJ56</SellerId>
10
- <HasSellerSuspendedListings>No</HasSellerSuspendedListings>
11
- </Participation>
12
- </ListParticipations>
13
- <ListMarketplaces>
14
- <Marketplace>
15
- <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
16
- <Name>Amazon.com</Name>
17
- <DefaultCountryCode>US</DefaultCountryCode>
18
- <DefaultCurrencyCode>USD</DefaultCurrencyCode>
19
- <DefaultLanguageCode>en_US</DefaultLanguageCode>
20
- <DomainName>www.amazon.com</DomainName>
21
- </Marketplace>
22
- </ListMarketplaces>
23
- </ListMarketplaceParticipationsResult>
24
- <ResponseMetadata>
25
- <RequestId>efeab958-74e2-45d4-9018-2323084413b5</RequestId>
26
- </ResponseMetadata>
27
- </ListMarketplaceParticipationsResponse>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0"?>
2
- <GetServiceStatusResponse
3
- xmlns="https://mws.amazonservices.com/FraudManagement/2010-09-28
4
- ">
5
- <GetServiceStatusResult>
6
- <Status>GREEN</Status>
7
- <Timestamp>2010-09-24T21:38:09.676Z</Timestamp>
8
- </GetServiceStatusResult>
9
- </GetServiceStatusResponse>
@@ -1,13 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/feeds'
3
-
4
- class FeedSubmissionCountTest < IntegrationTest
5
- self.api = MWS::Feeds
6
-
7
- def test_gets_feed_submission_count
8
- @clients.each do |client|
9
- res = client.get_feed_submission_count
10
- assert_kind_of Integer, res.count
11
- end
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/feeds'
3
-
4
- class FeedSubmissionListTest < IntegrationTest
5
- self.api = MWS::Feeds
6
-
7
- def test_gets_feed_submission_list
8
- @clients.each do |client|
9
- feeds = client.get_feed_submission_list
10
- refute_empty feeds.to_a
11
- more_feeds = client.get_feed_submission_list_by_next_token
12
- refute_empty more_feeds.to_a
13
- some_more_feeds = client.get_feed_submission_list_by_next_token(more_feeds.next_token)
14
- refute_empty some_more_feeds.to_a
15
- end
16
- end
17
- end
@@ -1,15 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/feeds'
3
-
4
- class FeedSubmissionResultTest < IntegrationTest
5
- self.api = MWS::Feeds
6
-
7
- def test_gets_feed_submission_result
8
- @clients.each do |client|
9
- feeds = client.get_feed_submission_list(feed_processing_status_list: '_DONE_', max_count: 1)
10
- feed_submission_id = feeds.first.id
11
- result = client.get_feed_submission_result(feed_submission_id)
12
- refute_empty result.to_s
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/orders'
3
-
4
- class OrderItemsTest < IntegrationTest
5
- self.api = MWS::Orders
6
-
7
- def sample_amazon_order_id(client)
8
- order = client.list_orders(created_after: Date.today - 365).to_a.sample
9
- order.amazon_order_id
10
- end
11
-
12
- def test_list_order_items
13
- @clients.each do |client|
14
- amazon_order_id = sample_amazon_order_id(client)
15
- order_items = client.list_order_items(amazon_order_id)
16
- refute_empty order_items
17
- end
18
- end
19
- end
@@ -1,23 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/orders'
3
-
4
- class OrdersTest < IntegrationTest
5
- self.api = MWS::Orders
6
-
7
- def test_lists_and_gets_orders
8
- @clients.each do |client|
9
- amazon_order_ids = []
10
- orders = client.list_orders(created_after: Date.today - 365)
11
- amazon_order_ids << orders.to_a.sample.amazon_order_id
12
-
13
- orders = client.list_orders_by_next_token
14
- amazon_order_ids << orders.to_a.sample.amazon_order_id
15
-
16
- orders = client.list_orders_by_next_token(orders.next_token)
17
- amazon_order_ids << orders.to_a.sample.amazon_order_id
18
-
19
- orders = client.get_order(*amazon_order_ids)
20
- assert orders
21
- end
22
- end
23
- end
@@ -1,12 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/orders'
3
-
4
- class ServiceStatusTest < IntegrationTest
5
- self.api = MWS::Orders
6
-
7
- def test_gets_service_status
8
- @clients.each do |client|
9
- assert client.get_service_status
10
- end
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_gets_report_list
8
- @clients.each do |client|
9
- reports = client.get_report_list
10
- id = reports.to_a.sample.id
11
- report = client.get_report(id)
12
- refute_empty report.document
13
- end
14
- end
15
- end
@@ -1,13 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportCountTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_gets_report_count
8
- @clients.each do |client|
9
- res = client.get_report_count
10
- assert_kind_of Integer, res.count
11
- end
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportListTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_gets_report_list
8
- @clients.each do |client|
9
- reports = client.get_report_list
10
- refute_empty reports.to_a
11
- more_reports = client.get_report_list_by_next_token
12
- refute_empty more_reports.to_a
13
- some_more_reports = client.get_report_list_by_next_token(more_reports.next_token)
14
- refute_empty some_more_reports.to_a
15
- end
16
- end
17
- end
@@ -1,13 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportRequestCountTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_gets_report_request_count
8
- @clients.each do |client|
9
- res = client.get_report_request_count
10
- assert_kind_of Integer, res.count
11
- end
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportRequestListTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_gets_report_request_list
8
- @clients.each do |client|
9
- requests = client.get_report_request_list
10
- refute_empty requests.to_a
11
- more_requests = client.get_report_request_list_by_next_token
12
- refute_empty more_requests.to_a
13
- some_more_requests = client.get_report_request_list_by_next_token(more_requests.next_token)
14
- refute_empty some_more_requests.to_a
15
- end
16
- end
17
- end
@@ -1,13 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportScheduleCountTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_gets_report_schedule_count
8
- @clients.each do |client|
9
- res = client.get_report_schedule_count
10
- assert_kind_of Integer, res.count
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportScheduleListTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_lists_report_schedules
8
- @clients.each do |client|
9
- res = client.get_report_schedule_list
10
- #assert res.count > 0
11
- end
12
- end
13
- end
@@ -1,16 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/reports'
3
-
4
- class ReportSchedulerTest < IntegrationTest
5
- self.api = MWS::Reports
6
-
7
- def test_manages_report_schedule
8
- type = '_GET_FLAT_FILE_ORDERS_DATA_'
9
-
10
- @clients.each do |client|
11
- client.manage_report_schedule(type, '_1_DAY_')
12
- res = client.delete_report_schedule(type)
13
- assert res.count > 0
14
- end
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/sellers'
3
-
4
- class SellersTest < IntegrationTest
5
- self.api = MWS::Sellers
6
-
7
- def test_lists_marketplace_participations
8
- @clients.each do |client|
9
- mps = client.list_marketplace_participations
10
- assert_kind_of MWS::Sellers::Parsers::MarketplaceParticipations, mps
11
- end
12
- end
13
- end
@@ -1,12 +0,0 @@
1
- require 'integration_helper'
2
- require 'mws/sellers'
3
-
4
- class ServiceStatusTest < IntegrationTest
5
- self.api = MWS::Sellers
6
-
7
- def test_gets_service_status
8
- @clients.each do |client|
9
- assert client.get_service_status
10
- end
11
- end
12
- end
@@ -1,13 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/feeds/parsers/feed'
3
-
4
- class FeedParserTest < ParserTest
5
- def setup
6
- node = fixture('feeds/feed_submission').xpath('//xmlns:FeedSubmissionInfo').first
7
- @feed = MWS::Feeds::Parsers::Feed.new(node)
8
- end
9
-
10
- def test_submission_info
11
- assert_kind_of MWS::Feeds::Parsers::FeedSubmissionInfo, @feed.submission_info
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/feeds/parsers/feed_submission_count'
3
-
4
- class FeedSubmissionCountParserTest < ParserTest
5
- def setup
6
- node = fixture('feeds/feed_submission_count').xpath('//xmlns:GetFeedSubmissionCountResult')
7
- @feeds = MWS::Feeds::Parsers::FeedSubmissionCount.new(node)
8
- end
9
-
10
- def test_feed_submission_count
11
- assert_kind_of Integer, @feeds.count
12
- end
13
- end
@@ -1,25 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/feeds/parsers/feed_submission_info'
3
-
4
- class FeedSubmissionInfoParserTest < ParserTest
5
- def setup
6
- node = fixture('feeds/feed_submission').xpath('//xmlns:FeedSubmissionInfo').first
7
- @feed = MWS::Feeds::Parsers::FeedSubmissionInfo.new(node)
8
- end
9
-
10
- def test_id
11
- assert_kind_of String, @feed.id
12
- end
13
-
14
- def test_type
15
- assert_kind_of String, @feed.type
16
- end
17
-
18
- def test_submitted_at
19
- assert_kind_of Time, @feed.submitted_at
20
- end
21
-
22
- def test_processing_status
23
- assert_kind_of String, @feed.processing_status
24
- end
25
- end
@@ -1,18 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/feeds/parsers/feed_submission_list'
3
-
4
- class FeedSubmissionListParserTest < ParserTest
5
- def setup
6
- node = fixture('feeds/feed_submission_list').xpath('//xmlns:GetFeedSubmissionListResult')
7
- @feed_submission_list = MWS::Feeds::Parsers::FeedSubmissionList.new(node)
8
- end
9
-
10
- def test_has_feed_submission_list
11
- refute_empty @feed_submission_list.to_a
12
- @feed_submission_list.each { |feed| assert_kind_of MWS::Feeds::Parsers::FeedSubmissionInfo, feed }
13
- end
14
-
15
- def test_has_token
16
- assert @feed_submission_list.has_next_token?
17
- end
18
- end
@@ -1,13 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/feeds/parsers/feed_submission_result'
3
-
4
- class FeedSubmissionResultParserTest < ParserTest
5
- def setup
6
- @body = 'foo'
7
- @result = MWS::Feeds::Parsers::FeedSubmissionResult.new(@body)
8
- end
9
-
10
- def test_content
11
- assert_equal @body, @result.document
12
- end
13
- end
@@ -1,17 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/feeds/parsers/feed_submissions'
3
-
4
- class FeedSubmissionsParserTest < ParserTest
5
- def setup
6
- node = fixture('feeds/feed_submissions').xpath('//xmlns:CancelFeedSubmissionsResult')
7
- @cancelations = MWS::Feeds::Parsers::FeedSubmissions.new(node)
8
- end
9
-
10
- def test_cancelation_count
11
- assert_kind_of Integer, @cancelations.count
12
- end
13
-
14
- def test_canceled_feed_submissions
15
- refute_empty @cancelations.feed_submissions
16
- end
17
- end
@@ -1,63 +0,0 @@
1
- require 'request_helper'
2
- require 'mws/feeds/requests/feed'
3
-
4
- class FeedRequestTest < RequestTest
5
- def mock_response_body
6
- <<-EOF
7
- <Response xmlns="ns">
8
- <Result>
9
- <FeedSubmissionInfo>
10
- <FeedSubmissionId>123456</FeedSubmissionId>
11
- <FeedType>_POST_PRODUCT_DATA_</FeedType>
12
- <SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
13
- <FeedProcessingStatus>_CANCELLED_</FeedProcessingStatus>
14
- </FeedSubmissionInfo>
15
- </Result>
16
- </Response>
17
- EOF
18
- end
19
-
20
- def setup
21
- @feed = MWS::Feeds::Requests::Feed.new(mock_client)
22
- end
23
-
24
- def test_submits_flat_file
25
- @feed.client.expect(:default_country, 'US')
26
- res = @feed.submit('foo', '_POST_FLAT_FILE_DATA_')
27
- assert_kind_of MWS::Feeds::Parsers::Feed, res
28
- end
29
-
30
- def test_submits_xml
31
- @feed.client.expect(:default_country, 'US')
32
- xml = '<?xml version="1.0"?><Foo></Foo>'
33
- res = @feed.submit(xml, '_POST_XML_DATA_')
34
- assert_kind_of MWS::Feeds::Parsers::Feed, res
35
- end
36
-
37
- def test_headers_for_latin_flat_file
38
- @feed.client.expect(:default_country, 'US')
39
- @feed.body = 'foo'
40
- @feed.set_content_type
41
- assert_equal "text/tab-separated-values; charset=ISO-8859-1", @feed.headers.fetch('Content-Type')
42
- end
43
-
44
- def test_headers_for_chinese_flat_file
45
- @feed.client.expect(:default_country, 'CN')
46
- @feed.body = 'foo'
47
- @feed.set_content_type
48
- assert_equal 'text/tab-separated-values; charset=UTF-16', @feed.headers.fetch('Content-Type')
49
- end
50
-
51
- def test_headers_for_japanese_flat_file
52
- @feed.client.expect(:default_country, 'JP')
53
- @feed.body = 'foo'
54
- @feed.set_content_type
55
- assert_equal 'text/tab-separated-values; charset=Shift_JIS', @feed.headers.fetch('Content-Type')
56
- end
57
-
58
- def test_headers_for_xml
59
- @feed.body = '<?xml version="1.0"?><Foo></Foo>'
60
- @feed.set_content_type
61
- assert_equal 'text/xml; charset=ISO-8859-1', @feed.headers.fetch('Content-Type')
62
- end
63
- end
@@ -1,23 +0,0 @@
1
- require 'request_helper'
2
- require 'mws/feeds/requests/feed_submission_count'
3
-
4
- class FeedSubmissionCountRequestTest < RequestTest
5
- def mock_response_body
6
- <<-EOF
7
- <Response xmlns="ns">
8
- <Result>
9
- <Count>1</Count>
10
- </Result>
11
- </Response>
12
- EOF
13
- end
14
-
15
- def setup
16
- @feeds = MWS::Feeds::Requests::FeedSubmissionCount.new(mock_client)
17
- end
18
-
19
- def test_gets_feed_submission_count
20
- res = @feeds.get(submitted_from_date: 0)
21
- assert_equal 1, res.count
22
- end
23
- end
@@ -1,37 +0,0 @@
1
- require 'request_helper'
2
- require 'mws/feeds/requests/feed_submission_list'
3
-
4
- class FeedSubmissionListRequestTest < RequestTest
5
- def mock_response_body
6
- <<-EOF
7
- <Response xmlns="ns">
8
- <Result>
9
- <NextToken>123</NextToken>
10
- <FeedSubmissionInfo>
11
- <FeedSubmissionId>123456</FeedSubmissionId>
12
- <FeedType>_POST_PRODUCT_DATA_</FeedType>
13
- <SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
14
- <FeedProcessingStatus>_SUBMITTED_</FeedProcessingStatus>
15
- </FeedSubmissionInfo>
16
- </Result>
17
- </Response>
18
- EOF
19
- end
20
-
21
- def setup
22
- @feeds = MWS::Feeds::Requests::FeedSubmissionList.new(mock_client)
23
- end
24
-
25
- def test_gets_feed_submission_list
26
- res = @feeds.get(submitted_from_date: 0)
27
- assert_kind_of MWS::Feeds::Parsers::FeedSubmissionList, res
28
- end
29
-
30
- def test_gets_feed_submission_list_by_next_token
31
- mock_parsed_response = MiniTest::Mock.new
32
- mock_parsed_response.expect(:next_token, '123')
33
- @feeds.last_parsed_response = mock_parsed_response
34
- res = @feeds.get_by_next_token
35
- assert_kind_of MWS::Feeds::Parsers::FeedSubmissionList, res
36
- end
37
- end
@@ -1,29 +0,0 @@
1
- require 'request_helper'
2
- require 'mws/feeds/requests/feed_submissions'
3
-
4
- class FeedSubmissionsRequesttTest < RequestTest
5
- def mock_response_body
6
- <<-EOF
7
- <Response xmlns="ns">
8
- <Result>
9
- <Count>1</Count>
10
- <FeedSubmissionInfo>
11
- <FeedSubmissionId>123456</FeedSubmissionId>
12
- <FeedType>_POST_PRODUCT_DATA_</FeedType>
13
- <SubmittedDate>2009-02-20T02:10:35+00:00</SubmittedDate>
14
- <FeedProcessingStatus>_CANCELLED_</FeedProcessingStatus>
15
- </FeedSubmissionInfo>
16
- </Result>
17
- </Response>
18
- EOF
19
- end
20
-
21
- def setup
22
- @feeds = MWS::Feeds::Requests::FeedSubmissions.new(mock_client)
23
- end
24
-
25
- def test_cancels_feedback_submissions
26
- res = @feeds.cancel(submitted_from_date: 0)
27
- assert_kind_of MWS::Feeds::Parsers::FeedSubmissions, res
28
- end
29
- end
@@ -1,86 +0,0 @@
1
- require 'parser_helper'
2
- require 'mws/orders/parsers/order'
3
-
4
- class OrderParserTest < ParserTest
5
- def setup
6
- node = fixture('orders/orders').xpath('//xmlns:Order').first
7
- @order = MWS::Orders::Parsers::Order.new(node)
8
- end
9
-
10
- def test_amazon_order_id
11
- assert_kind_of String, @order.amazon_order_id
12
- end
13
-
14
- def test_purchase_time
15
- assert_kind_of Time, @order.purchased_at
16
- end
17
-
18
- def test_last_update_time
19
- assert_kind_of Time, @order.last_updated_at
20
- end
21
-
22
- def test_status
23
- assert_kind_of String, @order.status
24
- end
25
-
26
- def test_type
27
- assert_kind_of String, @order.type
28
- end
29
-
30
- def test_sales_channel
31
- assert_kind_of String, @order.sales_channel
32
- end
33
-
34
- def test_ship_service_level
35
- assert_kind_of String, @order.ship_service_level
36
- end
37
-
38
- def test_fulfillment_channel
39
- assert_kind_of String, @order.fulfillment_channel
40
- end
41
-
42
- def test_total
43
- assert_kind_of Money, @order.total
44
- end
45
-
46
- def test_shipping_address
47
- assert_kind_of MWS::Orders::Parsers::ShippingAddress, @order.shipping_address
48
- end
49
-
50
- def test_number_of_items_shipped
51
- assert_kind_of Integer, @order.number_of_items_shipped
52
- end
53
-
54
- def test_number_of_items_unshipped
55
- assert_kind_of Integer, @order.number_of_items_unshipped
56
- end
57
-
58
- def test_payment_execution_detail
59
- assert_kind_of MWS::Orders::Parsers::PaymentExecutionDetail, @order.payment_execution_detail
60
- end
61
-
62
- def test_payment_method
63
- assert_kind_of String, @order.payment_method
64
- end
65
-
66
- def test_marketplace_id
67
- assert_kind_of String, @order.marketplace_id
68
- end
69
-
70
- def test_buyer_name
71
- assert_kind_of String, @order.buyer_name
72
- end
73
-
74
- def test_buyer_email
75
- assert_kind_of String, @order.buyer_email
76
- end
77
-
78
- def test_shipment_service_level_category
79
- assert_kind_of String, @order.shipment_service_level_category
80
- end
81
-
82
- def test_no_shipping_adress
83
- @order.shipping_address.document.remove
84
- assert_nil @order.shipping_address
85
- end
86
- end