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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffb13ba94f5eab718c1f2cfc69623dd750881210
4
- data.tar.gz: 9b14e23a9da75b89fecee7b8d6c240028af41c4c
3
+ metadata.gz: 480feed5c44724e4f6ef152ec3c1da23075f4a11
4
+ data.tar.gz: d1e0ddcb314cd41e28f143f3f0304706f25f0af3
5
5
  SHA512:
6
- metadata.gz: 27c7939f8cc25e527e2c828807c319283b0e9ab60b0fa0aee4bda064a121b64e1f13f816f601b62c3838404f243f89dbf337185e02b05be2fb696ecfc7fd7e33
7
- data.tar.gz: 62fc940d7d6c6a5ffe3231782bce08edc07267f4b663acbb09215261bbbb176d12d8a67e2b582a07413dc956cc70cb01f5929e9b5f867cee7a98787290bbf921
6
+ metadata.gz: 58305a7973578fb6ca7153a28319db391b5075f76d9efe988a9a14dfe16a4c576249e26de4ad7e28f31b1a6a7971a4228f7e804b1a24411eaaf1e78e52f1b768
7
+ data.tar.gz: 500bbaf3efcf364737439c20518a84b5191788a12f4f10bb25fb9636f86fdcf72a1720b5bf11a686fa338da07c4a0dc4adf9e498b090d956469fa8ca7de420fd
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  # Peddler
2
2
 
3
- ![Peddler][1]
3
+ [![Build Status][travis]][badge]
4
4
 
5
- **Peddler** is a full-featured Ruby interface to the [Amazon Marketplace Web
6
- Service (MWS) APIs][2].
5
+ ![Peddler][mussels]
7
6
 
8
- ## Usage
7
+ **Peddler** is a full-featured Ruby interface to the [Amazon Marketplace Web Service (MWS) APIs][docs].
8
+
9
+ ## Configuration
9
10
 
10
11
  Require the library:
11
12
 
@@ -13,20 +14,19 @@ Require the library:
13
14
  require 'peddler'
14
15
  ```
15
16
 
16
- Alternatively, require a particular API only:
17
+ Or require an individual API:
17
18
 
18
19
  ```ruby
19
20
  require 'mws/orders'
20
21
  ```
21
22
 
22
- Instantiate a client with the ISO 3166-1 two-letter country code of the
23
- marketplace and your seller credentials:
23
+ Instantiate a client to a particular API with the ISO 3166-1 two-letter country code of the marketplace and your seller credentials:
24
24
 
25
25
  ```ruby
26
26
  client = MWS::Orders::Client.new('GB', 'key', 'secret', 'merchant_id')
27
27
  ```
28
28
 
29
- Alternatively, set your credentials as environment variables in your shell:
29
+ You may also set the credentials as environment variables in your shell:
30
30
 
31
31
  ```sh
32
32
  export AWS_ACCESS_KEY_ID=key
@@ -40,69 +40,21 @@ Then, instantiate with the country code:
40
40
  client = MWS::Orders::Client.new('US')
41
41
  ```
42
42
 
43
- ### Feeds
44
-
45
- The MWS Feeds API lets you upload inventory and order data to Amazon. You can
46
- also use this API to get information about the processing of feeds.
47
-
48
- [API methods are available on the client][3].
49
-
50
- Instantiate a client:
51
-
52
- ```ruby
53
- client = MWS::Feeds::Client.new('GB')
54
- ```
55
-
56
- #### Submit Feed
57
-
58
- Submit a feed:
59
-
60
- ```ruby
61
- client.submit_feed(xml, '_POST_PRODUCT_DATA_')
62
- ```
63
-
64
- #### Feed Submission List
65
-
66
- List past feed submissions:
67
-
68
- ```ruby
69
- # See the API for all available parameters for this and other methods.
70
- client.get_feed_submissions
71
- ```
72
-
73
- List the next page of feed submissions:
74
-
75
- ```ruby
76
- client.get_feed_submissions_by_next_token
77
- ```
78
-
79
- #### Feed Submission Count
43
+ When developing, you may set the `EXCON_DEBUG` environment variable to debug the HTTP exchange.
80
44
 
81
- Get the feed submission count:
82
-
83
- ```ruby
84
- client.get_feed_submission_count(submitted_from_date: 1.day.ago)
85
- ```
86
-
87
- #### Feed Submission Result
88
-
89
- Get the processing report for a submitted feed:
90
-
91
- ```ruby
92
- client.feed_submission_result('123456')
93
- ```
45
+ ## Usage
94
46
 
95
- #### Feed Submissions
47
+ ### Feeds
96
48
 
97
- Cancel one or more feed submissions:
49
+ The MWS Feeds API lets you upload inventory and order data to Amazon. You can also use this API to get information about the processing of feeds.
98
50
 
99
- ```ruby
100
- client.cancel_feed_submissions(submitted_to_date: 1.day.ago)
101
- ``
51
+ [Read the client API methods.][feeds-api]
102
52
 
