shopify_api-graphql-tiny 1.0.0 → 1.0.1
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/Changes +4 -0
- data/README.md +8 -1
- data/lib/shopify_api/graphql/tiny/version.rb +1 -1
- data/lib/shopify_api/graphql/tiny.rb +13 -10
- 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: 5e48648295daa6495ff73f0415253f062439c876620351d00b90da3ec98ba700
|
|
4
|
+
data.tar.gz: 6789cbc730bc6f98f8ac89d63f1a9b57b043a990c685250f3992e8e4756f8a26
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e22a8f947de401a3e8ca218486d5ac9e6c396b091d848d189b3564790b4f1b2dcca3e3b32f651698cee5030908ec1aa3926df31c013153b407cb0b466a8624ba
|
|
7
|
+
data.tar.gz: 313dc8dcb7058042be6b39240f5177123bd4498d8ddae770801324875e187b5b625246f49b34e1b62ca2b87c0d94d51156a5ecf43b8829e0fcc7ab5378d5c735
|
data/Changes
CHANGED
data/README.md
CHANGED
|
@@ -97,7 +97,7 @@ These can be overridden globally (by assigning to the constant) or per instance:
|
|
|
97
97
|
gql = ShopifyAPI::GraphQL::Tiny.new(shop, token, :max_attempts => 20, :max_delay => 90)
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
`ShopifyAPI::GraphQL::Tiny::DEFAULT_RETRY_ERRORS` determines what is retried. It contains
|
|
100
|
+
`ShopifyAPI::GraphQL::Tiny::DEFAULT_RETRY_ERRORS` determines what is retried. It contains HTTP status codes, Shopify GraphQL errors codes, and exception classes.
|
|
101
101
|
By default it contains:
|
|
102
102
|
|
|
103
103
|
* `"5XX"` - Any HTTP 5XX status
|
|
@@ -160,6 +160,13 @@ pager.execute(query, :foo => 123) do |page|
|
|
|
160
160
|
end
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
+
If a block is not given an `Enumerator::Lazy` instance is returned that will fetch the next page upon each iteration:
|
|
164
|
+
|
|
165
|
+
```rb
|
|
166
|
+
results = pager.execute(query, :foo => 123)
|
|
167
|
+
results.each { |page| ... }
|
|
168
|
+
```
|
|
169
|
+
|
|
163
170
|
#### `after` Pagination
|
|
164
171
|
|
|
165
172
|
To use `after` pagination, i.e., to paginate forward, your query must:
|
|
@@ -348,19 +348,22 @@ module ShopifyAPI
|
|
|
348
348
|
variables ||= {}
|
|
349
349
|
pagination_finder = @options[@options[:direction]]
|
|
350
350
|
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
enumerator = Enumerator.new do |y|
|
|
352
|
+
loop do
|
|
353
|
+
page = @gql.execute(q, variables)
|
|
354
|
+
y << page
|
|
353
355
|
|
|
354
|
-
|
|
356
|
+
cursor = pagination_finder[page]
|
|
357
|
+
break unless cursor
|
|
355
358
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
next_page_variables = variables.dup
|
|
360
|
-
next_page_variables[@options[:variable]] = cursor
|
|
361
|
-
#break unless next_page_variables != variables
|
|
359
|
+
variables[@options[:variable]] = cursor
|
|
360
|
+
end
|
|
361
|
+
end
|
|
362
362
|
|
|
363
|
-
|
|
363
|
+
if block_given?
|
|
364
|
+
enumerator.each { |page| yield page }
|
|
365
|
+
else
|
|
366
|
+
enumerator.lazy
|
|
364
367
|
end
|
|
365
368
|
end
|
|
366
369
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shopify_api-graphql-tiny
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Skye Shaw
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-01-
|
|
10
|
+
date: 2026-01-24 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: net_http_timeout_errors
|