muffin_man 0.2.0 → 1.0.0

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: d1b217205a970848a9dc08eea1daf04d52da4d5970bff2a00f0041867c320837
4
- data.tar.gz: d7df1a7bd5738e336380d3ce6c17df85610d36498997374b2f5e34061a17cf69
3
+ metadata.gz: 452a879ba32d96175ec80f2ec96c23d8b52fdb02825e9a27d1b90048f34bfc07
4
+ data.tar.gz: dba288535b7f032c084cdcfeb9f8d40ca5ad5d60152f0efde44cc2659a760252
5
5
  SHA512:
6
- metadata.gz: 75d9be6ff3849a9a45ef506e90c4a13d407aeef6ea8f7e84cf1f3c30d4384e451e70ca704f1d7ffb5f621b5bfa0fed4c058a7dabdffdae35c2019c7a545b2914
7
- data.tar.gz: 7d7696a4e3e9400471e0444b5864592dd0f5297ad1733b51a51bfbe5253564059d5397489acb0f53d7529611bd778cab1d6206eeab4606d39b8f0bc779703434
6
+ metadata.gz: 3f19c0be669410e54f1578ca18a5b9c23a9ae178b9b15c9314224e8c79b1b8ed0344a3cccde5c196e4f12d7678aa455c9ebdadcd306680c779fb05e2ad822587
7
+ data.tar.gz: 7a6123fd6c3e90d505bc9408a3c9b5b8b3606074d0117e5bfb2de2b2b26741df970819631c77c3822903a8dba7131fdbf57d9adfaebb8eda5403e535e44057cb
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  # MuffinMan
2
2
 
