muffin_man 2.4.8 → 2.4.10

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: 2f074702a508a2a37e3fa5da93518288415d5e0201dbb2d2a5ca635385e109ac
4
- data.tar.gz: 5bb970ccb190c94d8aa6127a86bcda564253bef263ab76ebf6d1685eb53eb556
3
+ metadata.gz: 1d683b6dea44eb948c563cea144a00d0031713850062727bb7663d5cf246b6b9
4
+ data.tar.gz: 903e5e6dbe397e5add17d287408150f2bae13173082c21e2c9dc35d7ae46c4da
5
5
  SHA512:
6
- metadata.gz: df8188be5ad13d9007abe6a5ea93942d77f663c256d7c1a4a3baac3539cd6ea98936d14409643abc14fc15569102eae7a328703aa6ba449ef37c2db3d511b657
7
- data.tar.gz: 9225837cba3b50eaaa422c61d14d571eaf0cc25e3ad8f9bb045194ad000ca607e2f41eb9d0b60df77ef7cd7d98777c2aa8cda7af6180caa336d063fde8cb20d2
6
+ metadata.gz: 995df7ef1120cb444ea1476a071613e35de3170f23efcd9a82b0ad62fd17019ba41e1ada3103d58fe315287bbe9c6aae168c258d619b52c0a2fa60e0ce15e98d
7
+ data.tar.gz: 75fa638fe79049d64cac04601a5c10eaa828f5404087570917d352d667b28fa98dcfa6d79b31b3df49fc72c8c606650479cf72eac04712eaffcb1c5d0bd4a2d7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 2.4.10
2
+
3
+ - Sellers API v1 [#87](https://github.com/patterninc/muffin_man/pull/87)
4
+ - Listings API v20210801 searchListingsItem [#87](https://github.com/patterninc/muffin_man/pull/87)
5
+
1
6
  # 2.4.8
2
7
 
3
8
  - Customer Feedback v2024-06-01 [#80] (https://github.com/patterninc/muffin_man/pull/80)
data/README.md CHANGED
@@ -25,6 +25,7 @@ As of now, this gem only supports portions of the following APIs with more to co
25
25
  - `Product Pricing API v0`
26
26
  - `Reports API v2021-06-30`
27
27
  - `Solicitations API v1`
28
+ - `Sellers API v1`
28
29
  - `Tokens API v2021-03-01`
29
30
  - `Vendor Direct Fulfillment Transactions API v1`
30
31
  - `Vendor Direct Fulfillment Orders API v2021-12-28`
@@ -35,6 +36,8 @@ As of now, this gem only supports portions of the following APIs with more to co
35
36
  - `Vendor Orders API v1`
36
37
  - `Vendor Shipments API v1`
37
38
  - `Vendor Transaction Status API v1`
39
+ - `Uploads API v2020-11-01`
40
+ - `A+ API v2020-11-01`
38
41
 
39
42
  ## Installation
40
43
 
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MuffinMan
4
+ module AplusContent
5
+ class V20201101 < SpApiClient
6
+ # Create content document
7
+ #
8
+ # This API is used to upload A+ Content documents.
9
+ # The content document is the container for all A+ modules in a specific language.
10
+ # It is required for creating content in A+ Content Manager.
11
+ # @param marketplace_id The identifier for the marketplace where the A+ Content is published.
12
+ # @param content_document_payload The content document request payload.
13
+ # Refer to the A+ Content API documentation for more information.
14
+ # @return [Hash]
15
+ # The response from the API, which includes the signed upload URL and additional metadata.
16
+ # @raise [StandardError]
17
+ # Raises an error if the API request fails.
18
+ #
19
+ # @example
20
+ # client = MuffinMan::AplusContent::V20201101.new
21
+ # response = client.create_content_documents(
22
+ # "ATVPDKIKX0DER",
23
+ # { "contentDocument" => {
24
+ # "name" => "My Content Document",
25
+ # "contentType" => "STANDARD",
26
+ # "locale" => "en_US",
27
+ # "contentModuleList" => "< ContentModule > array"
28
+ # }
29
+ # }
30
+ # )
31
+ # puts response
32
+ def create_content_documents(marketplace_id, content_document_payload)
33
+ @local_var_path = "/aplus/2020-11-01/contentDocuments"
34
+ @query_params = { "marketplaceId" => marketplace_id }
35
+ @request_body = content_document_payload
36
+ @request_type = "POST"
37
+
38
+ call_api
39
+ end
40
+
41
+ # Create content document asin relations
42
+ #
43
+ # This API is used to associate ASINs with a content document.
44
+ # The content document is the container for all A+ modules in a specific language.
45
+ # It is required for creating content in A+ Content Manager.
46
+ # @param marketplace_id The identifier for the marketplace where the A+ Content is published.
47
+ # @param content_reference_key The unique reference key for the content document.
48
+ # @param asin_set The set of ASINs.
49
+ # @return [Hash]
50
+ # The response from the API, which includes the signed upload URL and additional metadata.
51
+ # @raise [StandardError]
52
+ # Raises an error if the API request fails.
53
+ #
54
+ # @example
55
+ # client = MuffinMan::AplusContent::V20201101.new
56
+ # response = client.post_content_document_asin_relations(
57
+ # "ATVPDKIKX0DER",
58
+ # "contentReferenceKey",
59
+ # ["B07H8QMZWV", "B07H8QMZWV"]
60
+ # )
61
+ # puts response
62
+ def post_content_document_asin_relations(marketplace_id, content_reference_key, asin_set)
63
+ @local_var_path = "/aplus/2020-11-01/contentDocuments/#{content_reference_key}/asins"
64
+ @query_params = { "marketplaceId" => marketplace_id }
65
+ @request_body = { "asinSet" => asin_set }
66
+ @request_type = "POST"
67
+
68
+ call_api
69
+ end
70
+
71
+ # validate content document asin relations
72
+ #
73
+ # This API is used to validate the content document ASINs.
74
+ # The content document is the container for all A+ modules in a specific language.
75
+ # It is required for creating content in A+ Content Manager.
76
+ # @param marketplace_id The identifier for the marketplace where the A+ Content is published.
77
+ # @param asin_set The set of ASINs.
78
+ # @param content_document_payload The content document request payload.
79
+ # Refer to the A+ Content API documentation for more information.
80
+ # @return [Hash]
81
+ # The response from the API, which includes the signed upload URL and additional metadata.
82
+ # @raise [StandardError]
83
+ # Raises an error if the API request fails.
84
+ #
85
+ # @example
86
+ # client = MuffinMan::AplusContent::V20201101.new
87
+ # response = client.validate_content_document_asin_relations(
88
+ # "ATVPDKIKX0DER",
89
+ # ["B07H8QMZWV", "B07H8QMZWV"],
90
+ # { "contentDocument" => {
91
+ # "name" => "My Content Document",
92
+ # "contentType" => "STANDARD",
93
+ # "locale" => "en_US",
94
+ # "contentModuleList" => "< ContentModule > array"
95
+ # }
96
+ # }
97
+ # )
98
+ # puts response
99
+ def validate_content_document_asin_relations(marketplace_id, asin_set, content_document_payload)
100
+ @local_var_path = "/aplus/2020-11-01/contentAsinValidations"
101
+ @query_params = { "marketplaceId" => marketplace_id, "asinSet" => asin_set.join(",") }
102
+ @request_body = content_document_payload
103
+ @request_type = "POST"
104
+
105
+ call_api
106
+ end
107
+ end
108
+ end
109
+ end
@@ -65,6 +65,21 @@ module MuffinMan
65
65
  @request_type = "PATCH"
66
66
  call_api
67
67
  end
68
+
69
+ def search_listings_items(seller_id, marketplace_ids, **optional_query)
70
+ @local_var_path = "/listings/2021-08-01/items/#{seller_id}"
71
+ @marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
72
+ @query_params = {
73
+ "marketplaceIds" => @marketplace_ids.join(",")
74
+ }
75
+ optional_query.each do |key, value|
76
+ camel_key = key.to_s.camelize(:lower).to_sym
77
+ string_value = value.is_a?(Array) ? value.join(",") : value
78
+ @query_params[camel_key] = string_value
79
+ end
80
+ @request_type = "GET"
81
+ call_api
82
+ end
68
83
  end
69
84
  end
70
85
  end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MuffinMan
4
+ module Sellers
5
+ class V1 < SpApiClient
6
+ # This is only available in the EU region.
7
+ def account
8
+ @local_var_path = "/sellers/v1/account"
9
+ @request_type = "GET"
10
+ call_api
11
+ end
12
+
13
+ def marketplace_participations
14
+ @local_var_path = "/sellers/v1/marketplaceParticipations"
15
+ @request_type = "GET"
16
+ call_api
17
+ end
18
+ end
19
+ end
20
+ end
@@ -39,6 +39,10 @@ module MuffinMan
39
39
  @config = MuffinMan.configuration
40
40
  end
41
41
 
42
+ def request
43
+ Typhoeus::Request.new(canonical_uri, params: query_params)
44
+ end
45
+
42
46
  private
43
47
 
44
48
  def call_api
@@ -73,10 +77,6 @@ module MuffinMan
73
77
  "#{sp_api_url}#{local_var_path}"
74
78
  end
75
79
 
76
- def request
77
- Typhoeus::Request.new(canonical_uri, params: query_params)
78
- end
79
-
80
80
  def retrieve_lwa_access_token
81
81
  return request_lwa_access_token["access_token"] unless use_cache?
82
82
 
@@ -108,7 +108,7 @@ module MuffinMan
108
108
  "Content-Type" => "application/x-www-form-urlencoded;charset=UTF-8"
109
109
  }
110
110
  )
111
- raise SpApiAuthError, response if response.failure?
111
+ raise SpApiAuthError, response unless response.success?
112
112
 
113
113
  JSON.parse(response.body)
114
114
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MuffinMan
4
+ module Uploads
5
+ class V20201101 < SpApiClient
6
+ # Creates a new upload destination for a resource.
7
+ #
8
+ # This method generates a signed upload destination URL for a specific resource
9
+ # that you can use to upload files to Amazon SP-API.
10
+ #
11
+ # @param [String] marketplace_id
12
+ # The identifier of the marketplace for the request (e.g., 'ATVPDKIKX0DER').
13
+ # @param [String] resource
14
+ # The resource type and path, such as:
15
+ # - `/messaging/v1/orders/{amazonOrderId}/messages/legalDisclosure`
16
+ # - `aplus/2020-11-01/contentDocuments`.
17
+ # @param [String] content_md5
18
+ # The MD5 hash of the file's content. Use `Digest::MD5.file(file_path).hexdigest` to calculate this.
19
+ # @param [String] content_type (optional)
20
+ # The content type of the file (e.g., 'application/pdf').
21
+ # @return [Hash]
22
+ # The response from the API, which includes the signed upload URL and additional metadata.
23
+ # @raise [StandardError]
24
+ # Raises an error if the API request fails.
25
+ #
26
+ # @example
27
+ # client = MuffinMan::Uploads::V20201101.new
28
+ # response = client.create_upload_destination_for_resource(
29
+ # "ATVPDKIKX0DER",
30
+ # "aplus/2020-11-01/contentDocuments",
31
+ # "510700ca1b152c729b62f2fd13c8dbbe",
32
+ # "application/pdf"
33
+ # )
34
+ # puts response
35
+ def create_upload_destination_for_resource(marketplace_id, resource, content_md5, content_type: nil)
36
+ @local_var_path = "/uploads/2020-11-01/uploadDestinations/#{resource}"
37
+ @query_params = { "marketplaceIds" => marketplace_id, "contentMD5" => content_md5 }
38
+ @query_params["contentType"] = content_type if content_type
39
+ @request_type = "POST"
40
+
41
+ call_api
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MuffinMan
4
- VERSION = "2.4.8"
4
+ VERSION = "2.4.10"
5
5
  end
data/lib/muffin_man.rb CHANGED
@@ -26,6 +26,7 @@ require "muffin_man/feeds/v20210630"
26
26
  require "muffin_man/notifications/v1"
27
27
  require "muffin_man/merchant_fulfillment/v0"
28
28
  require "muffin_man/awd/v20240509"
29
+ require "muffin_man/sellers/v1"
29
30
  require "muffin_man/vendor_direct_fulfillment_inventory/v1"
30
31
  require "muffin_man/vendor_direct_fulfillment_orders/v20211228"
31
32
  require "muffin_man/vendor_direct_fulfillment_payments/v1"
@@ -36,6 +37,8 @@ require "muffin_man/vendor_orders/v1"
36
37
  require "muffin_man/vendor_shipments/v1"
37
38
  require "muffin_man/vendor_transaction_status/v1"
38
39
  require "muffin_man/customer_feedback/v20240601"
40
+ require "muffin_man/uploads/v20201101"
41
+ require "muffin_man/aplus_content/v20201101"
39
42
 
40
43
  module MuffinMan
41
44
  class Error < StandardError; end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muffin_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.8
4
+ version: 2.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin
8
8
  - Jason
9
9
  - Nate
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2024-11-11 00:00:00.000000000 Z
13
+ date: 2025-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -130,7 +130,7 @@ dependencies:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
- description:
133
+ description:
134
134
  email:
135
135
  - gavin@pattern.com
136
136
  - jason@pattern.com
@@ -153,6 +153,7 @@ files:
153
153
  - bin/console
154
154
  - bin/setup
155
155
  - lib/muffin_man.rb
156
+ - lib/muffin_man/aplus_content/v20201101.rb
156
157
  - lib/muffin_man/authorization/v1.rb
157
158
  - lib/muffin_man/awd/v20240509.rb
158
159
  - lib/muffin_man/catalog_items/base_api.rb
@@ -188,9 +189,11 @@ files:
188
189
  - lib/muffin_man/request_helpers/outbound_fulfillment/item.rb
189
190
  - lib/muffin_man/request_helpers/outbound_fulfillment/v20200701.rb
190
191
  - lib/muffin_man/sandbox_helpers/merchant_fulfillment/create_shipment_body.json
192
+ - lib/muffin_man/sellers/v1.rb
191
193
  - lib/muffin_man/solicitations/v1.rb
192
194
  - lib/muffin_man/sp_api_client.rb
193
195
  - lib/muffin_man/tokens/v20210301.rb
196
+ - lib/muffin_man/uploads/v20201101.rb
194
197
  - lib/muffin_man/vendor_direct_fulfillment_inventory/v1.rb
195
198
  - lib/muffin_man/vendor_direct_fulfillment_orders/v20211228.rb
196
199
  - lib/muffin_man/vendor_direct_fulfillment_payments/v1.rb
@@ -207,7 +210,7 @@ homepage: https://github.com/patterninc/muffin_man
207
210
  licenses:
208
211
  - MIT
209
212
  metadata: {}
210
- post_install_message:
213
+ post_install_message:
211
214
  rdoc_options: []
212
215
  require_paths:
213
216
  - lib
@@ -222,8 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
225
  - !ruby/object:Gem::Version
223
226
  version: '0'
224
227
  requirements: []
225
- rubygems_version: 3.0.3.1
226
- signing_key:
228
+ rubygems_version: 3.4.19
229
+ signing_key:
227
230
  specification_version: 4
228
231
  summary: Amazon Selling Partner API client
229
232
  test_files: []