peddler 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -145
  3. data/lib/mws/feeds/client.rb +7 -1
  4. data/lib/mws/feeds/parsers/feed.rb +3 -3
  5. data/lib/mws/feeds/parsers/feed_submission_count.rb +2 -5
  6. data/lib/mws/feeds/parsers/{feed_submission.rb → feed_submission_info.rb} +1 -1
  7. data/lib/mws/feeds/parsers/feed_submission_list.rb +6 -3
  8. data/lib/mws/feeds/parsers/feed_submissions.rb +2 -2
  9. data/lib/mws/feeds/requests/feed_submission_list.rb +4 -2
  10. data/lib/mws/orders/client.rb +12 -2
  11. data/lib/mws/orders/parsers/order_items.rb +3 -0
  12. data/lib/mws/orders/parsers/orders.rb +6 -3
  13. data/lib/mws/orders/requests/order_items.rb +4 -2
  14. data/lib/mws/orders/requests/orders.rb +4 -2
  15. data/lib/mws/reports/client.rb +243 -0
  16. data/lib/mws/reports/parsers/report.rb +10 -0
  17. data/lib/mws/reports/parsers/report_acknowledgements.rb +20 -0
  18. data/lib/mws/reports/parsers/report_count.rb +10 -0
  19. data/lib/mws/reports/parsers/report_info.rb +29 -0
  20. data/lib/mws/reports/parsers/report_list.rb +23 -0
  21. data/lib/mws/reports/parsers/report_request_count.rb +10 -0
  22. data/lib/mws/reports/parsers/report_request_info.rb +49 -0
  23. data/lib/mws/reports/parsers/report_request_list.rb +23 -0
  24. data/lib/mws/reports/parsers/report_requests.rb +18 -0
  25. data/lib/mws/reports/parsers/report_schedule.rb +21 -0
  26. data/lib/mws/reports/parsers/report_schedule_count.rb +10 -0
  27. data/lib/mws/reports/parsers/report_schedule_list.rb +23 -0
  28. data/lib/mws/reports/parsers/report_scheduler.rb +19 -0
  29. data/lib/mws/reports/requests/report.rb +18 -0
  30. data/lib/mws/reports/requests/report_acknowledgements.rb +27 -0
  31. data/lib/mws/reports/requests/report_count.rb +20 -0
  32. data/lib/mws/reports/requests/report_list.rb +30 -0
  33. data/lib/mws/reports/requests/report_request_count.rb +20 -0
  34. data/lib/mws/reports/requests/report_request_info.rb +21 -0
  35. data/lib/mws/reports/requests/report_request_list.rb +30 -0
  36. data/lib/mws/reports/requests/report_requests.rb +20 -0
  37. data/lib/mws/reports/requests/report_schedule_count.rb +19 -0
  38. data/lib/mws/reports/requests/report_schedule_list.rb +23 -0
  39. data/lib/mws/reports/requests/report_scheduler.rb +29 -0
  40. data/lib/mws/sellers/client.rb +46 -0
  41. data/lib/mws/sellers/parsers/marketplace.rb +33 -0
  42. data/lib/mws/sellers/parsers/marketplace_participations.rb +32 -0
  43. data/lib/mws/sellers/parsers/participation.rb +21 -0
  44. data/lib/mws/sellers/parsers/service_status.rb +36 -0
  45. data/lib/mws/sellers/parsers/service_status_message.rb +17 -0
  46. data/lib/mws/sellers/requests/marketplace_participations.rb +27 -0
  47. data/lib/mws/sellers/requests/service_status.rb +15 -0
  48. data/lib/peddler/parsers/base.rb +2 -2
  49. data/lib/peddler/parsers/counter.rb +13 -0
  50. data/lib/peddler/parsers/model.rb +4 -5
  51. data/lib/peddler/parsers/text.rb +0 -5
  52. data/lib/peddler/parsers/tokenable.rb +13 -0
  53. data/lib/peddler/parsers/xml.rb +10 -5
  54. data/lib/peddler/request/parameters.rb +2 -1
  55. data/lib/peddler/request/structured_list.rb +5 -0
  56. data/lib/peddler/request.rb +13 -15
  57. data/lib/peddler/response/base.rb +0 -0
  58. data/lib/peddler/response/payload/base.rb +0 -0
  59. data/lib/peddler/response/payload/csv.rb +0 -0
  60. data/lib/peddler/response/payload/xml.rb +0 -0
  61. data/lib/peddler/{response_wrapper.rb → response.rb} +6 -11
  62. data/lib/peddler/version.rb +1 -1
  63. data/test/fixtures/mws.yml +4 -0
  64. data/test/fixtures/reports/report.xml +8 -0
  65. data/test/fixtures/reports/report_acknowledgements.xml +18 -0
  66. data/test/fixtures/reports/report_count.xml +9 -0
  67. data/test/fixtures/reports/report_list.xml +17 -0
  68. data/test/fixtures/reports/report_request_count.xml +9 -0
  69. data/test/fixtures/reports/report_request_list.xml +24 -0
  70. data/test/fixtures/reports/report_requests.xml +19 -0
  71. data/test/fixtures/reports/report_schedule_count.xml +10 -0
  72. data/test/fixtures/reports/report_schedule_list.xml +16 -0
  73. data/test/fixtures/reports/report_scheduler.xml +15 -0
  74. data/test/fixtures/sellers/market_participations.xml +27 -0
  75. data/test/fixtures/sellers/service_status.xml +9 -0
  76. data/test/integration/feeds/test_feed_submission_list.rb +2 -0
  77. data/test/integration/orders/test_orders.rb +3 -0
  78. data/test/integration/reports/test_report.rb +15 -0
  79. data/test/integration/reports/test_report_count.rb +13 -0
  80. data/test/integration/reports/test_report_list.rb +17 -0
  81. data/test/integration/reports/test_report_request_count.rb +13 -0
  82. data/test/integration/reports/test_report_request_list.rb +17 -0
  83. data/test/integration/reports/test_report_schedule_count.rb +13 -0
  84. data/test/integration/reports/test_report_schedule_list.rb +13 -0
  85. data/test/integration/reports/test_report_scheduler.rb +16 -0
  86. data/test/integration/sellers/test_marketplace_participations.rb +13 -0
  87. data/test/integration/sellers/test_service_status.rb +12 -0
  88. data/test/integration_helper.rb +3 -0
  89. data/test/mws/feeds/parsers/test_feed.rb +2 -2
  90. data/test/mws/feeds/parsers/{test_feed_submission.rb → test_feed_submission_info.rb} +3 -3
  91. data/test/mws/feeds/parsers/test_feed_submission_list.rb +5 -1
  92. data/test/mws/feeds/parsers/test_feed_submission_result.rb +1 -1
  93. data/test/mws/feeds/requests/test_feed_submission_list.rb +3 -6
  94. data/test/mws/orders/parsers/test_order_items.rb +4 -0
  95. data/test/mws/orders/parsers/test_orders.rb +4 -0
  96. data/test/mws/orders/parsers/test_service_status.rb +1 -1
  97. data/test/mws/orders/requests/test_order_items.rb +3 -6
  98. data/test/mws/orders/requests/test_orders.rb +3 -6
  99. data/test/mws/reports/parsers/test_report_acknowledgments.rb +14 -0
  100. data/test/mws/reports/parsers/test_report_count.rb +13 -0
  101. data/test/mws/reports/parsers/test_report_info.rb +29 -0
  102. data/test/mws/reports/parsers/test_report_list.rb +18 -0
  103. data/test/mws/reports/parsers/test_report_request_count.rb +13 -0
  104. data/test/mws/reports/parsers/test_report_request_info.rb +49 -0
  105. data/test/mws/reports/parsers/test_report_request_list.rb +18 -0
  106. data/test/mws/reports/parsers/test_report_requests.rb +17 -0
  107. data/test/mws/reports/parsers/test_report_schedule_count.rb +13 -0
  108. data/test/mws/reports/parsers/test_report_schedule_list.rb +18 -0
  109. data/test/mws/reports/parsers/test_report_scheduler.rb +17 -0
  110. data/test/mws/reports/requests/test_acknowledgements.rb +36 -0
  111. data/test/mws/reports/requests/test_report_count.rb +23 -0
  112. data/test/mws/reports/requests/test_report_info.rb +29 -0
  113. data/test/mws/reports/requests/test_report_list.rb +39 -0
  114. data/test/mws/reports/requests/test_report_request_count.rb +23 -0
  115. data/test/mws/reports/requests/test_report_request_list.rb +44 -0
  116. data/test/mws/reports/requests/test_report_requests.rb +29 -0
  117. data/test/mws/reports/requests/test_report_schedule_count.rb +22 -0
  118. data/test/mws/reports/requests/test_report_schedule_list.rb +36 -0
  119. data/test/mws/reports/requests/test_report_scheduler.rb +33 -0
  120. data/test/mws/sellers/parsers/test_market_participations.rb +19 -0
  121. data/test/mws/sellers/parsers/test_service_status.rb +35 -0
  122. data/test/mws/sellers/requests/test_marketplace_participation_list.rb +39 -0
  123. data/test/mws/sellers/requests/test_service_status.rb +25 -0
  124. data/test/peddler/parsers/test_model.rb +36 -0
  125. data/test/request_helper.rb +1 -1
  126. metadata +171 -42
  127. data/test/peddler/test_request.rb +0 -18
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0"?>
2
+ <GetReportListResponse xmlns="http://mws.amazonservices.com/doc/2009-01-01/">
3
+ <GetReportListResult>
4
+ <NextToken>2YgYW55IPQhvu5hbCBwbGVhc3VyZS4=</NextToken>
5
+ <HasNext>true</HasNext>
6
+ <ReportInfo>
7
+ <ReportId>898899473</ReportId>
8
+ <ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
9
+ <ReportRequestId>2278662938</ReportRequestId>
10
+ <AvailableDate>2009-02-10T09:22:33+00:00</AvailableDate>
11
+ <Acknowledged>false</Acknowledged>
12
+ </ReportInfo>
13
+ </GetReportListResult>
14
+ <ResponseMetadata>
15
+ <RequestId>fbf677c1-dcee-4110-bc88-2ba3702e331b</RequestId>
16
+ </ResponseMetadata>
17
+ </GetReportListResponse>
@@ -0,0 +1,9 @@
1
+ <GetReportRequestCountResponse xmlns="http://mws.amazonservices.com/
2
+ doc/2009-01-01/">
3
+ <GetReportRequestCountResult>
4
+ <Count>1276</Count>
5
+ </GetReportRequestCountResult>
6
+ <ResponseMetadata>
7
+ <RequestId>7e155027-3741-4422-95a7-1de12703c13e</RequestId>
8
+ </ResponseMetadata>
9
+ </GetReportRequestCountResponse>
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0"?>
2
+ <GetReportRequestListResponse xmlns="http://mws.amazonservices.com/
3
+ doc/2009-01-01/">
4
+ <GetReportRequestListResult>
5
+ <NextToken>2YgYW55IPQhcm5hbCBwbGVhc3VyZS4=</NextToken>
6
+ <HasNext>true</HasNext>
7
+ <ReportRequestInfo>
8
+ <ReportRequestId>2291326454</ReportRequestId>
9
+ <ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
10
+ <StartDate>2011-01-21T02:10:39+00:00</StartDate>
11
+ <EndDate>2011-02-13T02:10:39+00:00</EndDate>
12
+ <Scheduled>false</Scheduled>
13
+ <SubmittedDate>2011-02-17T23:44:09+00:00</SubmittedDate>
14
+ <ReportProcessingStatus>_DONE_</ReportProcessingStatus>
15
+ <GeneratedReportId>3538561173</GeneratedReportId>
16
+ <StartedProcessingDate>2011-02-17T23:44:43+00:00
17
+ </StartedProcessingDate>
18
+ <CompletedDate>2011-02-17T23:44:48+00:00</CompletedDate>
19
+ </ReportRequestInfo>
20
+ </GetReportRequestListResult>
21
+ <ResponseMetadata>
22
+ <RequestId>732480cb-84a8-4c15-9084-a46bd9a0889b</RequestId>
23
+ </ResponseMetadata>
24
+ </GetReportRequestListResponse>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <CancelReportRequestsResponse xmlns="http://mws.amazonservices.com/
3
+ doc/2009-01-01/">
4
+ <CancelReportRequestsResult>
5
+ <Count>10</Count>
6
+ <ReportRequestInfo>
7
+ <ReportRequestId>2291326454</ReportRequestId>
8
+ <ReportType>_GET_MERCHANT_LISTINGS_DATA_</ReportType>
9
+ <StartDate>2009-01-21T02:10:39+00:00</StartDate>
10
+ <EndDate>2009-02-13T02:10:39+00:00</EndDate>
11
+ <Scheduled>false</Scheduled>
12
+ <SubmittedDate>2009-02-20T02:10:39+00:00</SubmittedDate>
13
+ <ReportProcessingStatus>_CANCELLED_</ReportProcessingStatus>
14
+ </ReportRequestInfo>
15
+ </CancelReportRequestsResult>
16
+ <ResponseMetadata>
17
+ <RequestId>a720f9d6-83e9-4684-bc35-065b41ed5ca4</RequestId>
18
+ </ResponseMetadata>
19
+ </CancelReportRequestsResponse>
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0"?>
2
+ <GetReportScheduleCountResponse
3
+ xmlns="http://mws.amazonservices.com/doc/2009-01-01/">
4
+ <GetReportScheduleCountResult>
5
+ <Count>18</Count>
6
+ </GetReportScheduleCountResult>
7
+ <ResponseMetadata>
8
+ <RequestId>21e482a8-15c7-4da3-91a4-424995ed0756</RequestId>
9
+ </ResponseMetadata>
10
+ </GetReportScheduleCountResponse>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0"?>
2
+ <GetReportScheduleListResponse xmlns="http://mws.amazonservices.com/
3
+ doc/2009-01-01/">
4
+ <GetReportScheduleListResult>
5
+ <NextToken></NextToken>
6
+ <HasNext>false</HasNext>
7
+ <ReportSchedule>
8
+ <ReportType>_GET_ORDERS_DATA_</ReportType>
9
+ <Schedule>_30_DAYS_</Schedule>
10
+ <ScheduledDate>2009-02-20T02:10:42+00:00</ScheduledDate>
11
+ </ReportSchedule>
12
+ </GetReportScheduleListResult>
13
+ <ResponseMetadata>
14
+ <RequestId>c0464157-b74f-4e52-bd1a-4ebf4bc7e5aa</RequestId>
15
+ </ResponseMetadata>
16
+ </GetReportScheduleListResponse>
@@ -0,0 +1,15 @@
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>
@@ -0,0 +1,27 @@
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>
@@ -0,0 +1,9 @@
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>
@@ -10,6 +10,8 @@ class FeedSubmissionListTest < IntegrationTest
10
10
  refute_empty feeds.to_a
