peddler 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +50 -28
  3. data/lib/mws.rb +2 -0
  4. data/lib/mws/cart_information/client.rb +7 -6
  5. data/lib/mws/customer_information/client.rb +6 -6
  6. data/lib/mws/feeds/client.rb +8 -8
  7. data/lib/mws/finances/client.rb +6 -6
  8. data/lib/mws/fulfillment_inbound_shipment/client.rb +41 -40
  9. data/lib/mws/fulfillment_inventory/client.rb +3 -3
  10. data/lib/mws/fulfillment_outbound_shipment/client.rb +18 -18
  11. data/lib/mws/merchant_fulfillment.rb +1 -0
  12. data/lib/mws/merchant_fulfillment/client.rb +88 -0
  13. data/lib/mws/off_amazon_payments/client.rb +203 -202
  14. data/lib/mws/orders/client.rb +6 -6
  15. data/lib/mws/products/client.rb +38 -38
  16. data/lib/mws/recommendations/client.rb +4 -4
  17. data/lib/mws/reports/client.rb +19 -17
  18. data/lib/mws/sellers/client.rb +2 -2
  19. data/lib/mws/subscriptions/client.rb +22 -22
  20. data/lib/mws/webstore/client.rb +8 -8
  21. data/lib/peddler/client.rb +7 -7
  22. data/lib/peddler/flat_file_parser.rb +1 -1
  23. data/lib/peddler/marketplace.rb +2 -2
  24. data/lib/peddler/operation.rb +7 -12
  25. data/lib/peddler/vcr_matcher.rb +5 -3
  26. data/lib/peddler/version.rb +2 -1
  27. data/test/helper.rb +11 -2
  28. data/test/integration/test_fulfillment_inbound_shipment.rb +1 -1
  29. data/test/integration/test_merchant_fulfillment.rb +11 -0
  30. data/test/integration/test_orders.rb +20 -0
  31. data/test/unit/mws/test_merchant_fulfillment_client.rb +83 -0
  32. data/test/unit/peddler/test_client.rb +12 -10
  33. data/test/unit/peddler/test_vcr_matcher.rb +3 -3
  34. data/test/vcr_cassettes/MerchantFulfillment.yml +195 -0
  35. data/test/vcr_cassettes/Orders.yml +1902 -5
  36. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7eb80f7f028b5464f42c29cb72ce60e2eda123d
4
- data.tar.gz: 8a814e73f8695da5b01b0e14d62732beec970cd6
3
+ metadata.gz: b95e55aea4d9f7f44675d59cbbec0dfc2dc72155
4
+ data.tar.gz: 75074f1a3a288aefe5cb452dfa8b20fe521bc28f
5
5
  SHA512:
6
- metadata.gz: d736136aed3d96ebc1fc61be23638350ba84e82a7473e8ce62bf3f8086cac12e3640539895b3c25f41f739c41d7d76ff3a5193d38636932c323351967d5d9701
7
- data.tar.gz: c03d025e24a676ab7150f685eef1db93b183f942f2b7259ba44e51f394dd77d195d335bbe92f2f8fd79ca9cc626a7be02ba8673d0ad0ec5911cc03ce58eed682
6
+ metadata.gz: ebdd605e71a49b34b84a3825da5cd01814ca37c8ad2eea6ad2743da14396eea4824caa0a8c968ae83d2153138acd2a75853be7f0251e73f0a13bf7f3551a8dee
7
+ data.tar.gz: 7813fd21aa2039e3bd9692eac635dab4b8c73965f22df28d0cd57b822177feb20f6b8792dc4cfd97d3b5bcda6a871452c2bd04ddd736e7f1f0dae9e6a658a5fe
data/README.md CHANGED
@@ -32,10 +32,10 @@ client = MWS.orders
32
32
  Each client requires valid MWS credentials. You can set these globally in the shell.
33
33
 
