muffin_man 2.0.1 → 2.0.3
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 +8 -0
- data/README.md +1 -0
- data/lib/muffin_man/listings/v20210801.rb +17 -0
- 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: e369bb1ade25adc09729766667804263f5c1047939a98e13da9c3d6a10ddddcf
|
4
|
+
data.tar.gz: 8bcf51705df499bd703b3ce8e69fc7342ae475f60431bad183e080b6eca0c918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6130d36d41d5e9f38f63fcc55f51c3269d49c78bc5e2c42eeda68f4a466756ffde7cf066d13d6f5b2d57b182e148875f33ea2b17f932268fc352d0b13bdd6e73
|
7
|
+
data.tar.gz: 9251f8fddf551cd308627276a82927e899a5ed5488c82143104f436e606515e07565f839fc8f2f47190362ad9833fc4afd268b5d4dcd26744b39ee895809de1a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 2.0.3 [#](https://github.com/patterninc/muffin_man/pull/50)
|
2
|
+
|
3
|
+
- Support for putListingsItem
|
4
|
+
|
5
|
+
# 2.0.2 [#49](https://github.com/patterninc/muffin_man/pull/49)
|
6
|
+
|
7
|
+
- Better error handling for unauthorized errors when getting LWA tokens
|
8
|
+
|
1
9
|
# 2.0.1 [#46](https://github.com/patterninc/muffin_man/pull/46)
|
2
10
|
|
3
11
|
- Support for passing an array of identifiers to search_catalog_items
|
data/README.md
CHANGED
@@ -19,6 +19,23 @@ module MuffinMan
|
|
19
19
|
@request_type = "GET"
|
20
20
|
call_api
|
21
21
|
end
|
22
|
+
|
23
|
+
def put_listings_item(seller_id, sku, marketplace_ids, product_type, attributes, issue_locale: nil,
|
24
|
+
requirements: nil)
|
25
|
+
@local_var_path = "/listings/2021-08-01/items/#{seller_id}/#{sku}"
|
26
|
+
@marketplace_ids = marketplace_ids.is_a?(Array) ? marketplace_ids : [marketplace_ids]
|
27
|
+
@query_params = {
|
28
|
+
"marketplaceIds" => @marketplace_ids.join(",")
|
29
|
+
}
|
30
|
+
@query_params["issueLocale"] = issue_locale if issue_locale
|
31
|
+
@request_body = {
|
32
|
+
"productType" => product_type,
|
33
|
+
"attributes" => attributes
|
34
|
+
}
|
35
|
+
@request_body["requirements"] = requirements if requirements
|
36
|
+
@request_type = "PUT"
|
37
|
+
call_api
|
38
|
+
end
|
22
39
|
end
|
23
40
|
end
|
24
41
|
end
|
@@ -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.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: 2023-
|
13
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|