11
11
  more_feeds = client.get_feed_submission_list_by_next_token
12
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
13
15
  end
14
16
  end
15
17
  end
@@ -13,6 +13,9 @@ class OrdersTest < IntegrationTest
13
13
  orders = client.list_orders_by_next_token
14
14
  amazon_order_ids << orders.to_a.sample.amazon_order_id
15
15
 
16
+ orders = client.list_orders_by_next_token(orders.next_token)
17
+ amazon_order_ids << orders.to_a.sample.amazon_order_id
18
+
16
19
  orders = client.get_order(*amazon_order_ids)
17
20
  assert orders
18
21
  end
@@ -0,0 +1,15 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,17 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,12 @@
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
@@ -7,7 +7,10 @@ class IntegrationTest < MiniTest::Test
7
7
  end
8
8
 
9
9
  def accounts
10
+ skip if ENV['SKIP_INTEGRATION']
10
11
  YAML.load_file(File.expand_path('../fixtures/mws.yml', __FILE__))
12
+ rescue Errno::ENOENT
13
+ skip('Credentials missing')
11
14
  end
12
15
 
13
16
  def setup
@@ -7,7 +7,7 @@ class FeedParserTest < ParserTest
7
7
  @feed = MWS::Feeds::Parsers::Feed.new(node)