103
53
  ### Fulfillment Inbound Shipment
104
54
 
105
- This API is not implemented yet. You can still use the raw client like so:
55
+ With the Fulfillment Inbound Shipment API, you can create and update inbound shipments of inventory in the Amazon Fulfillment Network. You can also request lists of inbound shipments or inbound shipment items based on criteria that you specify.
56
+
57
+ While this API is not implemented yet, you may still use the raw client like so:
106
58
 
107
59
  ```ruby
108
60
  client = MWS::FulfillmentInboundShipment::Client.new('GB')
@@ -112,7 +64,9 @@ Pull requests are welcome!
112
64
 
113
65
  ### Fulfillment Inventory
114
66
 
115
- This API is not implemented yet. You can still use the raw client like so:
67
+ The Fulfillment Inventory API lets you see what is available in your inventory. It's a real-time reporting mechanism that returns your current or recently-changed inventory supply in the Amazon fulfillment network.
68
+
69
+ While this API is not implemented yet, you may still use the raw client like so:
116
70
 
117
71
  ```ruby
118
72
  client = MWS::FulfillmentInventory::Client.new('GB')
@@ -122,7 +76,9 @@ Pull requests are welcome!
122
76
 
123
77
  ### Fulfillment Outbound Shipment
124
78
 
125
- This API is not implemented yet. You can still use the raw client like so:
79
+ The Fulfillment Outbound Shipment API is designed to help you integrate Fulfillment by Amazon with any payment processing application or inventory management system currently in use.
80
+
81
+ While this API is not implemented yet, you may still use the raw client like so:
126
82
 
127
83
  ```ruby
128
84
  client = MWS::FulfillmentOutboundShipment::Client.new('GB')
@@ -132,7 +88,9 @@ Pull requests are welcome!
132
88
 
133
89
  ### Off Amazon Payments
134
90
 
135
- This API is not implemented yet. You can still use the raw client like so:
91
+ The Off-Amazon Payments API helps you to process payments for purchases made by buyers using Amazon Payments on your website. This API enables you to programmatically retrieve shipping and payment information provided by the buyer from their Amazon account and to authorize, capture, and refund funds to enable a variety of payments scenarios.
92
+
93
+ While this API is not implemented yet, you may still use the raw client like so:
136
94
 
137
95
  ```ruby
138
96
  client = MWS::OffAmazonPayments::Client.new('GB')
@@ -142,70 +100,15 @@ Pull requests are welcome!
142
100
 
143
101
  ### Orders
144
102
 
145
- With the MWS Orders API, you can list orders created or updated during a time
146
- frame you specify or retrieve information about specific orders.
147
-
148
- [API methods are available on the client][4].
103
+ With the MWS Orders API, you can list orders created or updated during a time frame you specify or retrieve information about specific orders.
149
104
 
150
- Instantiate a client:
151
-
152
- ```ruby
153
- client = MWS::Orders::Client.new('GB')
154
- ```
155
-
156
- #### Orders
157
-
158
- List orders:
159
-
160
- ```ruby
161
- # See the API for all available parameters.
162
- client.list_orders(
163
- created_after: 1.week.ago,
164
- order_status: %w(Pending Unshipped)
165
- )
166
- ```
167
-
168
- List the next page of orders:
169
-
170
- ```ruby
171
- client.list_orders_by_next_token
172
- ```
173
-
174
- Get one or more orders based on their order numbers:
175
-
176
- ```ruby
177
- client.get_order('123-1234567-1234567')
178
- ```
179
-
180
- All above queries will return an enumerable list of orders.
181
-
182
- #### Order Items
183
-
184
- List order items based on an order number you specify:
185
-
186
- ```ruby
187
- client.list_order_items('123-1234567-1234567')
188
- ```
189
-
190
- List the next page of order items:
191
-
192
- ```ruby
193
- client.list_order_items_by_next_token
194
- ```
195
-
196
- All above queries will return an enumerable list of order items.
197
-
198
- #### Service Status
199
-
200
- Check the operational status of the API:
201
-
202
- ```ruby
203
- client.get_service_status
204
- ```
105
+ [Read the client API methods.][orders-api]
205
106
 
