amzn_sp_api 1.0.2 → 1.0.4

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
  SHA256:
3
- metadata.gz: a479c21b1f86bf4691e808b07cd8d6f8c1e07279f386af90ed47b7cd1e879981
4
- data.tar.gz: 03005c132e4945257e0e56552814c7a7021b6cecd18976d61056e85f7e4bf2d6
3
+ metadata.gz: 80bf8688bea76df9b46709937b61318268d7c6e3e99b1ba9714dc395df0f6330
4
+ data.tar.gz: 7b87948a0b39c30d971eaa5e6f0e4cb9840fc5f755287fcd0f47948f25bfe129
5
5
  SHA512:
6
- metadata.gz: 5fa6d95db9b0fa85a43855f28178b28984e5447de1355dfe7dde907426137366eaff59ffb79baaf8087039d65e31c8ada1d70275118dbe0570be5b7ad8b958fd
7
- data.tar.gz: 730ebd84560cf052abcdd72db224065c22bc3a349f2c2ab339587ae2453a3885be09f429ae5ec09351c41473faefdca37ef91f2add89c0db5d32bb2d1c5a1b99
6
+ metadata.gz: ac3aa7cb6409122edfd5b15ac522d2c5445f07a01100ab5bb46dbea99ff064989753a8bb1ec3b917f4837af75299eddecedc8fa386835844b5097119e0e40fa0
7
+ data.tar.gz: 9014c07ec0c9958f1136040b3f1f45c8bc158290b93febcedf6b5a45cbd12d5a5bbf468c41005fc1860418822f633adf7aa9da7e29775c4e877dfdf4aca3892f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- amzn_sp_api (1.0.2)
4
+ amzn_sp_api (1.0.4)
5
5
  aws-sigv4 (~> 1.5)
6
6
  json (~> 2.6)
7
7
  typhoeus (~> 1.4)
@@ -13,7 +13,6 @@ GEM
13
13
  aws-eventstream (1.2.0)
14
14
  aws-sigv4 (1.5.2)
15
15
  aws-eventstream (~> 1, >= 1.0.2)
16
- diff-lcs (1.5.0)
17
16
  ethon (0.16.0)
18
17
  ffi (>= 1.15.0)
19
18
  ffi (1.15.5)
@@ -25,19 +24,6 @@ GEM
25
24
  rake (13.0.6)
26
25
  regexp_parser (2.7.0)
27
26
  rexml (3.2.5)
28
- rspec (3.11.0)
29
- rspec-core (~> 3.11.0)
30
- rspec-expectations (~> 3.11.0)
31
- rspec-mocks (~> 3.11.0)
32
- rspec-core (3.11.0)
33
- rspec-support (~> 3.11.0)
34
- rspec-expectations (3.11.0)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.11.0)
37
- rspec-mocks (3.11.1)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.11.0)
40
- rspec-support (3.11.0)
41
27
  rubocop (1.49.0)
42
28
  json (~> 2.3)
43
29
  parallel (~> 1.10)
@@ -62,7 +48,6 @@ PLATFORMS
62
48
  DEPENDENCIES
63
49
  amzn_sp_api!
64
50
  rake (~> 13.0)
65
- rspec (~> 3.0)
66
51
  rubocop (~> 1.49)
67
52
 
68
53
  BUNDLED WITH
data/Rakefile CHANGED
@@ -1,6 +1 @@
1
1
  require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
data/amzn_sp_api.gemspec CHANGED
@@ -18,8 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.add_runtime_dependency 'json', '~> 2.6'
19
19
  spec.add_runtime_dependency 'typhoeus', '~> 1.4'
20
20
 
21
- spec.add_development_dependency 'rspec', '~> 3.0'
22
-
23
21
  # Specify which files should be added to the gem when it is released.
24
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
23
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
@@ -1,3 +1,3 @@
1
1
  module AmznSpApi
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -39,16 +39,18 @@ module AmznSpApi
39
39
  new_access_token.config.host = 'api.amazon.com'
40
40
 
41
41
  header_params = { 'Content-Type' => 'application/x-www-form-urlencoded' }
42
- grant_type = config.scope.present? ? 'client_credentials' : 'refresh_token'
43
42
  form_params = {
44
- grant_type: grant_type,
43
+ grant_type: config.grant_type,
45
44
  refresh_token: config.refresh_token,
46
45
  client_id: config.client_id,
47
- client_secret: config.client_secret,
48
- scope: config.scope
46
+ client_secret: config.client_secret
49
47
  }
50
- data, status_code, headers = new_access_token.super_call_api(:POST, '/auth/o2/token', header_params: header_params,
51
- form_params: form_params, return_type: 'Object')
48
+ scope = config.grant_type == 'client_credentials' ? AmznSpApi::SpApiConfiguration::SCOPE : nil
49
+ form_params.merge!(scope: scope) if scope
50
+ data, status_code, headers = new_access_token.super_call_api(:POST, '/auth/o2/token',
51
+ header_params: header_params,
52
+ form_params: form_params,
53
+ return_type: 'Object')
52
54
 
53
55
  raise ApiError.new(code: status_code, response_headers: headers, response_body: data) unless data && data[:access_token]
54
56
 
@@ -43,10 +43,7 @@ module AmznSpApi
43
43
  attr_accessor :get_access_token
44
44
 
45
45
  # from https://developer-docs.amazon.com/sp-api/docs/connecting-to-the-selling-partner-api#step-1-request-a-login-with-amazon-access-token
46
- SCOPE = {
47
- 'client_credentials' => 'sellingpartnerapi::notifications',
48
- 'refresh_token' => 'sellingpartnerapi::migration'
49
- }.freeze
46
+ SCOPE = %w[sellingpartnerapi::notifications sellingpartnerapi::migration]
50
47
 
51
48
  # from https://developer-docs.amazon.com/sp-api/docs/sp-api-endpoints
52
49
  AWS_REGION_MAP = {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amzn_sp_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - zevinto
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.4'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
55
  description: Ruby Gem for Amazon Selling Partner API (SP-API).
70
56
  email:
71
57
  - aarontzf@163.com