8
8
  end
9
9
 
10
- def test_submission
11
- assert_kind_of MWS::Feeds::Parsers::FeedSubmission, @feed.submission
10
+ def test_submission_info
11
+ assert_kind_of MWS::Feeds::Parsers::FeedSubmissionInfo, @feed.submission_info
12
12
  end
13
13
  end
@@ -1,10 +1,10 @@
1
1
  require 'parser_helper'
2
- require 'mws/feeds/parsers/feed_submission'
2
+ require 'mws/feeds/parsers/feed_submission_info'
3
3
 
4
- class FeedSubmissionParserTest < ParserTest
4
+ class FeedSubmissionInfoParserTest < ParserTest
5
5
  def setup
6
6
  node = fixture('feeds/feed_submission').xpath('//xmlns:FeedSubmissionInfo').first
7
- @feed = MWS::Feeds::Parsers::FeedSubmission.new(node)
7
+ @feed = MWS::Feeds::Parsers::FeedSubmissionInfo.new(node)
8
8
  end
9
9
 
10
10
  def test_id
@@ -9,6 +9,10 @@ class FeedSubmissionListParserTest < ParserTest
9
9
 
10
10
  def test_has_feed_submission_list
11
11
  refute_empty @feed_submission_list.to_a
12
- @feed_submission_list.each { |feed| assert_kind_of MWS::Feeds::Parsers::FeedSubmission, feed }
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?
13
17
  end
