muffin_man 2.4.12 → 2.4.14
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +1 -6
- data/lib/muffin_man/finances/v20240619.rb +1 -1
- data/lib/muffin_man/sp_api_client.rb +2 -32
- data/lib/muffin_man/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93b2373ab6e23551491aa386a651c003a7a936831b2423a78239dab3e7386360
|
4
|
+
data.tar.gz: 0f1a5876afead341f4dfe6a16500a863de0124e968a2e9921c6ccf5e1ebd6e6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f52160b821f2eb65ba93e4e25550fe33079f62760426ca10519d20464f6ba9439fac5900645d6e89b89ac29af8e1761bf0f0075532d424f054ed808972b5d427
|
7
|
+
data.tar.gz: d2c316e85239e2cbb37413d5c92964e2f831850a12e36db7ec7e2a55ff6e07cc03d06df763c19b8da72c6edcfbaff8df3eb62cd590883ca4749d5feaa44bd8b7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 2.4.14
|
2
|
+
|
3
|
+
- Fixed query params of Amazon Finances API v2024-06-19 [#98](https://github.com/patterninc/muffin_man/pull/98)
|
4
|
+
- [#99](https://github.com/patterninc/muffin_man/pull/99)
|
5
|
+
|
6
|
+
# 2.4.13
|
7
|
+
|
8
|
+
- Remove AWS STS Signature in requests [#97](https://github.com/patterninc/muffin_man/pull/97)
|
9
|
+
|
1
10
|
# 2.4.12
|
2
11
|
|
3
12
|
- [#95](https://github.com/patterninc/muffin_man/pull/95)
|
data/README.md
CHANGED
@@ -39,6 +39,7 @@ As of now, this gem only supports portions of the following APIs with more to co
|
|
39
39
|
- `Uploads API v2020-11-01`
|
40
40
|
- `A+ API v2020-11-01`
|
41
41
|
- `Application Management API v2023-11-30`
|
42
|
+
- `Finances API v2024-06-19`
|
42
43
|
|
43
44
|
## Installation
|
44
45
|
|
@@ -66,10 +67,7 @@ credentials = {
|
|
66
67
|
refresh_token: LWA_REFRESH_TOKEN,
|
67
68
|
client_id: CLIENT_ID,
|
68
69
|
client_secret: CLIENT_SECRET,
|
69
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID,
|
70
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY,
|
71
70
|
region: REGION, # This can be one of ['na', 'eu', 'fe'] and defaults to 'na'
|
72
|
-
sts_iam_role_arn: STS_IAM_ROLE_ARN, # Optional
|
73
71
|
access_token_cache_key: SELLING_PARTNER_ID, # Optional if you want access token caching
|
74
72
|
}
|
75
73
|
client = MuffinMan::Solicitations::V1.new(credentials)
|
@@ -115,9 +113,6 @@ To retrieve the refresh token from an LWA Website authorization workflow, you ca
|
|
115
113
|
credentials = {
|
116
114
|
client_id: CLIENT_ID,
|
117
115
|
client_secret: CLIENT_SECRET,
|
118
|
-
aws_access_key_id: AWS_ACCESS_KEY_ID,
|
119
|
-
aws_secret_access_key: AWS_SECRET_ACCESS_KEY,
|
120
|
-
sts_iam_role_arn: STS_IAM_ROLE_ARN, # Optional
|
121
116
|
scope: 'sellingpartnerapi::migration' # Grantless scope for MWS migration
|
122
117
|
}
|
123
118
|
client = MuffinMan::Authorization::V1.new(credentials)
|
@@ -8,7 +8,7 @@ module MuffinMan
|
|
8
8
|
@query_params = {
|
9
9
|
"postedAfter" => posted_after
|
10
10
|
}
|
11
|
-
@query_params["
|
11
|
+
@query_params["postedBefore"] = posted_before unless posted_before.nil?
|
12
12
|
@query_params["marketplaceId"] = marketplace_id unless marketplace_id.nil?
|
13
13
|
@query_params["nextToken"] = next_token unless next_token.nil?
|
14
14
|
@request_type = "GET"
|
@@ -6,8 +6,7 @@ require "securerandom"
|
|
6
6
|
|
7
7
|
module MuffinMan
|
8
8
|
class SpApiClient
|
9
|
-
attr_reader :refresh_token, :client_id, :client_secret, :
|
10
|
-
:aws_secret_access_key, :sts_iam_role_arn, :sandbox, :config,
|
9
|
+
attr_reader :refresh_token, :client_id, :client_secret, :sandbox, :config,
|
11
10
|
:region, :request_type, :local_var_path, :query_params,
|
12
11
|
:request_body, :scope, :access_token_cache_key, :credentials,
|
13
12
|
:pii_data_elements
|
@@ -26,9 +25,6 @@ module MuffinMan
|
|
26
25
|
@refresh_token = credentials[:refresh_token]
|
27
26
|
@client_id = credentials[:client_id]
|
28
27
|
@client_secret = credentials[:client_secret]
|
29
|
-
@aws_access_key_id = credentials[:aws_access_key_id]
|
30
|
-
@aws_secret_access_key = credentials[:aws_secret_access_key]
|
31
|
-
@sts_iam_role_arn = credentials[:sts_iam_role_arn]
|
32
28
|
@region = credentials[:region] || "na"
|
33
29
|
@scope = credentials[:scope]
|
34
30
|
@access_token_cache_key = credentials[:access_token_cache_key]
|
@@ -135,43 +131,17 @@ module MuffinMan
|
|
135
131
|
JSON.parse(response.body)
|
136
132
|
end
|
137
133
|
|
138
|
-
def request_sts_token
|
139
|
-
client = Aws::STS::Client.new(
|
140
|
-
region: derive_aws_region,
|
141
|
-
credentials: Aws::Credentials.new(aws_access_key_id, aws_secret_access_key),
|
142
|
-
http_wire_trace: ENV.fetch("AWS_DEBUG", nil) == "true" || false
|
143
|
-
)
|
144
|
-
client.assume_role(role_arn: sts_iam_role_arn, role_session_name: SecureRandom.uuid)
|
145
|
-
end
|
146
|
-
|
147
|
-
def signed_request
|
148
|
-
request_config = {
|
149
|
-
service: SERVICE_NAME,
|
150
|
-
region: derive_aws_region,
|
151
|
-
endpoint: sp_api_host
|
152
|
-
}
|
153
|
-
if sts_iam_role_arn.nil?
|
154
|
-
request_config[:access_key_id] = aws_access_key_id
|
155
|
-
request_config[:secret_access_key] = aws_secret_access_key
|
156
|
-
else
|
157
|
-
request_config[:credentials_provider] = request_sts_token
|
158
|
-
end
|
159
|
-
signer = Aws::Sigv4::Signer.new(request_config)
|
160
|
-
signer.sign_request(http_method: request_type, url: request.url, body: request_body&.to_json)
|
161
|
-
end
|
162
|
-
|
163
134
|
def headers
|
164
135
|
if requires_rdt_token_for_pii?
|
165
136
|
access_token = retrieve_rdt_access_token || retrieve_lwa_access_token
|
166
137
|
else
|
167
138
|
access_token = scope ? retrieve_grantless_access_token : retrieve_lwa_access_token
|
168
139
|
end
|
169
|
-
|
140
|
+
{
|
170
141
|
"x-amz-access-token" => access_token,
|
171
142
|
"user-agent" => "MuffinMan/#{VERSION} (Language=Ruby)",
|
172
143
|
"content-type" => "application/json"
|
173
144
|
}
|
174
|
-
signed_request.headers.merge(headers)
|
175
145
|
end
|
176
146
|
|
177
147
|
def requires_rdt_token_for_pii?
|
data/lib/muffin_man/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muffin_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2025-
|
13
|
+
date: 2025-04-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|