3
+ ![Ruby CI](https://github.com/patterninc/muffin_man/actions/workflows/ci.yml/badge.svg)
4
+
3
5
  MuffinMan is a ruby interface to the Amazon Selling Partner API. For more information on registering to use the Selling Partner API, see [Amazon's documentation](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/developer-guide/SellingPartnerApiDeveloperGuide.md)
4
6
 
5
- As of now, this gem only supports the `create_product_review_and_seller_feedback_solicitation` model, likely with more to come.
7
+ As of now, this gem only supports portions of the following APIs with more to come:
8
+
9
+ - `create_product_review_and_seller_feedback_solicitation`
10
+ - `catalog_items`
11
+ - `reports`
6
12
 
7
13
  ## Installation
8
14
 
@@ -35,7 +41,7 @@ credentials = {
35
41
  region: REGION, # This can be one of ['na', 'eu', 'fe'] and defaults to 'na'
36
42
  sts_iam_role_arn: STS_IAM_ROLE_ARN, # Optional
37
43
  }
38
- client = MuffinMan::Solicitations.new(credentials)
44
+ client = MuffinMan::Solicitations::V1.new(credentials)
39
45
  response = client.create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
40
46
  JSON.parse(response.body)
41
47
  ```
@@ -1,6 +1,6 @@
1
1
  module MuffinMan
2
- module V20201201
3
- class CatalogItems < SpApiClient
2
+ module CatalogItems
3
+ class V20201201 < SpApiClient
4
4
  SANDBOX_KEYWORDS = "shoes".freeze
5
5
  SANDBOX_ASIN = "B07N4M94X4".freeze
6
6
  SANDBOX_MARKETPLACE_IDS = "ATVPDKIKX0DER".freeze
@@ -0,0 +1,29 @@
1
+ module MuffinMan
2
+ module Reports
3
+ class V20210630 < SpApiClient
4
+ SANDBOX_REPORT_TYPE = "GET_MERCHANT_LISTINGS_ALL_DATA"
5
+ SANDBOX_START_TIME = "2019-12-10T20:11:24.000Z"
6
+ SANDBOX_MARKETPLACE_IDS = [
7
+ "A1PA6795UKMFR9",
8
+ "ATVPDKIKX0DER"
9
+ ]
10
+
11
+ def create_report(report_type, marketplace_ids, start_time = nil, end_time = nil, report_options = {})
12
+ report_type = sandbox ? SANDBOX_REPORT_TYPE : report_type
13
+ marketplace_ids = sandbox ? SANDBOX_MARKETPLACE_IDS : marketplace_ids
14
+ start_time = sandbox ? SANDBOX_START_TIME : start_time
15
+
16
+ @local_var_path = "/reports/2021-06-30/reports"
17
+ @request_body = {
18
+ "reportType" => report_type,
19
+ "marketplaceIds" => marketplace_ids,
20
+ }
21
+ @request_body["dataStartTime"] = start_time unless start_time.nil?
22
+ @request_body["dataEndTime"] = end_time unless end_time.nil?
23
+ @request_body["reportOptions"] = report_options unless report_options.empty?
24
+ @request_type = 'POST'
25
+ call_api
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,21 @@
1
+ module MuffinMan
2
+ module Solicitations
3
+ class V1 < SpApiClient
4
+ SANDBOX_AMAZON_ORDER_ID = "123-1234567-1234567"
5
+ SANDBOX_MARKETPLACE_IDS = "ATVPDKIKX0DER"
6
+ attr_reader :amazon_order_id, :marketplace_ids
7
+
8
+ # 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.
9
+ # @param amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent.
10
+ # @param marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified.
11
+ def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
12
+ @amazon_order_id = sandbox ? SANDBOX_AMAZON_ORDER_ID : amazon_order_id
13
+ @marketplace_ids = sandbox ? SANDBOX_MARKETPLACE_IDS : marketplace_ids
14
+ @local_var_path = '/solicitations/v1/orders/{amazonOrderId}/solicitations/productReviewAndSellerFeedback'.sub('{' + 'amazonOrderId' + '}', @amazon_order_id)
15
+ @query_params = { "marketplaceIds" => @marketplace_ids }
16
+ @request_type = 'POST'
17
+ call_api
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuffinMan
4
- VERSION = "0.2.0"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/muffin_man.rb CHANGED
@@ -1,8 +1,8 @@
1
- require_relative "muffin_man/version"
1
+ require "muffin_man/version"
2
2
  require "muffin_man/sp_api_client"
3
- require "muffin_man/solicitations"
4
- require "muffin_man/reports"
5
- require "muffin_man/v20201201/catalog_items"
3
+ require "muffin_man/solicitations/v1"
4
+ require "muffin_man/reports/v20210630"
5
+ require "muffin_man/catalog_items/v20201201"
6
6
 
7
7
  module MuffinMan
8
8
  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: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin
@@ -124,10 +124,10 @@ files:
124
124
  - bin/console
125
125
  - bin/setup
126
126
  - lib/muffin_man.rb
127
- - lib/muffin_man/reports.rb
128
- - lib/muffin_man/solicitations.rb
127
+ - lib/muffin_man/catalog_items/v20201201.rb
128
+ - lib/muffin_man/reports/v20210630.rb
129
+ - lib/muffin_man/solicitations/v1.rb
129
130
  - lib/muffin_man/sp_api_client.rb
130
- - lib/muffin_man/v20201201/catalog_items.rb
131
131
  - lib/muffin_man/version.rb
132
132
  - muffin_man.gemspec
133
133
  homepage: https://github.com/patterninc/muffin_man
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.1.6
152
+ rubygems_version: 3.2.3
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Amazon Selling Partner API client
@@ -1,27 +0,0 @@
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
@@ -1,19 +0,0 @@
1
- module MuffinMan
2
- class Solicitations < SpApiClient
3
- SANDBOX_AMAZON_ORDER_ID = "123-1234567-1234567"
4
- SANDBOX_MARKETPLACE_IDS = "ATVPDKIKX0DER"
5
- attr_reader :amazon_order_id, :marketplace_ids
6
-
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
- # @param amazon_order_id An Amazon order identifier. This specifies the order for which a solicitation is sent.
9
- # @param marketplace_ids A marketplace identifier. This specifies the marketplace in which the order was placed. Only one marketplace can be specified.
10
- def create_product_review_and_seller_feedback_solicitation(amazon_order_id, marketplace_ids)
11
- @amazon_order_id = sandbox ? SANDBOX_AMAZON_ORDER_ID : amazon_order_id
12
- @marketplace_ids = sandbox ? SANDBOX_MARKETPLACE_IDS : marketplace_ids
13
- @local_var_path = '/solicitations/v1/orders/{amazonOrderId}/solicitations/productReviewAndSellerFeedback'.sub('{' + 'amazonOrderId' + '}', @amazon_order_id)
14
- @query_params = { "marketplaceIds" => @marketplace_ids }
15
- @request_type = 'POST'
16
- call_api
17
- end
18
- end
19
- end