amzn_sp_api 1.0.2 → 1.0.3

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: 76cdfd92890daa750d0c3074bb7a4bc38706737f12e5a468e117c1cceb5d28bb
4
+ data.tar.gz: 92c9f9407dc9433a4b94c7db359b00d953a9f1965aba1dfe5279e7391409d21b
5
5
  SHA512:
6
- metadata.gz: 5fa6d95db9b0fa85a43855f28178b28984e5447de1355dfe7dde907426137366eaff59ffb79baaf8087039d65e31c8ada1d70275118dbe0570be5b7ad8b958fd
7
- data.tar.gz: 730ebd84560cf052abcdd72db224065c22bc3a349f2c2ab339587ae2453a3885be09f429ae5ec09351c41473faefdca37ef91f2add89c0db5d32bb2d1c5a1b99
6
+ metadata.gz: 2337ed9076bf22bc78537b6a0302f9d2f930c4f33ffe8cc098b12adc02609da2e4d47498003a65373e08d68051e56ca78e62679b152111a21bbead3b65d32b87
7
+ data.tar.gz: 692c1ad7fd081312435d557c64c884fcaa38efabebdc6c166695a93ac2736240180dc4e247b50652ab7f56a85492b4ef97cba50b14044b796f0a24fcefa2bbd7
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.3)
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.3'
3
3
  end
@@ -39,16 +39,19 @@ 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
46
  client_secret: config.client_secret,
48
47
  scope: config.scope
49
48
  }
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')
49
+ scope = config.grant_type == 'client_credentials' ? AmznSpApi::SpApiConfiguration::SCOPE : nil
50
+ form_params.merge!(scope: scope) if scope
51
+ data, status_code, headers = new_access_token.super_call_api(:POST, '/auth/o2/token',
52
+ header_params: header_params,
53
+ form_params: form_params,
54
+ return_type: 'Object')
52
55
 
53
56
  raise ApiError.new(code: status_code, response_headers: headers, response_body: data) unless data && data[:access_token]
54
57
 
@@ -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.3
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