muffin_man 2.4.10 → 2.4.11
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 +4 -0
- data/README.md +13 -0
- data/lib/muffin_man/application_management/v20231130.rb +14 -0
- data/lib/muffin_man/lwa/auth_helper.rb +23 -0
- data/lib/muffin_man/version.rb +1 -1
- data/lib/muffin_man.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33f0611029142ad77dfc45fd3554b68b0579c9ab5aa9aec1764e9e21a208ded2
|
4
|
+
data.tar.gz: 378875142894a576c71e69628786f473eb83a14f2abc94bc147eceaf0c836a81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad19739230189a856576ad94d39d41e2c058f97f962f3f718f8d634f2976cbc2b7361ad2648d68ee487f8106f626eaeb977b8adcba3a5d9657a53d59429af6c8
|
7
|
+
data.tar.gz: 17da668a051fe58d4415b76b4f2b89164ed0e9a23b634ecea84195ec249ba59081e53b85a98d041475a28f4788bad558ac5902db48033c71d558b36309c4b8f2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,7 @@ As of now, this gem only supports portions of the following APIs with more to co
|
|
38
38
|
- `Vendor Transaction Status API v1`
|
39
39
|
- `Uploads API v2020-11-01`
|
40
40
|
- `A+ API v2020-11-01`
|
41
|
+
- `Application Management API v2023-11-30`
|
41
42
|
|
42
43
|
## Installation
|
43
44
|
|
@@ -126,6 +127,18 @@ auth_code = resp['payload']['authorizationCode']
|
|
126
127
|
refresh_token = MuffinMan::Lwa::AuthHelper.get_refresh_token(CLIENT_ID, CLIENT_SECRET, auth_code)
|
127
128
|
```
|
128
129
|
|
130
|
+
### Retrieiving the access token
|
131
|
+
To retrieve the access token, you can use the LWA helper:
|
132
|
+
```ruby
|
133
|
+
access_token = MuffinMan::Lwa::AuthHelper.get_access_token(scope, client_id, client_secret)
|
134
|
+
```
|
135
|
+
|
136
|
+
### Rotating application client secret
|
137
|
+
To rotate client secret for application
|
138
|
+
```ruby
|
139
|
+
MuffinMan::ApplicationManagement::V20231130.rotate_application_client_secret(access_token)
|
140
|
+
```
|
141
|
+
|
129
142
|
### Debugging
|
130
143
|
|
131
144
|
To use Typheous' verbose mode set env variable `MUFFIN_MAN_DEBUG=true`
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module MuffinMan
|
4
|
+
module ApplicationManagement
|
5
|
+
class V20231130
|
6
|
+
def self.rotate_application_client_secret(access_token)
|
7
|
+
Typhoeus.post(
|
8
|
+
"https://sellingpartnerapi-na.amazon.com/applications/2023-11-30/clientSecret",
|
9
|
+
headers: { "x-amz-access-token" => access_token }
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -23,5 +23,28 @@ module MuffinMan::Lwa
|
|
23
23
|
end
|
24
24
|
JSON.parse(response.body)["refresh_token"]
|
25
25
|
end
|
26
|
+
|
27
|
+
def self.get_access_token(scope, client_id, client_secret)
|
28
|
+
body = {
|
29
|
+
grant_type: "client_credentials",
|
30
|
+
scope: scope,
|
31
|
+
client_id: client_id,
|
32
|
+
client_secret: client_secret
|
33
|
+
}
|
34
|
+
|
35
|
+
response = Typhoeus.post(
|
36
|
+
ACCESS_TOKEN_URL,
|
37
|
+
body: URI.encode_www_form(body),
|
38
|
+
headers: {
|
39
|
+
"Content-Type" => "application/x-www-form-urlencoded;charset=UTF-8"
|
40
|
+
}
|
41
|
+
)
|
42
|
+
if response.code != 200
|
43
|
+
error_body = JSON.parse(response.body)
|
44
|
+
error = "#{error_body["error"]}: #{error_body["error_description"]}"
|
45
|
+
raise MuffinMan::Error, error
|
46
|
+
end
|
47
|
+
JSON.parse(response.body)["access_token"]
|
48
|
+
end
|
26
49
|
end
|
27
50
|
end
|
data/lib/muffin_man/version.rb
CHANGED
data/lib/muffin_man.rb
CHANGED
@@ -39,6 +39,7 @@ require "muffin_man/vendor_transaction_status/v1"
|
|
39
39
|
require "muffin_man/customer_feedback/v20240601"
|
40
40
|
require "muffin_man/uploads/v20201101"
|
41
41
|
require "muffin_man/aplus_content/v20201101"
|
42
|
+
require "muffin_man/application_management/v20231130"
|
42
43
|
|
43
44
|
module MuffinMan
|
44
45
|
class Error < StandardError; end
|
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.11
|
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-01-
|
13
|
+
date: 2025-01-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- bin/setup
|
155
155
|
- lib/muffin_man.rb
|
156
156
|
- lib/muffin_man/aplus_content/v20201101.rb
|
157
|
+
- lib/muffin_man/application_management/v20231130.rb
|
157
158
|
- lib/muffin_man/authorization/v1.rb
|
158
159
|
- lib/muffin_man/awd/v20240509.rb
|
159
160
|
- lib/muffin_man/catalog_items/base_api.rb
|
@@ -225,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
226
|
- !ruby/object:Gem::Version
|
226
227
|
version: '0'
|
227
228
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
229
|
+
rubygems_version: 3.1.6
|
229
230
|
signing_key:
|
230
231
|
specification_version: 4
|
231
232
|
summary: Amazon Selling Partner API client
|