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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c827a0b468aeb34cfb05760a7a1a25e641c61f21f6d2d15c4ed8a05b29bd383b
4
- data.tar.gz: 23b357593431fb8beda6a29689b6b90e4101fde3cac2eaaad38c7a2cb48f1437
3
+ metadata.gz: 5e48648295daa6495ff73f0415253f062439c876620351d00b90da3ec98ba700
4
+ data.tar.gz: 6789cbc730bc6f98f8ac89d63f1a9b57b043a990c685250f3992e8e4756f8a26
5
5
  SHA512:
6
- metadata.gz: 7fe6d5f27b0936703ce4f7f45875406ab11069d41f8e83e9d57a873ce5dd63d1093e88219cd8b5b69eed2bdd3b39bb233292360aa8bb4534f5a799690cceab5f
7
- data.tar.gz: d7231b2be188d9bedbfa92f6de69a0ee4c082b8801633db73c570c7cef6c6a349afc81e942e2f36b685edf26a02d9e74817595d7b4988298f42092182a49a718
6
+ metadata.gz: e22a8f947de401a3e8ca218486d5ac9e6c396b091d848d189b3564790b4f1b2dcca3e3b32f651698cee5030908ec1aa3926df31c013153b407cb0b466a8624ba
7
+ data.tar.gz: 313dc8dcb7058042be6b39240f5177123bd4498d8ddae770801324875e187b5b625246f49b34e1b62ca2b87c0d94d51156a5ecf43b8829e0fcc7ab5378d5c735
data/Changes CHANGED
@@ -1,3 +1,7 @@
1
+ 2026-01-24 v1.0.1
2
+ --------------------
3
+ * Add support for calling #paginate without a block
4
+
1
5
  2026-01-20 v1.0.0
2
6
  --------------------
3
7
  * Add support for exponential backoff and remove ShopifyAPIRetry
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 and HTTP statuses codes, Shopify GraphQL errors codes, and exceptions.
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:
@@ -3,7 +3,7 @@
3
3
  module ShopifyAPI
4
4
  module GraphQL
5
5
  class Tiny
6
- VERSION = "1.0.0"
6
+ VERSION = "1.0.1"
7
7
  end
8
8
  end
9
9
  end
@@ -348,19 +348,22 @@ module ShopifyAPI
348
348
  variables ||= {}
349
349
  pagination_finder = @options[@options[:direction]]
350
350
 
351
- loop do
352
- page = @gql.execute(q, variables)
351
+ enumerator = Enumerator.new do |y|
352
+ loop do
353
+ page = @gql.execute(q, variables)
354
+ y << page
353
355
 
354
- yield page
356
+ cursor = pagination_finder[page]
357
+ break unless cursor
355
358
 
356
- cursor = pagination_finder[page]
357
- break unless cursor
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
- variables = next_page_variables
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.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-20 00:00:00.000000000 Z
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