34
34
  ```bash
35
- export MWS_MARKETPLACE_ID=foo
36
- export MWS_MERCHANT_ID=bar
37
- export AWS_ACCESS_KEY_ID=baz
38
- export AWS_SECRET_ACCESS_KEY=qux
35
+ export MWS_MARKETPLACE_ID=YOUR_MARKETPLACE_ID
36
+ export MWS_MERCHANT_ID=YOUR_MERCHANT_OR_SELLER_ID
37
+ export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
38
+ export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
39
39
  ```
40
40
 
41
41
  You can now instantiate a client.
@@ -44,23 +44,29 @@ You can now instantiate a client.
44
44
  client = MWS.orders
45
45
  ```
46
46
 
47
- Alternatively, you can set some or all credentials when or after creating the client.
47
+ Alternatively, if you do not rely on environment variables, you can set some or all credentials when or after creating the client.
48
48
 
49
49
  ```ruby
50
50
  client = MWS.orders(
51
- primary_marketplace_id: "foo",
52
- merchant_id: "bar",
53
- aws_access_key_id: "baz",
54
- aws_secret_access_key: "qux"
51
+ primary_marketplace_id: "Your Marketplace ID",
52
+ merchant_id: "Your Merchant or Seller ID",
53
+ aws_access_key_id: "Your AWS Access Key ID",
54
+ aws_secret_access_key: "Your AWS Secret Access Key",
55
55
  )
56
- client.primary_marketplace_id = "bar"
56
+
57
+ client.primary_marketplace_id = "Another Marketplace ID"
57
58
  ```
58
59
 
59
- If you are creating a client for another seller, pass the latter's `MWSAuthToken` to the client.
60
+ If you are creating a [client for another seller](https://developer.amazonservices.com/gp/mws/faq.html#developForSeller), pass the latter's Merchant (Seller) ID and Marketplace ID along with the `MWSAuthToken` they obtained for you.
60
61
 
61
62
  ```ruby
62
- client = MWS.orders
63
- client.auth_token = "corge"
63
+ client = MWS.orders(
64
+ primary_marketplace_id: "Seller's Marketplace ID",
65
+ merchant_id: "Seller's Merchant or Seller ID",
66
+ aws_access_key_id: "Your AWS Access Key ID",
67
+ aws_secret_access_key: "Your AWS Secret Access Key",
68
+ auth_token: "Seller's MWS Authorisation Token"
69
+ )
64
70
  ```
65
71
 
66
72
  Once you have a client with valid credentials, you should be able to make requests to the API. Clients map operation names in a flat structure. Methods have positional arguments for required input and keyword arguments for optional parameters. Both method and argument names are underscored but otherwise identical to the names of the corresponding operations and parameters documented in the API.
@@ -107,37 +113,43 @@ end
107
113
 
108
114
  With the MWS Cart Information API, you can retrieve shopping carts that your Amazon Webstore customers have created. The Cart Information API enables you to programmatically integrate Amazon Webstore cart information with your CRM systems, marketing applications, and other systems that require cart data.
109
115
 
110
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/CartInformation/Client)
116
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=cartinformation&section=cartinformation)
117
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/CartInformation/Client)
111
118
 
112
119
  ### Customer Information
113
120
 
114
121
  With the MWS Customer Information API, you can retrieve information from the customer accounts of your Amazon Webstore customers. This customer information includes customer name, contact information, customer account type, and associated Amazon Webstore marketplaces. The Customer Information API enables you to programmatically integrate Amazon Webstore customer account information with your CRM systems, marketing applications, and other systems that require customer data.
115
122
 
116
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/CustomerInformation/Client)
123
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=customerinformation&section=customerinformation)
124
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/CustomerInformation/Client)
117
125
 
118
126
  ### Feeds
119
127
 
120
128
  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.
121
129
 
122
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Feeds/Client)
130
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=bde&section=feeds)
131
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Feeds/Client)
123
132
 
124
133
  ### Finances
125
134
 
126
135
  The MWS Finances API enables you to obtain financial information relevant to your business with Amazon. You can obtain financial events for a given order, financial event group, or date range without having to wait until a statement period closes. You can also obtain financial event groups for a given date range.
127
136
 
128
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Finances/Client)
137
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=finances&section=finances)
138
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Finances/Client)
129
139
 
130
140
  ### Fulfillment Inbound Shipment
131
141
 
132
142
  With the MWS Fulfillment Inbound Shipment API, you can create and update inbound shipments of inventory in the Amazon Fulfillment Network. You can also also request lists of inbound shipments or inbound shipment items based on criteria that you specify.
133
143
 
134
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentInboundShipment/Client)
144
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=fulfillment&section=inbound)
145
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentInboundShipment/Client)
135
146
 
136
147
  ### Fulfillment Inventory
137
148
 
138
149
  The MWS Fulfillment Inventory API can help you stay up-to-date on the availability of your inventory in the Amazon Fulfillment Network. The Fulfillment Inventory API reports real-time availability information for your Amazon Fulfillment Network inventory regardless of whether you are selling your inventory on Amazon's retail web site or through other retail channels.
139
150
 
140
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentInventory/Client)
151
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=fulfillment&section=inventory)
152
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentInventory/Client)
141
153
 
142
154
  ### Fulfillment Outbound Shipment
143
155
 
@@ -145,7 +157,8 @@ The MWS Fulfillment Outbound Shipment API enables you to fulfill orders placed t
145
157
 
146
158
  Support for creating and cancelling fulfillment orders has been implemented, but the rest of the API is not supported yet.
147
159
 
148
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentOutboundShipment/Client)
160
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=fulfillment&section=outbound)
161
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/FulfillmentOutboundShipment/Client)
149
162
 
150
163
  ### Off Amazon Payments
151
164
 
@@ -157,46 +170,55 @@ You can switch the client to the sandbox environment:
157
170
  client = MWS.off_amazon_payments.sandbox
158
171
  ```
