muffin_man 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/muffin_man/reports.rb +27 -0
- data/lib/muffin_man/solicitations.rb +1 -1
- data/lib/muffin_man/sp_api_client.rb +12 -3
- data/lib/muffin_man/version.rb +1 -1
- data/lib/muffin_man.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25135df0da6abb1e29b819b2f82be37186c580c26c5ed99532c0f70450dfd078
|
4
|
+
data.tar.gz: c90972f67f07f7c8987027c3e143dd8574c8fd3dd13bedc01b30a20518f13ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189e7f5656b429d6493a780f9b847b2a41e65f61d69aa21420e797b1d75b94d00db432569d5c89f0e8b5d976d76191cf410c071ce904762fb32a6ca0c7f5217e
|
7
|
+
data.tar.gz: 0bed33effc0565b1959cce60840261aa95f7388ffec1bb6d784ea1742ee1022f813dfe455a2370c88d15b609cbc7d1ff0d99bc5120b71862ba3c9ebadd97bd7f
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ credentials = {
|
|
36
36
|
sts_iam_role_arn: STS_IAM_ROLE_ARN, # Optional
|
37
37
|
}
|
38
38
|
client = MuffinMan::Solicitations.new(credentials)
|
39
|
-
response = client.create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids
|
39
|
+
response = client.create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
|
40
40
|
JSON.parse(response.body)
|
41
41
|
```
|
42
42
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module MuffinMan
|
2
|
+
class Reports < SpApiClient
|
3
|
+
SANDBOX_REPORT_TYPE = "GET_MERCHANT_LISTINGS_ALL_DATA"
|
4
|
+
SANDBOX_START_TIME = "2019-12-10T20:11:24.000Z"
|
5
|
+
SANDBOX_MARKETPLACE_IDS = [
|
6
|
+
"A1PA6795UKMFR9",
|
7
|
+
"ATVPDKIKX0DER"
|
8
|
+
]
|
9
|
+
|
10
|
+
def create_report(report_type, marketplace_ids, start_time = nil, end_time = nil, report_options = {})
|
11
|
+
report_type = sandbox ? SANDBOX_REPORT_TYPE : report_type
|
12
|
+
marketplace_ids = sandbox ? SANDBOX_MARKETPLACE_IDS : marketplace_ids
|
13
|
+
start_time = sandbox ? SANDBOX_START_TIME : start_time
|
14
|
+
|
15
|
+
@local_var_path = "/reports/2021-06-30/reports"
|
16
|
+
@request_body = {
|
17
|
+
"reportType" => report_type,
|
18
|
+
"marketplaceIds" => marketplace_ids,
|
19
|
+
}
|
20
|
+
@request_body["dataStartTime"] = start_time unless start_time.nil?
|
21
|
+
@request_body["dataEndTime"] = end_time unless end_time.nil?
|
22
|
+
@request_body["reportOptions"] = report_options unless report_options.empty?
|
23
|
+
@request_type = 'POST'
|
24
|
+
call_api
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -2,7 +2,7 @@ module MuffinMan
|
|
2
2
|
class Solicitations < SpApiClient
|
3
3
|
SANDBOX_AMAZON_ORDER_ID = "123-1234567-1234567"
|
4
4
|
SANDBOX_MARKETPLACE_IDS = "ATVPDKIKX0DER"
|
5
|
-
attr_reader :amazon_order_id, :marketplace_ids
|
5
|
+
attr_reader :amazon_order_id, :marketplace_ids
|
6
6
|
|
7
7
|
# Sends a solicitation to a buyer asking for seller feedback and a product review for the specified order. Send only one productReviewAndSellerFeedback or free form proactive message per order. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 1 | 5 | For more information, see \"Usage Plans and Rate Limits\" in the Selling Partner API documentation.
|
8
8
|
# @param amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent.
|
@@ -7,7 +7,8 @@ require 'securerandom'
|
|
7
7
|
module MuffinMan
|
8
8
|
class SpApiClient
|
9
9
|
attr_reader :refresh_token, :client_id, :client_secret, :aws_access_key_id,
|
10
|
-
:aws_secret_access_key, :sts_iam_role_arn, :sandbox, :config, :region
|
10
|
+
:aws_secret_access_key, :sts_iam_role_arn, :sandbox, :config, :region, :request_type,
|
11
|
+
:local_var_path, :query_params, :request_body
|
11
12
|
ACCESS_TOKEN_URL = 'https://api.amazon.com/auth/o2/token'.freeze
|
12
13
|
SERVICE_NAME = 'execute-api'.freeze
|
13
14
|
AWS_REGION_MAP = {
|
@@ -32,7 +33,15 @@ module MuffinMan
|
|
32
33
|
private
|
33
34
|
|
34
35
|
def call_api
|
35
|
-
Typhoeus.send(request_type.downcase.to_sym, request.url,
|
36
|
+
Typhoeus.send(request_type.downcase.to_sym, request.url, request_opts)
|
37
|
+
end
|
38
|
+
|
39
|
+
def request_opts
|
40
|
+
opts = { headers: headers }
|
41
|
+
if request_body
|
42
|
+
opts[:body] = request_body.to_json
|
43
|
+
end
|
44
|
+
opts
|
36
45
|
end
|
37
46
|
|
38
47
|
def sp_api_host
|
@@ -107,7 +116,7 @@ module MuffinMan
|
|
107
116
|
request_config[:credentials_provider] = request_sts_token
|
108
117
|
end
|
109
118
|
signer = Aws::Sigv4::Signer.new(request_config)
|
110
|
-
signer.sign_request(http_method: request_type, url: request.url)
|
119
|
+
signer.sign_request(http_method: request_type, url: request.url, body: request_body&.to_json)
|
111
120
|
end
|
112
121
|
|
113
122
|
def headers
|
data/lib/muffin_man/version.rb
CHANGED
data/lib/muffin_man.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: 0.1.
|
4
|
+
version: 0.1.3
|
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: 2021-
|
13
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- bin/console
|
124
124
|
- bin/setup
|
125
125
|
- lib/muffin_man.rb
|
126
|
+
- lib/muffin_man/reports.rb
|
126
127
|
- lib/muffin_man/solicitations.rb
|
127
128
|
- lib/muffin_man/sp_api_client.rb
|
128
129
|
- lib/muffin_man/version.rb
|