peddler 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2fda364caab5a2dd886b3dc27ee533ef1ebe88c
4
- data.tar.gz: 4c10ecc9abeaf5b2fb2f0883743addb18a80aa18
3
+ metadata.gz: 80de0545c1934c7822c0f171030021c07b60674b
4
+ data.tar.gz: e5b0b2be8a18c782155bf2610252496e6064f7fc
5
5
  SHA512:
6
- metadata.gz: 4de0c5df57c677c512227423b6fb5853074d142b596419443738e6efb0e2510b3d299a7e583660c3400710f58363057e04fa3329091a61466a73d9d5d4611cf5
7
- data.tar.gz: fa7753961a74ba664c2101993c7de4836e92b2003081fe1da931e4f076dad0a6c9c78120b9ed232b36c7b3f903df847ccaa1a9d49db9751860da95e08ed96a69
6
+ metadata.gz: cc9acc0a7af48f49eefdb4761e3defd3b0b78297120f0872450109b2dfd2f5427d4cbadd5f17e58bec94f4b54fba1edc323425158fbcf21e36ef73168c660b35
7
+ data.tar.gz: 441cd41ff151ce347aa69b726dc01b64e349eb6a8c48d6fefdb38ba11c8fbfa77fdb8ab47ab2e1d9eecc4d614b9efa6b83e229a000a3bb6c081b6372a63015a7
data/README.md CHANGED
@@ -43,6 +43,18 @@ export AWS_ACCESS_KEY_ID=...
43
43
  export AWS_SECRET_ACCESS_KEY=...