159
172
 
160
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/OffAmazonPayments/Client)
173
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=offamazonpayments&section=offamazonpayments)
174
+ - [Official Ruby client](https://github.com/amzn/login-and-pay-with-amazon-sdk-ruby)
175
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/OffAmazonPayments/Client)
161
176
 
162
177
  ### Orders
163
178
 
164
179
  With the MWS Orders API, you can list orders created or updated during a time frame you specify or retrieve information about specific orders.
165
180
 
166
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Orders/Client)
181
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=orders&section=orders)
182
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Orders/Client)
167
183
 
168
184
  ### Products
169
185
 
170
186
  The MWS 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.
171
187
 
172
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Products/Client)
188
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=products&section=products)
189
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Products/Client)
173
190
 
174
191
  ### Recommendations
175
192
 
176
193
  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.
177
194
 
178
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Recommendations/Client)
195
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=recommendations&section=recommendations)
196
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Recommendations/Client)
179
197
 
180
198
  ### Reports
181
199
 
182
200
  The Reports API lets you request reports about your inventory and orders.
183
201
 
184
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Reports/Client)
202
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=bde&section=reports)
203
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Reports/Client)
185
204
 
186
205
  ### Sellers
187
206
 
188
207
  The Sellers API lets sellers retrieve information about their seller account, such as the marketplaces they participate in.
189
208
 
190
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Sellers/Client)
209
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=sellers&section=sellers)
210
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Sellers/Client)
191
211
 
192
212
  ### Subscriptions
193
213
 
194
214
  The Amazon MWS Subscriptions API section 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.
195
215
 
196
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Subscriptions/Client)
216
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=subscriptions&section=subscriptions)
217
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Subscriptions/Client)
197
218
 
198
219
  ### Webstore
199
220
 