14
18
  end
@@ -8,6 +8,6 @@ class FeedSubmissionResultParserTest < ParserTest
8
8
  end
9
9
 
10
10
  def test_content
11
- assert_equal @body, @result.to_s
11
+ assert_equal @body, @result.document
12
12
  end
13
13
  end
@@ -27,13 +27,10 @@ class FeedSubmissionListRequestTest < RequestTest
27
27
  assert_kind_of MWS::Feeds::Parsers::FeedSubmissionList, res
28
28
  end
29
29
 
30
- def test_returns_next_token
31
- @feeds.last_response = mock_response
32
- assert_equal '123', @feeds.next_token
33
- end
34
-
35
30
  def test_gets_feed_submission_list_by_next_token
36
- @feeds.last_response = mock_response
31
+ mock_parsed_response = MiniTest::Mock.new
32
+ mock_parsed_response.expect(:next_token, '123')
33
+ @feeds.last_parsed_response = mock_parsed_response
37
34
  res = @feeds.get_by_next_token
38
35
  assert_kind_of MWS::Feeds::Parsers::FeedSubmissionList, res
39
36
  end
@@ -11,4 +11,8 @@ class OrderItemsParserTest < ParserTest
11
11
  refute_empty @order_items.to_a
12
12
  @order_items.each { |order_item| assert_kind_of MWS::Orders::Parsers::OrderItem, order_item }