206
107
  ### Products
207
108
 
208
- This API is not implemented yet. You can still use the raw client like so:
109
+ The Products API helps you get information to match your products to existing product listings on Amazon Marketplace websites and to make sourcing and pricing decisions for listing those products on Amazon Marketplace websites.
110
+
111
+ While this API is not implemented yet, you may still use the raw client like so:
209
112
 
210
113
  ```ruby
211
114
  client = MWS::Products::Client.new('GB')
@@ -215,7 +118,9 @@ Pull requests are welcome!
215
118
 
216
119
  ### Recommendations
217
120
 
218
- This API is not implemented yet. You can still use the raw client like so:
121
+ The Recommendations API enables you to programmatically retrieve Amazon Selling Coach recommendations by recommendation category. A recommendation is an actionable, timely, and personalized opportunity to increase your sales and performance.
122
+
123
+ While this API is not implemented yet, you may still use the raw client like so:
219
124
 
220
125
  ```ruby
221
126
  client = MWS::Recommendations::Client.new('GB')
@@ -225,27 +130,21 @@ Pull requests are welcome!
225
130
 
226
131
  ### Reports
227
132
 
228
- This API is not implemented yet. You can still use the raw client like so:
133
+ The Reports API lets you request reports about your inventory and orders.
229
134
 
230
- ```ruby
231
- client = MWS::Reports::Client.new('GB')
232
- ```
233
-
234
- Pull requests are welcome!
135
+ [Read the client API methods.][reports-api]
235
136
 
236
137
  ### Sellers
237
138
 
238
- This API is not implemented yet. You can still use the raw client like so:
139
+ The Sellers API lets sellers retrieve information about their seller account, such as the marketplaces they participate in.
239
140
 
240
- ```ruby
241
- client = MWS::Sellers::Client.new('GB')
242
- ```
243
-
244
- Pull requests are welcome!
141
+ [Read the client API methods.][sellers-api]
245
142
 
246
143
  ### Subscriptions
247
144
 
248
- This API is not implemented yet. You can still use the raw client like so:
145
+ The Amazon MWS Subscriptions API enables you to subscribe to receive notifications that are relevant to your business with Amazon. With the operations in the Subscriptions API section, you can register to receive important information from Amazon without having to poll the Amazon MWS service. Instead, the information is sent directly to you when an event occurs to which you are subscribed.
146
+
147
+ While this API is not implemented yet, you may still use the raw client like so:
249
148
 