200
221
  With the Webstore API section of Amazon Marketplace Web Service (Amazon MWS), you can get “Email Me When Available” subscription information for items listed on your Amazon Webstore. The Webstore API section can help you plan your inventory replenishment cycle by enabling you to query for items that your customers subscribed to when they clicked the Email Me When Available button on your Webstore. The Webstore API section can also return information about the notifications that were sent to your customers when out-of-stock items came back in stock. This information, when combined with sales information that your Webstore tracks, can help you determine how many notifications were converted into sales.
201
222
 
202
- [Read more](http://www.rubydoc.info/gems/peddler/MWS/Webstore/Client)
223
+ - [Amazon references](https://developer.amazonservices.com/gp/mws/api.html?group=webstore&section=webstore)
224
+ - [Peddler API docs](http://www.rubydoc.info/gems/peddler/MWS/Webstore/Client)
data/lib/mws.rb CHANGED
@@ -6,6 +6,7 @@ require 'mws/finances'
6
6
  require 'mws/fulfillment_inbound_shipment'
7
7
  require 'mws/fulfillment_inventory'
8
8
  require 'mws/fulfillment_outbound_shipment'
9
+ require 'mws/merchant_fulfillment'
9
10
  require 'mws/off_amazon_payments'
10
11
  require 'mws/orders'
11
12
  require 'mws/products'
@@ -15,6 +16,7 @@ require 'mws/sellers'
15
16
  require 'mws/subscriptions'
16
17
  require 'mws/webstore'
17
18
 
19
+ # The various Amazon MWS API sections.
18
20
  module MWS
19
21
  class << self
20
22
  extend Forwardable
@@ -16,14 +16,14 @@ module MWS
16
16
  # @note In addition to registering for Amazon MWS, you must also request
17
17
  # authorization to use the Cart Information API section.
18
18
  class Client < ::Peddler::Client
19
- version "2014-03-01"
19
+ version '2014-03-01'
20
20
  path "/CartInformation/#{version}"
21
21
 
22
22
  # Lists shopping carts
23
23
  #
24
24
  # @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_ListCarts.html
25
- # @param date_range_start [String, #iso8601]
26
- # @param opts [Hash]
25
+ # @param [String, #iso8601] date_range_start
26
+ # @param [Hash] opts
27
27
  # @option opts [String] :marketplace_id
28
28
  # @option opts [String, #iso8601] :date_range_end
29
29
  # @return [Peddler::XMLParser]
@@ -37,7 +37,7 @@ module MWS
37
37
  # Lists the next page of shopping carts
38
38
  #
39
39
  # @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_ListCartsByNextToken.html
40
- # @param next_token [String]
40
+ # @param [String] next_token
41
41
  # @return [Peddler::XMLParser]
42
42
  def list_carts_by_next_token(next_token)
43
43
  operation('ListCartsByNextToken')
@@ -49,8 +49,9 @@ module MWS
49
49
  # Returns shopping carts based on specified values
50
50
  #
51
51
  # @see http://docs.developer.amazonservices.com/en_US/cart_info/CartInfo_GetCarts.html
52
- # @param marketplace_id [String]
53
- # @param cart_id_list [Array<String>]
52
+ # @overload get_carts(marketplace_id, *cart_ids)
53
+ # @param [String] marketplace_id
54
+ # @param [String] cart_id one or more cart_ids
54
55
  # @return [Peddler::XMLParser]
55
56
  def get_carts(marketplace_id, *cart_id_list)
56
57
  operation('GetCarts')
@@ -18,13 +18,13 @@ module MWS
18
18
  # @note In addition to registering for Amazon MWS, you must request
19
19
  # authorization to use the Customer Information API.
20
20
  class Client < ::Peddler::Client
21
- version "2014-03-01"
21
+ version '2014-03-01'
22
22
  path "/CustomerInformation/#{version}"
23
23
 
24
24
  # Lists customer accounts based on search criteria that you specify
25
25
  #
26
26
  # @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_ListCustomers.html
27
- # @param opts [Hash]
27
+ # @param [Hash] opts
28
28
  # @option opts [String] :marketplace_id
29
29
  # @option opts [String, #iso8601] :date_range_start
30
30
  # @option opts [String, #iso8601] :date_range_end
@@ -40,7 +40,7 @@ module MWS
40
40
  # Lists the next page of customer accounts
41
41
  #
42
42
  # @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_ListCustomersByNextToken.html
43
- # @param next_token [String]
43
+ # @param [String] next_token
44
44
  # @return [Peddler::XMLParser]
45
45
  def list_customers_by_next_token(next_token)
46
46
  operation('ListCustomersByNextToken')
@@ -53,9 +53,9 @@ module MWS
53
53
  # specify
54
54
  #
55
55
  # @see http://docs.developer.amazonservices.com/en_US/customer_info/CustomerInfo_GetCustomersForCustomerId.html
56
- # @overload get_customers_for_customer_id(*customer_id_list, opts = {})
57
- # @param customer_id_list [Array<String>]
58
- # @param opts [Hash]
56
+ # @overload get_customers_for_customer_id(*customer_ids, opts = {})
57
+ # @param [String] customer_id one or more customer_ids
58
+ # @param [Hash] opts
59
59
  # @option opts [String] :marketplace_id
60
60
  # @return [Peddler::XMLParser]
61
61
  def get_customers_for_customer_id(*customer_id_list)
@@ -12,9 +12,9 @@ module MWS
12
12
  # @note Feed size is limited to 2,147,483,647 bytes (2^31 -1) per feed.
13
13
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_SubmitFeed.html
14
14
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_FeedType.html
15
- # @param feed_content [String] an XML or flat file feed
16
- # @param feed_type [String] the feed type
17
- # @param opts [Hash]
15
+ # @param [String] feed_content an XML or flat file feed
16
+ # @param [String] feed_type the feed type
17
+ # @param [Hash] opts
18
18
  # @option opts [Array<String>, String] :marketplace_id_list
19
19
  # @option opts [Boolean] :purge_and_replace
20
20
  # @return [Peddler::XMLParser]
@@ -31,7 +31,7 @@ module MWS
31
31
  #
32
32
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_GetFeedSubmissionList.html
33
33
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_FeedType.html
34
- # @param opts [Hash]
34
+ # @param [Hash] opts
35
35
  # @option opts [Array<String>, String] :feed_submission_id_list
36
36
  # @option opts [Integer] :max_count
37
37
  # @option opts [Array<String>, String] :feed_type_list
@@ -52,7 +52,7 @@ module MWS
52
52
  # Lists the next page of feed submissions
53
53
  #
54
54
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_GetFeedSubmissionListByNextToken.html
55
- # @param next_token [String]
55
+ # @param [String] next_token
56
56
  # @return [Peddler::XMLParser]
57
57
  def get_feed_submission_list_by_next_token(next_token)
58
58
  operation('GetFeedSubmissionListByNextToken')
@@ -65,7 +65,7 @@ module MWS
65
65
  #
66
66
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_GetFeedSubmissionCount.html
67
67
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_FeedType.html
68
- # @param opts [Hash]
68
+ # @param [Hash] opts
69
69
  # @option opts [Array<String>, String] :feed_type_list
70
70
  # @option opts [Array<String>, String] :feed_processing_status_list
71
71
  # @option opts [String, #iso8601] :submitted_from_date
@@ -84,7 +84,7 @@ module MWS
84
84
  #
85
85
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_CancelFeedSubmissions.html
86
86
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_FeedType.html
87
- # @param opts [Hash]
87
+ # @param [Hash] opts
88
88
  # @option opts [Array<String>, String] :feed_submission_id_list
89
89
  # @option opts [Array<String>, String] :feed_type_list
90
90
  # @option opts [String, #iso8601] :submitted_from_date
@@ -102,7 +102,7 @@ module MWS
102
102
  # Gets the processing report for a feed and its Content-MD5 header
103
103
  #
104
104
  # @see http://docs.developer.amazonservices.com/en_US/feeds/Feeds_GetFeedSubmissionResult.html
105
- # @param feed_submission_id [Integer, String]
105
+ # @param [Integer, String] feed_submission_id
106
106
  # @return [Peddler::XMLParser] if the report is in XML format
107
107
  # @return [Peddler::CSVParser] if the report is a flat file
108
108
  def get_feed_submission_result(feed_submission_id)
@@ -5,13 +5,13 @@ module MWS
5
5
  # With the MWS Finances API you can retrieve financial transactions for your
6
6
  # seller account.
7
7
  class Client < ::Peddler::Client
8
- version "2015-05-01"
8
+ version '2015-05-01'
9
9
  path "/Finances/#{version}"
10
10
 
11
11
  # Lists financial events
12
12
  #
13
13
  # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEvents.html
14
- # @param opts [Hash]
14
+ # @param [Hash] opts
15
15
  # @option opts [Integer] :max_results_per_page
16
16
  # @option opts [String] :amazon_order_id
17
17
  # @option opts [String] :financial_event_group_id
@@ -26,7 +26,7 @@ module MWS
26
26
  # Lists the next page of financial events
27
27
  #
28
28
  # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEventGroupsByNextToken.html
29
- # @param next_token [String]
29
+ # @param [String] next_token
30
30
  # @return [Peddler::XMLParser]
31
31
  def list_financial_events_by_next_token(next_token)
32
32
  operation('ListFinancialEventsByNextToken')
@@ -38,8 +38,8 @@ module MWS
38
38
  # Lists financial event groups
39
39
  #
40
40
  # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEventGroups.html
41
- # @param financial_event_group_started_after [String, #iso8601]
42
- # @param opts [Hash]
41
+ # @param [String, #iso8601] financial_event_group_started_after
42
+ # @param [Hash] opts
43
43
  # @option opts [Integer] :max_results_per_page
44
44
  # @option opts [String, #iso8601] :financial_event_group_started_before
45
45
  # @return [Peddler::XMLParser]
@@ -54,7 +54,7 @@ module MWS
54
54
  # Lists the next page of financial event groups
55
55
  #
56
56
  # @see http://docs.developer.amazonservices.com/en_US/finances/Finances_ListFinancialEventGroupsByNextToken.html
57
- # @param next_token [String]
57
+ # @param [String] next_token
58
58
  # @return [Peddler::XMLParser]
59
59
  def list_financial_event_groups_by_next_token(next_token)
60
60
  operation('ListFinancialEventGroupsByNextToken')
@@ -7,15 +7,15 @@ module MWS
7
7
  # also request lists of inbound shipments or inbound shipment items based on
8
8
  # criteria that you specify.
9
9
  class Client < ::Peddler::Client
10
- version "2010-10-01"
10
+ version '2010-10-01'
11
11
  path "/FulfillmentInboundShipment/#{version}"
12
12
 
13
13
  # Returns the information required to create an inbound shipment
14
14
  #
15
15
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_CreateInboundShipmentPlan.html
16
- # @param ship_from_address [Struct, Hash]
17
- # @param inbound_shipment_plan_request_items [Array<Struct, Hash>]
18
- # @param opts [Hash]
16
+ # @param [Struct, Hash] ship_from_address
17
+ # @param [Array<Struct, Hash>] inbound_shipment_plan_request_items
18
+ # @param [Hash] opts
19
19
  # @option opts [String] :label_prep_preference
20
20
  # @return [Peddler::XMLParser]
21
21
  def create_inbound_shipment_plan(ship_from_address, inbound_shipment_plan_request_items, opts = {})
@@ -32,48 +32,36 @@ module MWS
32
32
  # Creates an inbound shipment
33
33
  #
34
34
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_CreateInboundShipment.html
35
- # @param shipment_id [String]
36
- # @param inbound_shipment_header [Struct, Hash]
37
- # @param opts [Hash]
35
+ # @param [String] shipment_id
36
+ # @param [Struct, Hash] inbound_shipment_header
37
+ # @param [Hash] opts
38
38
  # @option opts [Array<Struct, Hash>] :inbound_shipment_items
39
39
  # @return [Peddler::XMLParser]
40
40
  def create_inbound_shipment(shipment_id, inbound_shipment_header, opts = {})
41
- operation('CreateInboundShipment')
42
- .add(opts.update(
43
- 'ShipmentId' => shipment_id,
44
- 'InboundShipmentHeader' => inbound_shipment_header
45
- ))
46
- .structure!('InboundShipmentItems', 'member')
47
-
41
+ build_inbound_shipment_operation('CreateInboundShipment', shipment_id, inbound_shipment_header, opts)
48
42
  run
49
43
  end
50
44
 
51
45
  # Updates an existing inbound shipment
52
46
  #
53
47
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_UpdateInboundShipment.html
54
- # @param shipment_id [String]
55
- # @param inbound_shipment_header [Struct, Hash]
56
- # @param opts [Hash]
48
+ # @param [String] shipment_id
49
+ # @param [Struct, Hash] inbound_shipment_header
50
+ # @param [Hash] opts
57
51
  # @option opts [Array<Struct, Hash>] :inbound_shipment_items
58
52
  # @return [Peddler::XMLParser]
59
53
  def update_inbound_shipment(shipment_id, inbound_shipment_header, opts = {})
60
- operation('UpdateInboundShipment')
61
- .add(opts.update(
62
- 'ShipmentId' => shipment_id,
63
- 'InboundShipmentHeader' => inbound_shipment_header
64
- ))
65
- .structure!('InboundShipmentItems', 'member')
66
-
54
+ build_inbound_shipment_operation('UpdateInboundShipment', shipment_id, inbound_shipment_header, opts)
67
55
  run
68
56
  end
69
57
 
70
58
  # Sends transportation information to Amazon about an inbound shipment
71
59
  #
72
60
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_PutTransportContent.html
73
- # @param shipment_id [String]
74
- # @param is_partnered [Boolean]
75
- # @param shipment_type [String]
76
- # @param transport_details [Struct, Hash]
61
+ # @param [String] shipment_id
62
+ # @param [Boolean] is_partnered
63
+ # @param [String] shipment_type
64
+ # @param [Struct, Hash] transport_details
77
65
  # @return [Peddler::XMLParser]
78
66
  def put_transport_content(shipment_id, is_partnered, shipment_type, transport_details)
79
67
  operation('PutTransportContent')
@@ -91,7 +79,7 @@ module MWS
91
79
  # Requests an estimate of the shipping cost for an inbound shipment
92
80
  #
93
81
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_EstimateTransportRequest.html
94
- # @param shipment_id [String]
82
+ # @param [String] shipment_id
95
83
  # @return [Peddler::XMLParser]
96
84
  def estimate_transport_request(shipment_id)
97
85
  operation('EstimateTransportRequest').add('ShipmentId' => shipment_id)
@@ -101,7 +89,7 @@ module MWS
101
89
  # Returns current transportation information about an inbound shipment
102
90
  #
103
91
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetTransportContent.html
104
- # @param shipment_id [String]
92
+ # @param [String] shipment_id
105
93
  # @return [Peddler::XMLParser]
106
94
  def get_transport_content(shipment_id)
107
95
  operation('GetTransportContent').add('ShipmentId' => shipment_id)
@@ -112,7 +100,7 @@ module MWS
112
100
  # request that the Amazon-partnered carrier ship your inbound shipment
113
101
  #
114
102
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_ConfirmTransportRequest.html
115
- # @param shipment_id [String]
103
+ # @param [String] shipment_id
116
104
  # @return [Peddler::XMLParser]
117
105
  def confirm_transport_request(shipment_id)
118
106
  operation('ConfirmTransportRequest').add('ShipmentId' => shipment_id)
@@ -123,7 +111,7 @@ module MWS
123
111
  # an Amazon-partnered carrier
124
112
  #
125
113
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_VoidTransportRequest.html
126
- # @param shipment_id [String]
114
+ # @param [String] shipment_id
127
115
  # @return [Peddler::XMLParser]
128
116
  def void_transport_request(shipment_id)
129
117
  operation('VoidTransportRequest').add('ShipmentId' => shipment_id)
@@ -134,9 +122,9 @@ module MWS
134
122
  # shipment
135
123
  #
136
124
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetPackageLabels.html
137
- # @param shipment_id [String]
138
- # @param page_type [String]
139
- # @param opts [Hash]
125
+ # @param [String] shipment_id
126
+ # @param [String] page_type
127
+ # @param [Hash] opts
140
128
  # @option opts [Integer] :number_of_packages
141
129
  # @return [Peddler::XMLParser]
142
130
  def get_package_labels(shipment_id, page_type, opts = {})
@@ -153,7 +141,7 @@ module MWS
153
141
  # shipment
154
142
  #
155
143
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetBillOfLading.html
156
- # @param shipment_id [String]
144
+ # @param [String] shipment_id
157
145
  # @return [Peddler::XMLParser]
158
146
  def get_bill_of_lading(shipment_id)
159
147
  operation('GetBillOfLading').add('ShipmentId' => shipment_id)
@@ -163,7 +151,7 @@ module MWS
163
151
  # Returns a list of inbound shipments based on criteria that you specify
164
152
  #
165
153
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_ListInboundShipments.html
166
- # @param opts [Hash]
154
+ # @param [Hash] opts
167
155
  # @option opts [Array<String>] :shipment_status_list
168
156
  # @option opts [Array<String>] :shipment_id_list
169
157
  # @option opts [String, #iso8601] :last_updated_after
@@ -181,7 +169,7 @@ module MWS
181
169
  # Returns the next page of inbound shipments
182
170
  #
183
171
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_ListInboundShipmentsByNextToken.html
184
- # @param next_token [String]
172
+ # @param [String] next_token
185
173
  # @return [Peddler::XMLParser]
186
174
  def list_inbound_shipments_by_next_token(next_token)
187
175
  operation('ListInboundShipmentsByNextToken')
@@ -194,7 +182,7 @@ module MWS
194
182
  # items that were updated within a specified time frame
195
183
  #
196
184
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_ListInboundShipmentItems.html
197
- # @param opts [Hash]
185
+ # @param [Hash] opts
198
186
  # @option opts [String] :shipment_id
199
187
  # @option opts [String, #iso8601] :last_updated_after
200
188
  # @option opts [String, #iso8601] :last_updated_before
@@ -207,7 +195,7 @@ module MWS
207
195
  # Returns the next page of inbound shipment items
208
196
  #
209
197
  # @see http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_ListInboundShipmentItemsByNextToken.html
210
- # @param next_token [String]
198
+ # @param [String] next_token
211
199
  # @return [Peddler::XMLParser]
212
200
  def list_inbound_shipment_items_by_next_token(next_token)
213
201
  operation('ListInboundShipmentItemsByNextToken')
@@ -224,6 +212,19 @@ module MWS
224
212
  operation('GetServiceStatus')
225
213
  run
226
214
  end
215
+
216
+ private
217
+
218
+ def build_inbound_shipment_operation(operation_name, shipment_id, inbound_shipment_header, opts)
219
+ operation(operation_name)
220
+ .add(
221
+ opts.update(
222
+ 'ShipmentId' => shipment_id,
223
+ 'InboundShipmentHeader' => inbound_shipment_header
224
+ )
225
+ )
226
+ .structure!('InboundShipmentItems', 'member')
227
+ end
227
228
  end
228
229
  end
229
230
  end