muffin_man 2.0.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/muffin_man/catalog_items/base_api.rb +8 -0
- data/lib/muffin_man/catalog_items/v20220401.rb +0 -1
- data/lib/muffin_man/sp_api_client.rb +4 -0
- data/lib/muffin_man/version.rb +1 -1
- data/lib/muffin_man.rb +9 -0
- 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: cdd15706a272ada38963d821fb2609b904277727bc2bde43fdc0fdcbf03a5883
|
4
|
+
data.tar.gz: f81a9c04bdfe27ac1b2d8508a6cfc79859d84eaff387ff0dbfdef92b88ead034
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37439833bf8791bba7c548136f48619fbac1d96e7629a24a3136910407911a7ba54e38776b3eaa5a5074f7f5aa539afdfbd1a3b4b4f287b6a16b30fe34bad7d3
|
7
|
+
data.tar.gz: fc6ed100c06729fe3f3637195af4bab1cad0f9c64edabe68577de43191d8f5930a6adffab74b99a6b4b68319bc57cd46782e25cd512c7e4cd1e4c08d3bc415aa
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 2.0.2 [#49](https://github.com/patterninc/muffin_man/pull/49)
|
2
|
+
|
3
|
+
- Better error handling for unauthorized errors when getting LWA tokens
|
4
|
+
|
5
|
+
# 2.0.1 [#46](https://github.com/patterninc/muffin_man/pull/46)
|
6
|
+
|
7
|
+
- Support for passing an array of identifiers to search_catalog_items
|
8
|
+
|
1
9
|
# 2.0.0 [#47](https://github.com/patterninc/muffin_man/pull/47)
|
2
10
|
|
3
11
|
- BREAKING CHANGES: Changed signature of processing_directive check as it was confusing and was not working. processing_directive is a nested structure. It has marketplace_ids. Having marketplace_ids as an independent parameter was confusing.
|
@@ -17,9 +17,11 @@ module MuffinMan
|
|
17
17
|
locale
|
18
18
|
].freeze
|
19
19
|
GET_CATALOG_ITEM_PARAMS = %w[includedData locale].freeze
|
20
|
+
DEFAULT_IDENTIFERS_TYPE = "ASIN".freeze
|
20
21
|
|
21
22
|
API_VERSION = "2020-12-01".freeze
|
22
23
|
|
24
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
23
25
|
def search_catalog_items(keywords, marketplace_ids, params = {}, api_version=API_VERSION)
|
24
26
|
if sandbox
|
25
27
|
keywords = SANDBOX_KEYWORDS
|
@@ -27,6 +29,7 @@ module MuffinMan
|
|
27
29
|
params = {}
|
28
30
|
end
|
29
31
|
@keywords = keywords.is_a?(Array) ? keywords : [keywords]
|
32
|
+
@identifiers = params["identifiers"].is_a?(Array) ? params["identifiers"] : [params["identifiers"]]
|
30
33
|
@marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
|
31
34
|
@params = params
|
32
35
|
@local_var_path = "/catalog/#{api_version}/items"
|
@@ -34,10 +37,15 @@ module MuffinMan
|
|
34
37
|
"marketplaceIds" => @marketplace_ids.join(",")
|
35
38
|
}
|
36
39
|
@query_params["keywords"] = @keywords.join(",") if @keywords.any?
|
40
|
+
if @identifiers.any?
|
41
|
+
@query_params["identifiers"] = @identifiers.join(",")
|
42
|
+
@query_params["identifiersType"] = params["identifiersType"] || DEFAULT_IDENTIFERS_TYPE
|
43
|
+
end
|
37
44
|
@query_params.merge!(@params.slice(*search_catalog_items_params))
|
38
45
|
@request_type = "GET"
|
39
46
|
call_api
|
40
47
|
end
|
48
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
41
49
|
|
42
50
|
def get_catalog_item(asin, marketplace_ids, params = {}, api_version=API_VERSION)
|
43
51
|
if sandbox
|
@@ -43,6 +43,8 @@ module MuffinMan
|
|
43
43
|
|
44
44
|
def call_api
|
45
45
|
Typhoeus.send(request_type.downcase.to_sym, request.url, request_opts)
|
46
|
+
rescue SpApiAuthError => e
|
47
|
+
e.auth_response
|
46
48
|
end
|
47
49
|
|
48
50
|
def request_opts
|
@@ -100,6 +102,8 @@ module MuffinMan
|
|
100
102
|
"Content-Type" => "application/x-www-form-urlencoded;charset=UTF-8"
|
101
103
|
}
|
102
104
|
)
|
105
|
+
raise SpApiAuthError, response if response.failure?
|
106
|
+
|
103
107
|
JSON.parse(response.body)
|
104
108
|
end
|
105
109
|
|
data/lib/muffin_man/version.rb
CHANGED
data/lib/muffin_man.rb
CHANGED
@@ -24,6 +24,15 @@ require "muffin_man/merchant_fulfillment/v0"
|
|
24
24
|
module MuffinMan
|
25
25
|
class Error < StandardError; end
|
26
26
|
|
27
|
+
class SpApiAuthError < StandardError
|
28
|
+
attr_reader :auth_response
|
29
|
+
|
30
|
+
def initialize(auth_response)
|
31
|
+
super
|
32
|
+
@auth_response = auth_response
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
27
36
|
class << self
|
28
37
|
attr_accessor :configuration
|
29
38
|
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.0.
|
4
|
+
version: 2.0.2
|
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: 2023-
|
13
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|