amzn_sp_api 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f1b9dfde3c75d07c2a76693888913160222066f2c31fede720af510bcf7346ee
|
|
4
|
+
data.tar.gz: a613ae63a0917235adc069b61b5d0f7dcadfcb43a3b5ac5ce2dc7c42354c7fa1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e59e68086459de5aa0914c253caacd15587ad0d87f2e00eb549f7516f06ad9e9664d1f5cf9be29a9b1a7d0367ffb1974fd0a54c1dadf0e6113e43b384161153
|
|
7
|
+
data.tar.gz: a655720eb4b4e7674966bb546f7eb247fa4e8f58649c2b43b4c0fafa11480fe73e065b48e05b069713d98fbfc3839f640ed661a5715ba0998cee496ede949383
|
data/Gemfile.lock
CHANGED
|
@@ -39,11 +39,13 @@ 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'
|
|
42
43
|
form_params = {
|
|
43
|
-
grant_type:
|
|
44
|
+
grant_type: grant_type,
|
|
44
45
|
refresh_token: config.refresh_token,
|
|
45
46
|
client_id: config.client_id,
|
|
46
|
-
client_secret: config.client_secret
|
|
47
|
+
client_secret: config.client_secret,
|
|
48
|
+
scope: config.scope
|
|
47
49
|
}
|
|
48
50
|
data, status_code, headers = new_access_token.super_call_api(:POST, '/auth/o2/token', header_params: header_params,
|
|
49
51
|
form_params: form_params, return_type: 'Object')
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
require 'amzn_sp_api/configuration'
|
|
2
2
|
|
|
3
|
+
# from https://developer-docs.amazon.com/sp-api/docs/connecting-to-the-selling-partner-api
|
|
3
4
|
module AmznSpApi
|
|
4
5
|
class SpApiConfiguration < Configuration
|
|
6
|
+
# The type of access grant requested.
|
|
7
|
+
# @values: refresh_token Use this for calling operations that require authorization from a selling partner. All operations that are not grantless operations require authorization from a selling partner. When specifying this value, include the refresh_token parameter.
|
|
8
|
+
# @values: client_credentials Use this for calling grantless operations. When specifying this value, include the parameter.scope
|
|
9
|
+
attr_accessor :grant_type
|
|
10
|
+
|
|
5
11
|
# The LWA refresh token.
|
|
6
12
|
attr_accessor :refresh_token
|
|
7
13
|
|
|
14
|
+
# The scope of the LWA authorization grant.
|
|
15
|
+
# @values: sellingpartnerapi::notifications. For the Notifications API.
|
|
16
|
+
# @values: sellingpartnerapi::migration. For the Authorization API.
|
|
17
|
+
attr_accessor :scope
|
|
18
|
+
|
|
8
19
|
# The LWA client identifier.
|
|
9
20
|
attr_accessor :client_id
|
|
10
21
|
|
|
@@ -31,6 +42,12 @@ module AmznSpApi
|
|
|
31
42
|
|
|
32
43
|
attr_accessor :get_access_token
|
|
33
44
|
|
|
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
|
+
'refresh_token' => 'sellingpartnerapi::notifications',
|
|
48
|
+
'client_credentials' => 'sellingpartnerapi::migration'
|
|
49
|
+
}.freeze
|
|
50
|
+
|
|
34
51
|
# from https://developer-docs.amazon.com/sp-api/docs/sp-api-endpoints
|
|
35
52
|
AWS_REGION_MAP = {
|
|
36
53
|
'na' => 'us-east-1',
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: amzn_sp_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- zevinto
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sigv4
|