44
44
  ```
45
45
 
46
+ ### MWS Authorized Tokens
47
+
48
+ If instantiating a client for another seller, you have to provide the `MWSAuthToken` generated for you by the latter:
49
+
50
+ ```ruby
51
+ client = MWS.orders(
52
+ marketplace_id: "...",
53
+ merchant_id: "...",
54
+ auth_token: "..."
55
+ )
56
+ ```
57
+
46
58
  ## Usage
47
59
 
48
60
  ### Cart Information
@@ -37,6 +37,15 @@ module MWS
37
37
  operation('GetServiceStatus')
38
38
  run
39
39
  end
40
+
41
+ # Gets the MWS Auth Token of the seller account
42
+ #
43
+ # @see http://docs.developer.amazonservices.com/en_US/auth_token/AuthToken_GetAuthToken.html
44
+ # @return [Peddler::XMLParser]
45
+ def get_auth_token
46
+ operation('GetAuthToken')
47
+ run
48
+ end
40
49
  end
41
50
  end
42
51
  end
@@ -10,6 +10,7 @@ module Peddler
10
10
  extend Forwardable
11
11
  include Jeff
12
12
 
13
+ attr_accessor :auth_token
13
14
  attr_writer :merchant_id, :marketplace_id, :path
14
15
  attr_reader :body
15
16
 
@@ -17,7 +18,10 @@ module Peddler
17
18
 
18
19
  def_delegators :marketplace, :host, :encoding
19
20
 
20
- params('SellerId' => -> { merchant_id })
21
+ params(
22
+ 'SellerId' => -> { merchant_id },
23
+ 'MWSAuthToken' => -> { auth_token }
24
+ )
21
25
 
22
26
  def self.parser
23
27
  @parser ||= Parser
@@ -1,3 +1,3 @@
1
1
  module Peddler
2
- VERSION = '0.11.1'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -8,4 +8,11 @@ class TestSellers < IntegrationTest
8
8
  refute_empty res.parse
9
9
  end
10
10
  end
11
+
12
+ def test_get_auth_token
13
+ clients.each do |client|
14
+ res = client.get_auth_token
15
+ refute_empty res.parse
16
+ end
17
+ end
11
18
  end
@@ -37,13 +37,12 @@ VCR.configure do |c|
37
37
  'CreatedAfter', 'QueryStartDateTime'
38
38
  )
39
39
  c.default_cassette_options = {
40
- match_requests_on: [:method, matcher],
40
+ match_requests_on: [:host, :path, matcher],
41
41
  record: :none
42
42
  }
43
43
 
44
44
  IntegrationTest::ACCOUNTS.each do |account|
45
45
  c.filter_sensitive_data('MERCHANT_ID') { account.fetch('merchant_id') }
46
- c.filter_sensitive_data('AWS_SECRET_ACCESS_KEY') { account.fetch('aws_secret_access_key') }
47
46
  c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { account.fetch('aws_access_key_id') }
48
47
  end
49
48
  end
@@ -51,6 +51,14 @@ class TestPeddlerClient < MiniTest::Test
51
51
  assert_equal Peddler::Client.params, @klass.params
52
52
  end
53
53
 
54
+ def test_params_include_seller_id
55
+ assert @klass.params.key?("SellerId")
56
+ end
57
+
58
+ def test_params_include_auth_token
59
+ @klass.params.key?("MWSAuthToken")
60
+ end
61
+
54
62
  def test_configures
55
63
  @client.configure do |config|
56
64
  config.aws_access_key_id = '123'
@@ -182,4 +182,208 @@ http_interactions:
182
182
  </GetServiceStatusResponse>
183
183
  http_version:
184
184
  recorded_at: Tue, 12 Aug 2014 11:46:30 GMT
185
- recorded_with: VCR 2.9.2
185
+ - request:
186
+ method: post
187
+ uri: https://mws.amazonservices.ca/Sellers/2011-07-01?AWSAccessKeyId=AWS_ACCESS_KEY_ID&Action=GetAuthToken&SellerId=MERCHANT_ID&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-01-23T22%3A54%3A53Z&Signature=c2dj8ajtyrmxd31IFL%2FJ%2FbobjeGd4MafnQkPhbxJDSc%3D
188
+ body:
189
+ encoding: US-ASCII
190
+ string: ''
191
+ headers:
192
+ User-Agent:
193
+ - Jeff/1.2.0 (Language=Ruby; pdeazeta.home)
194
+ response:
195
+ status:
196
+ code: 200
197
+ message:
198
+ headers:
199
+ Date:
200
+ - Fri, 23 Jan 2015 22:54:54 GMT
201
+ Server:
202
+ - AmazonMWS
203
+ x-amzn-Authorization:
204
+ - AAA identity=com.amazon.aaa.MarketplaceWebServiceSellers.AndromedaControlService.amzn1.aaa.id.lwigtwr3h4inoeknjer76q4tl4.Default/1,
205
+ Encrypted=false, SignedHeaders=X-Amz-Date, Algorithm=HmacSHA256, Signed=true,
206
+ Signature=EgdkRiiJN2hX3S7CNkXmrAdX0DIfo3qciDQmhuXvtT8=
207
+ X-Amz-Date:
208
+ - Fri, 23 Jan 2015 22:54:55 GMT
209
+ x-mws-request-id:
210
+ - 0bbe3825-49e6-40d2-ad15-9f700a065aad
211
+ x-mws-timestamp:
212
+ - '2015-01-23T22:54:55.451Z'
213
+ x-mws-response-context:
214
+ - yTHwX3WT+3pj5v8KaKwLdQVR4/fif3KtfT8OPIvRkiAKY++eagEEBgh2u6A+EKjS7euy7l7kJhw=
215
+ Content-Type:
216
+ - text/xml
217
+ Content-Length:
218
+ - '399'
219
+ Vary:
220
+ - User-Agent
221
+ body:
222
+ encoding: UTF-8
223
+ string: |
224
+ <?xml version="1.0"?>
225
+ <GetAuthTokenResponse xmlns="https://mws.amazonservices.com/Sellers/2011-07-01">
226
+ <GetAuthTokenResult>
227
+ <SellerId>MERCHANT_ID</SellerId>
228
+ <MWSAuthToken>MWS_AUTH_TOKEN</MWSAuthToken>
229
+ </GetAuthTokenResult>
230
+ <ResponseMetadata>
231
+ <RequestId>0bbe3825-49e6-40d2-ad15-9f700a065aad</RequestId>
232
+ </ResponseMetadata>
233
+ </GetAuthTokenResponse>
234
+ http_version:
235
+ recorded_at: Fri, 23 Jan 2015 22:54:55 GMT
236
+ - request:
237
+ method: post
238
+ uri: https://mws-eu.amazonservices.com/Sellers/2011-07-01?AWSAccessKeyId=AWS_ACCESS_KEY_ID&Action=GetAuthToken&SellerId=MERCHANT_ID&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-01-23T22%3A54%3A53Z&Signature=c2dj8ajtyrmxd31IFL%2FJ%2FbobjeGd4MafnQkPhbxJDSc%3D
239
+ body:
240
+ encoding: US-ASCII
241
+ string: ''
242
+ headers:
243
+ User-Agent:
244
+ - Jeff/1.2.0 (Language=Ruby; pdeazeta.home)
245
+ response:
246
+ status:
247
+ code: 200
248
+ message:
249
+ headers:
250
+ Date:
251
+ - Fri, 23 Jan 2015 22:54:54 GMT
252
+ Server:
253
+ - AmazonMWS
254
+ x-amzn-Authorization:
255
+ - AAA identity=com.amazon.aaa.MarketplaceWebServiceSellers.AndromedaControlService.amzn1.aaa.id.lwigtwr3h4inoeknjer76q4tl4.Default/1,
256
+ Encrypted=false, SignedHeaders=X-Amz-Date, Algorithm=HmacSHA256, Signed=true,
257
+ Signature=EgdkRiiJN2hX3S7CNkXmrAdX0DIfo3qciDQmhuXvtT8=
258
+ X-Amz-Date:
259
+ - Fri, 23 Jan 2015 22:54:55 GMT
260
+ x-mws-request-id:
261
+ - 0bbe3825-49e6-40d2-ad15-9f700a065aad
262
+ x-mws-timestamp:
263
+ - '2015-01-23T22:54:55.451Z'
264
+ x-mws-response-context:
265
+ - yTHwX3WT+3pj5v8KaKwLdQVR4/fif3KtfT8OPIvRkiAKY++eagEEBgh2u6A+EKjS7euy7l7kJhw=
266
+ Content-Type:
267
+ - text/xml
268
+ Content-Length:
269
+ - '399'
270
+ Vary:
271
+ - User-Agent
272
+ body:
273
+ encoding: UTF-8
274
+ string: |
275
+ <?xml version="1.0"?>
276
+ <GetAuthTokenResponse xmlns="https://mws.amazonservices.com/Sellers/2011-07-01">
277
+ <GetAuthTokenResult>
278
+ <SellerId>MERCHANT_ID</SellerId>
279
+ <MWSAuthToken>MWS_AUTH_TOKEN</MWSAuthToken>
280
+ </GetAuthTokenResult>
281
+ <ResponseMetadata>
282
+ <RequestId>0bbe3825-49e6-40d2-ad15-9f700a065aad</RequestId>
283
+ </ResponseMetadata>
284
+ </GetAuthTokenResponse>
285
+ http_version:
286
+ recorded_at: Fri, 23 Jan 2015 22:54:55 GMT
287
+ - request:
288
+ method: post
289
+ uri: https://mws.amazonservices.jp/Sellers/2011-07-01?AWSAccessKeyId=AWS_ACCESS_KEY_ID&Action=GetAuthToken&SellerId=MERCHANT_ID&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-01-23T22%3A54%3A53Z&Signature=c2dj8ajtyrmxd31IFL%2FJ%2FbobjeGd4MafnQkPhbxJDSc%3D
290
+ body:
291
+ encoding: US-ASCII
292
+ string: ''
293
+ headers:
294
+ User-Agent:
295
+ - Jeff/1.2.0 (Language=Ruby; pdeazeta.home)
296
+ response:
297
+ status:
298
+ code: 200
299
+ message:
300
+ headers:
301
+ Date:
302
+ - Fri, 23 Jan 2015 22:54:54 GMT
303
+ Server:
304
+ - AmazonMWS
305
+ x-amzn-Authorization:
306
+ - AAA identity=com.amazon.aaa.MarketplaceWebServiceSellers.AndromedaControlService.amzn1.aaa.id.lwigtwr3h4inoeknjer76q4tl4.Default/1,
307
+ Encrypted=false, SignedHeaders=X-Amz-Date, Algorithm=HmacSHA256, Signed=true,
308
+ Signature=EgdkRiiJN2hX3S7CNkXmrAdX0DIfo3qciDQmhuXvtT8=
309
+ X-Amz-Date:
310
+ - Fri, 23 Jan 2015 22:54:55 GMT
311
+ x-mws-request-id:
312
+ - 0bbe3825-49e6-40d2-ad15-9f700a065aad
313
+ x-mws-timestamp:
314
+ - '2015-01-23T22:54:55.451Z'
315
+ x-mws-response-context:
316
+ - yTHwX3WT+3pj5v8KaKwLdQVR4/fif3KtfT8OPIvRkiAKY++eagEEBgh2u6A+EKjS7euy7l7kJhw=
317
+ Content-Type:
318
+ - text/xml
319
+ Content-Length:
320
+ - '399'
321
+ Vary:
322
+ - User-Agent
323
+ body:
324
+ encoding: UTF-8
325
+ string: |
326
+ <?xml version="1.0"?>
327
+ <GetAuthTokenResponse xmlns="https://mws.amazonservices.com/Sellers/2011-07-01">
328
+ <GetAuthTokenResult>
329
+ <SellerId>MERCHANT_ID</SellerId>
330
+ <MWSAuthToken>MWS_AUTH_TOKEN</MWSAuthToken>
331
+ </GetAuthTokenResult>
332
+ <ResponseMetadata>
333
+ <RequestId>0bbe3825-49e6-40d2-ad15-9f700a065aad</RequestId>
334
+ </ResponseMetadata>
335
+ </GetAuthTokenResponse>
336
+ http_version:
337
+ recorded_at: Fri, 23 Jan 2015 22:54:55 GMT
338
+ - request:
339
+ method: post
340
+ uri: https://mws.amazonservices.com/Sellers/2011-07-01?AWSAccessKeyId=AWS_ACCESS_KEY_ID&Action=GetAuthToken&SellerId=MERCHANT_ID&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-01-23T22%3A54%3A53Z&Signature=c2dj8ajtyrmxd31IFL%2FJ%2FbobjeGd4MafnQkPhbxJDSc%3D
341
+ body:
342
+ encoding: US-ASCII
343
+ string: ''
344
+ headers:
345
+ User-Agent:
346
+ - Jeff/1.2.0 (Language=Ruby; pdeazeta.home)
347
+ response:
348
+ status:
349
+ code: 200
350
+ message:
351
+ headers:
352
+ Date:
353
+ - Fri, 23 Jan 2015 22:54:54 GMT
354
+ Server:
355
+ - AmazonMWS
356
+ x-amzn-Authorization:
357
+ - AAA identity=com.amazon.aaa.MarketplaceWebServiceSellers.AndromedaControlService.amzn1.aaa.id.lwigtwr3h4inoeknjer76q4tl4.Default/1,
358
+ Encrypted=false, SignedHeaders=X-Amz-Date, Algorithm=HmacSHA256, Signed=true,
359
+ Signature=EgdkRiiJN2hX3S7CNkXmrAdX0DIfo3qciDQmhuXvtT8=
360
+ X-Amz-Date:
361
+ - Fri, 23 Jan 2015 22:54:55 GMT
362
+ x-mws-request-id:
363
+ - 0bbe3825-49e6-40d2-ad15-9f700a065aad
364
+ x-mws-timestamp:
365
+ - '2015-01-23T22:54:55.451Z'
366
+ x-mws-response-context:
367
+ - yTHwX3WT+3pj5v8KaKwLdQVR4/fif3KtfT8OPIvRkiAKY++eagEEBgh2u6A+EKjS7euy7l7kJhw=
368
+ Content-Type:
369
+ - text/xml
370
+ Content-Length:
371
+ - '399'
372
+ Vary:
373
+ - User-Agent
374
+ body:
375
+ encoding: UTF-8
376
+ string: |
377
+ <?xml version="1.0"?>
378
+ <GetAuthTokenResponse xmlns="https://mws.amazonservices.com/Sellers/2011-07-01">
379
+ <GetAuthTokenResult>
380
+ <SellerId>MERCHANT_ID</SellerId>
381
+ <MWSAuthToken>MWS_AUTH_TOKEN</MWSAuthToken>
382
+ </GetAuthTokenResult>
383
+ <ResponseMetadata>
384
+ <RequestId>0bbe3825-49e6-40d2-ad15-9f700a065aad</RequestId>
385
+ </ResponseMetadata>
386
+ </GetAuthTokenResponse>
387
+ http_version:
388
+ recorded_at: Fri, 23 Jan 2015 22:54:55 GMT
389
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: peddler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-06 00:00:00.000000000 Z
11
+ date: 2015-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jeff
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_xml
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ files:
126
126
  - test/vcr_cassettes/Sellers.yml
127
127
  - test/vcr_cassettes/Subscriptions.yml
128
128
  - test/vcr_cassettes/Webstore.yml
129
- homepage: http://github.com/hakanensari/peddler
129
+ homepage: https://github.com/hakanensari/peddler
130
130
  licenses:
131
131
  - MIT
132
132
  metadata: {}