lucid-shopify 0.62.0 → 0.63.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lucid/shopify/bulk_request.rb +19 -10
- data/lib/lucid/shopify/version.rb +1 -1
- 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: 64a496caf54972765537cc4b855f189aca434633532751a0e7fea98bb2d1b88a
|
4
|
+
data.tar.gz: 233680126ea1eef07851305fdff2e33d194892a51ad61898f19c81f636224cd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc6206e1bffc144cfc56a0c3413196e693a52a1a998aef65368cc4ca5e513e8bbfef94601292a2b3cf96def27aa5c1ee4003dbd4afb79388de3d50c4b4088ea3
|
7
|
+
data.tar.gz: 8d546eaa76261554880a7695f1c559510d720e3f23de8c3b5baa4e23f1db885cbd2c1991c2ea7137e58dae0c1c2237612b50d1d44cefc98fb24326b3d214c91e
|
@@ -14,6 +14,8 @@ module Lucid
|
|
14
14
|
FailedOperationError = Class.new(OperationError)
|
15
15
|
ObsoleteOperationError = Class.new(OperationError)
|
16
16
|
|
17
|
+
TimeoutError = Class.new(Error)
|
18
|
+
|
17
19
|
class Operation
|
18
20
|
include Dry::Initializer.define -> do
|
19
21
|
# @return [Client]
|
@@ -32,6 +34,11 @@ module Lucid
|
|
32
34
|
# @param http [HTTP::Client]
|
33
35
|
#
|
34
36
|
# @yield [Enumerator<Hash>] yields each parsed line of JSONL
|
37
|
+
#
|
38
|
+
# @raise CanceledOperationError
|
39
|
+
# @raise ExpiredOperationError
|
40
|
+
# @raise FailedOperationError
|
41
|
+
# @raise ObsoleteOperationError
|
35
42
|
def call(delay: 1, http: Container[:http], &block)
|
36
43
|
url = loop do
|
37
44
|
status, url = poll
|
@@ -71,6 +78,9 @@ module Lucid
|
|
71
78
|
end
|
72
79
|
|
73
80
|
# Cancel the bulk operation.
|
81
|
+
#
|
82
|
+
# @raise ObsoleteOperationError
|
83
|
+
# @raise TimeoutError
|
74
84
|
def cancel
|
75
85
|
begin
|
76
86
|
client.post_graphql(credentials, <<~QUERY)
|
@@ -96,25 +106,24 @@ module Lucid
|
|
96
106
|
|
97
107
|
# Poll until operation status is met.
|
98
108
|
#
|
99
|
-
# @param statuses [Array<
|
109
|
+
# @param statuses [Array<String>] to terminate polling on
|
100
110
|
# @param timeout [Integer] in seconds
|
101
111
|
#
|
102
|
-
# @raise
|
112
|
+
# @raise ObsoleteOperationError
|
113
|
+
# @raise TimeoutError
|
103
114
|
def poll_until(statuses, timeout: 60)
|
104
115
|
Timeout.timeout(timeout) do
|
105
116
|
loop do
|
106
117
|
status, _ = poll
|
107
118
|
|
108
|
-
break if statuses.any?
|
109
|
-
case expected_status
|
110
|
-
when Regexp
|
111
|
-
status.match?(expected_status)
|
112
|
-
when String
|
113
|
-
status == expected_status
|
114
|
-
end
|
115
|
-
end
|
119
|
+
break if statuses.any? { |expected_status| status == expected_status }
|
116
120
|
end
|
117
121
|
end
|
122
|
+
rescue Timeout::Error
|
123
|
+
raise TimeoutError, 'exceeded %s seconds polling for status %s' % [
|
124
|
+
timeout,
|
125
|
+
statuses.join(', '),
|
126
|
+
]
|
118
127
|
end
|
119
128
|
|
120
129
|
# @return [Array(String, String | nil)] the operation status and the
|
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.63.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: 2020-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|