lucid-shopify 0.35.0 → 0.36.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6941ffc0f656f4a3f25df0ba4530aa8c793d3aedd3e87c0a4a333c5528ef6d16
|
4
|
+
data.tar.gz: 20b48f8e246754880b4f5506387774b5213605c2bf97bb7db2251c2ca24273c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0460cdf66d11da1376772eba36cd03a94b60592e0385cf15b9026092107720c8d165791bd0459d791735b29c9683af76241128783cf6ad268c1c13b45f3726ad
|
7
|
+
data.tar.gz: d24830b5067246abd9918e87772a0f726a3a5b96594d81d17e5f6684977579ea0c73221c4f7bca8f884b9bc33cff80dabdf7fa9e201bd8a6dccb90fbe3012f41
|
@@ -10,8 +10,7 @@ module Lucid
|
|
10
10
|
@create_webhook = create_webhook
|
11
11
|
end
|
12
12
|
|
13
|
-
# Create all webhooks for the shop.
|
14
|
-
# already exist remotely.
|
13
|
+
# Create all webhooks for the shop.
|
15
14
|
#
|
16
15
|
# @param credentials [Credentials]
|
17
16
|
# @param webhooks [WebhookList]
|
@@ -18,6 +18,10 @@ module Lucid
|
|
18
18
|
data = {**webhook, address: Shopify.config.webhook_uri}
|
19
19
|
|
20
20
|
@client.post_json(credentials, 'webhooks', webhook: data)
|
21
|
+
rescue Response::Error => e
|
22
|
+
raise e unless e.response.error_message?([
|
23
|
+
'address for this topic has already been taken'
|
24
|
+
])
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
@@ -18,7 +18,11 @@ module Lucid
|
|
18
18
|
|
19
19
|
# @return [String]
|
20
20
|
def message
|
21
|
-
|
21
|
+
if response.errors?
|
22
|
+
"bad response (#{response.status_code}) '#{response.error_messages.first}'"
|
23
|
+
else
|
24
|
+
"bad response (#{response.status_code})"
|
25
|
+
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
@@ -86,7 +90,7 @@ module Lucid
|
|
86
90
|
|
87
91
|
# @return [Boolean]
|
88
92
|
def errors?
|
89
|
-
data_hash.has_key?('errors')
|
93
|
+
data_hash.has_key?('errors') # should be only on 422
|
90
94
|
end
|
91
95
|
|
92
96
|
# A string rather than an object is returned by Shopify in the case of,
|
@@ -105,6 +109,13 @@ module Lucid
|
|
105
109
|
errors.map { |field, message| "#{field} #{message}" }
|
106
110
|
end
|
107
111
|
|
112
|
+
# @param messages [Array<String>]
|
113
|
+
#
|
114
|
+
# @return [Boolean]
|
115
|
+
def error_message?(messages)
|
116
|
+
messages.any? { |message| error_messages.include?(message) }
|
117
|
+
end
|
118
|
+
|
108
119
|
# @see Hash#each
|
109
120
|
def each(&block)
|
110
121
|
data_hash.each(&block)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucid-shopify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.36.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelsey Judson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|