250
149
  ```ruby
251
150
  client = MWS::Subscriptions::Client.new('GB')
@@ -253,7 +152,11 @@ client = MWS::Subscriptions::Client.new('GB')
253
152
 
254
153
  Pull requests are welcome!
255
154
 
256
- [1]: http://f.cl.ly/items/0W3V0A1Z110Q0x461b3H/mussels.jpeg
257
- [2]: https://developer.amazonservices.com/gp/mws/docs.html
258
- [3]: https://github.com/papercavalier/peddler/blob/master/lib/mws/feeds/client.rb
259
- [4]: https://github.com/papercavalier/peddler/blob/master/lib/mws/orders/client.rb
155
+ [travis]: https://travis-ci.org/papercavalier/peddler.png
156
+ [badge]:https://travis-ci.org/papercavalier/peddler
157
+ [mussels]: http://f.cl.ly/items/0W3V0A1Z110Q0x461b3H/mussels.jpeg
158
+ [docs]: https://developer.amazonservices.com/gp/mws/docs.html
159
+ [feeds-api]: https://github.com/papercavalier/peddler/blob/master/lib/mws/feeds/client.rb
160
+ [orders-api]: https://github.com/papercavalier/peddler/blob/master/lib/mws/orders/client.rb
161
+ [reports-api]: https://github.com/papercavalier/peddler/blob/master/lib/mws/reports/client.rb
162
+ [sellers-api]: https://github.com/papercavalier/peddler/blob/master/lib/mws/sellers/client.rb
@@ -7,6 +7,8 @@ require 'peddler/client'
7
7
 
8
8
  module MWS
9
9
  module Feeds
10
+ # The MWS Feeds API lets you upload inventory and order data to Amazon. You
11
+ # can also use this API to get information about the processing of feeds.
10
12
  class Client < ::Peddler::Client
11
13
  # Public: Upload a feed for processing by Amazon MWS.
12
14
  #
@@ -44,11 +46,15 @@ module MWS
44
46
 
45
47
  # Public: List the next page of the list of feed submissions.
46
48
  #
49
+ # token - A String token (default: The token returned in the last
50
+ # request).
51
+ #
47
52
  # Examples
48
53
  #
49
54
  # client.get_feed_submission_list_by_next_token
50
55
  #
51
- # Returns an enumerable Feed Submission List.
56
+ # Returns an enumerable Feed Submission List or false if there are no more
57
+ # pages left.
52
58
  def_delegator :feed_submission_list, :get_by_next_token, :get_feed_submission_list_by_next_token
53
59
 
54
60
  # Public: Get a count of the feeds submitted during a specified time
@@ -1,12 +1,12 @@
1
1
  require 'peddler/parsers/model'
2
- require 'mws/feeds/parsers/feed_submission'
2
+ require 'mws/feeds/parsers/feed_submission_info'
3
3
 
4
4
  module MWS
5
5
  module Feeds
6
6
  module Parsers
7
7
  class Feed < Peddler::Parsers::Model
8
- value :submission do
9
- FeedSubmission.new(document.xpath('xmlns:FeedSubmissionInfo').first)
8
+ value :submission_info do
9
+ FeedSubmissionInfo.new(at_xpath('FeedSubmissionInfo'))
10
10
  end
11
11
  end
12
12
  end
@@ -1,12 +1,9 @@
1
- require 'peddler/parsers/model'
1
+ require 'peddler/parsers/counter'
2
2
 
3
3
  module MWS
4
4
  module Feeds
5
5
  module Parsers
6
- class FeedSubmissionCount < ::Peddler::Parsers::Model
7
- value :count do
8
- integer_at_xpath('Count')
9
- end
6
+ class FeedSubmissionCount < ::Peddler::Parsers::Counter
10
7
  end
11
8
  end
12
9
  end
@@ -3,7 +3,7 @@ require 'peddler/parsers/model'
3
3
  module MWS
4
4
  module Feeds
5
5
  module Parsers
6
- class FeedSubmission < ::Peddler::Parsers::Model
6
+ class FeedSubmissionInfo < ::Peddler::Parsers::Model
7
7
  value :id do
8
8
  text_at_xpath('FeedSubmissionId')
9
9
  end
@@ -1,17 +1,20 @@
1
1
  require 'peddler/parsers/collection'
2
- require 'mws/feeds/parsers/feed_submission'
2
+ require 'mws/feeds/parsers/feed_submission_info'
3
+ require 'peddler/parsers/tokenable'
3
4
 
4
5
  module MWS
5
6
  module Feeds
6
7
  module Parsers
7
8
  class FeedSubmissionList < ::Peddler::Parsers::Collection
9
+ include ::Peddler::Parsers::Tokenable
10
+
8
11
  def each(&blk)
9
- feed_submission_nodes.each { |node| yield FeedSubmission.new(node) }
12
+ feed_submission_info_nodes.each { |node| yield FeedSubmissionInfo.new(node) }
10
13
  end
11
14
 
12
15
  private
13
16
 
14
- def feed_submission_nodes
17
+ def feed_submission_info_nodes
15
18
  xpath('FeedSubmissionInfo')
16
19
  end
17
20
  end
@@ -1,5 +1,5 @@
1
1
  require 'peddler/parsers/model'
2
- require 'mws/feeds/parsers/feed_submission'
2
+ require 'mws/feeds/parsers/feed_submission_info'
3
3
 
4
4
  module MWS
5
5
  module Feeds
@@ -10,7 +10,7 @@ module MWS
10
10
  end
11
11
 
12
12
  def feed_submissions
13
- xpath('FeedSubmissionInfo').map { |node| FeedSubmission.new(node) }
13
+ xpath('FeedSubmissionInfo').map { |node| FeedSubmissionInfo.new(node) }
14
14
  end
15
15
  end
16
16
  end
@@ -15,9 +15,11 @@ module MWS
15
15
  execute
16
16
  end
17
17
 
18
- def get_by_next_token
18
+ def get_by_next_token(token = next_token)
19
+ return false unless token
20
+
19
21
  parameters(:get_feed_submission_list_by_next_token)
20
- .update(next_token: next_token)
22
+ .update(next_token: token)
21
23
  .camelize_keys!
22
24
 
23
25
  execute
@@ -5,6 +5,8 @@ require 'peddler/client'
5
5
 
6
6
  module MWS
7
7
  module Orders
8
+ # With the MWS Orders API, you can list orders created or updated during a
9
+ # time frame you specify or retrieve information about specific orders.
8
10
  class Client < ::Peddler::Client
9
11
  path 'Orders/2011-01-01'
10
12
 
@@ -33,11 +35,15 @@ module MWS
33
35
 
34
36
  # Public: List the next page of orders using the NextToken parameter.
35
37
  #
38
+ # token - A String token (default: The token returned in the last
39
+ # request).
40
+ #
36
41
  # Examples
37
42
  #
38
43
  # client.list_orders_by_next_token
39
44
  #
40
- # Returns an enumerable list of Orders.
45
+ # Returns an enumerable list of Orders or false if there are no more pages
46
+ # left.
41
47
  def_delegator :orders, :list_by_next_token, :list_orders_by_next_token
42
48
 
43
49
  # Public: List order items for an amazon order.
@@ -54,11 +60,15 @@ module MWS
54
60
  # Public: List the next page of order items using the NextToken
55
61
  # parameter.
56
62
  #
63
+ # token - A String token (default: The token returned in the last
64
+ # request).
65
+ #
57
66
  # Examples
58
67
  #
59
68
  # client.list_order_items_by_next_token
60
69
  #
61
- # Returns an enumerable list of Order Items.
70
+ # Returns an enumerable list of Order Items or false if there are no more
71
+ # pages left.
62
72
  def_delegator :order_items, :list_by_next_token, :list_order_items_by_next_token
63
73
 
64
74
  # Public: Get the service status of the API.
@@ -1,10 +1,13 @@
1
1
  require 'mws/orders/parsers/order_item'
2
2
  require 'peddler/parsers/collection'
3
+ require 'peddler/parsers/tokenable'
3
4
 
4
5
  module MWS
5
6
  module Orders
6
7
  module Parsers
7
8
  class OrderItems < ::Peddler::Parsers::Collection
9
+ include ::Peddler::Parsers::Tokenable
10
+
8
11
  def each(&blk)
9
12
  order_item_nodes.each { |node| yield OrderItem.new(node) }
10
13
  end
@@ -1,18 +1,21 @@
1
1
  require 'mws/orders/parsers/order'
2
2
  require 'peddler/parsers/collection'
3
+ require 'peddler/parsers/tokenable'
3
4
 
4
5
  module MWS
5
6
  module Orders
6
7
  module Parsers
7
8
  class Orders < ::Peddler::Parsers::Collection
8
- extend Forwardable
9
+ include ::Peddler::Parsers::Tokenable
9
10
 
10
- def_delegator :order_nodes, :each
11
+ def each(&blk)
12
+ order_nodes.each { |node| yield Order.new(node) }
13
+ end
11
14
 
12
15
  private
13
16
 
14
17
  def order_nodes
15
- xpath('Orders/Order').map { |node| Order.new(node) }
18
+ xpath('Orders/Order')
16
19
  end
17
20
  end
18
21
  end
@@ -13,9 +13,11 @@ module MWS
13
13
  execute
14
14
  end
15
15
 
16
- def list_by_next_token
16
+ def list_by_next_token(token = next_token)
17
+ return unless token
18
+
17
19
  parameters(:list_order_items_by_next_token)
18
- .update(next_token: next_token)
20
+ .update(next_token: token)
19
21
  .camelize_keys!
20
22
 
21
23
  execute
@@ -26,9 +26,11 @@ module MWS
26
26
  execute
27
27
  end
28
28
 
29
- def list_by_next_token
29
+ def list_by_next_token(token = next_token)
30
+ return unless token
31
+
30
32
  parameters(:list_orders_by_next_token)
31
- .update(next_token: next_token)
33
+ .update(next_token: token)
32
34
  .camelize_keys!
33
35
 
34
36
  execute