13
13
  end
14
+
15
+ def test_has_token
16
+ assert @order_items.has_next_token?
17
+ end
14
18
  end
@@ -11,4 +11,8 @@ class OrdersParserTest < ParserTest
11
11
  refute_empty @orders.to_a
12
12
  @orders.each { |order| assert_kind_of MWS::Orders::Parsers::Order, order }
13
13
  end
14
+
15
+ def test_has_token
16
+ assert @orders.has_next_token?
17
+ end
14
18
  end
@@ -1,7 +1,7 @@
1
1
  require 'parser_helper'
2
2
  require 'mws/orders/parsers/service_status'
3
3
 
4
- class ServiceStatusParserTest < ParserTest
4
+ class OrdersServiceStatusParserTest < ParserTest
5
5
  def setup
6
6
  node = fixture('orders/service_status').xpath('//xmlns:GetServiceStatusResult').first
7
7
  @service_status = MWS::Orders::Parsers::ServiceStatus.new(node)
@@ -26,13 +26,10 @@ class MWSOrdersOrderItemsRequestTest < RequestTest
26
26
  assert_kind_of MWS::Orders::Parsers::OrderItems, res
27
27
  end
28
28
 
29
- def test_returns_next_token
30
- @order_items.last_response = mock_response
31
- assert_equal '123', @order_items.next_token
32
- end
33
-
34
29
  def test_lists_order_items_by_next_token
35
- @order_items.last_response = mock_response
30
+ mock_parsed_response = MiniTest::Mock.new
31
+ mock_parsed_response.expect(:next_token, '123')
32
+ @order_items.last_parsed_response = mock_parsed_response
36
33
  res = @order_items.list_by_next_token
37
34
  assert_kind_of MWS::Orders::Parsers::OrderItems, res
38
35
  end
@@ -26,13 +26,10 @@ class MWSOrdersOrdersRequestTest < RequestTest
26
26
  assert_kind_of MWS::Orders::Parsers::Orders, res
27
27
  end
28
28
 
29
- def test_returns_next_token
30
- @orders.last_response = mock_response
31
- assert_equal '123', @orders.next_token
32
- end
33
-
34
29
  def test_lists_orders_by_next_token
35
- @orders.last_response = mock_response
30
+ mock_parsed_response = MiniTest::Mock.new
31
+ mock_parsed_response.expect(:next_token, '123')
32
+ @orders.last_parsed_response = mock_parsed_response
36
33
  res = @orders.list_by_next_token
37
34
  assert_kind_of MWS::Orders::Parsers::Orders, res
38
35
  end
@@ -0,0 +1,14 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_acknowledgements'
3
+
4
+ class ReportAcknowledgementsParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_acknowledgements').xpath('//xmlns:UpdateReportAcknowledgementsResult')
7
+ @acknowledgments = MWS::Reports::Parsers::ReportAcknowledgements.new(node)
8
+ end
9
+
10
+ def test_has_report_acknowledgements
11
+ refute_empty @acknowledgments.to_a
12
+ @acknowledgments.each { |ack| assert_kind_of MWS::Reports::Parsers::ReportInfo, ack }
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_count'
3
+
4
+ class ReportCountParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_count').xpath('//xmlns:GetReportCountResult')
7
+ @report = MWS::Reports::Parsers::ReportCount.new(node)
8
+ end
9
+
10
+ def test_report_count
11
+ assert_kind_of Integer, @report.count
12
+ end
13
+ end
@@ -0,0 +1,29 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_info'
3
+
4
+ class ReportInfoParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_list').xpath('//xmlns:ReportInfo').first
7
+ @report = MWS::Reports::Parsers::ReportInfo.new(node)
8
+ end
9
+
10
+ def test_id
11
+ assert_kind_of String, @report.id
12
+ end
13
+
14
+ def test_type
15
+ assert_kind_of String, @report.type
16
+ end
17
+
18
+ def test_request_id
19
+ assert_kind_of String, @report.request_id
20
+ end
21
+
22
+ def test_available_at
23
+ assert_kind_of Time, @report.available_at
24
+ end
25
+
26
+ def test_acknowledged
27
+ assert [true, false].include?(@report.acknowledged?)
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_list'
3
+
4
+ class ReportListParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_list').xpath('//xmlns:GetReportListResult')
7
+ @list = MWS::Reports::Parsers::ReportList.new(node)
8
+ end
9
+
10
+ def test_has_report_list
11
+ refute_empty @list.to_a
12
+ @list.each { |report| assert_kind_of MWS::Reports::Parsers::ReportInfo, report }
13
+ end
14
+
15
+ def test_has_token
16
+ assert @list.has_next_token?
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_request_count'
3
+
4
+ class ReportRequestCountParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_request_count').xpath('//xmlns:GetReportRequestCountResult')
7
+ @request = MWS::Reports::Parsers::ReportRequestCount.new(node)
8
+ end
9
+
10
+ def test_report_request_count
11
+ assert_kind_of Integer, @request.count
12
+ end
13
+ end
@@ -0,0 +1,49 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_request_info'
3
+
4
+ class ReportRequestInfoParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_request_list').xpath('//xmlns:ReportRequestInfo').first
7
+ @request = MWS::Reports::Parsers::ReportRequestInfo.new(node)
8
+ end
9
+
10
+ def test_id
11
+ assert_kind_of String, @request.id
12
+ end
13
+
14
+ def test_type
15
+ assert_kind_of String, @request.type
16
+ end
17
+
18
+ def test_started_at
19
+ assert_kind_of Time, @request.started_at
20
+ end
21
+
22
+ def test_ended_at
23
+ assert_kind_of Time, @request.ended_at
24
+ end
25
+
26
+ def test_scheduled
27
+ assert [true, false].include?(@request.scheduled?)
28
+ end
29
+
30
+ def test_submitted_at
31
+ assert_kind_of Time, @request.submitted_at
32
+ end
33
+
34
+ def test_processing_status
35
+ assert_kind_of String, @request.processing_status
36
+ end
37
+
38
+ def test_generated_report_id
39
+ assert_kind_of String, @request.generated_report_id
40
+ end
41
+
42
+ def test_started_processing_at
43
+ assert_kind_of Time, @request.started_processing_at
44
+ end
45
+
46
+ def test_completed_at
47
+ assert_kind_of Time, @request.completed_at
48
+ end
49
+ end
@@ -0,0 +1,18 @@
1
+ require 'parser_helper'
2
+ require 'mws/reports/parsers/report_request_list'
3
+
4
+ class ReportRequestListParserTest < ParserTest
5
+ def setup
6
+ node = fixture('reports/report_request_list').xpath('//xmlns:GetReportRequestListResult')
7
+ @list = MWS::Reports::Parsers::ReportRequestList.new(node)
8
+ end
9
+
10
+ def test_has_report_requests
11
+ refute_empty @list.to_a
12
+ @list.each { |request| assert_kind_of MWS::Reports::Parsers::ReportRequestInfo, request }
13
+ end
14
+
15
+ def test_has_token
16
+ assert @list.has_next_token?
17
+ end
18
+ end