shopify_api-graphql-request 0.1.0 → 0.1.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: bee339fb15f11c233c7dc08e8e7333282a4e3372ce44278437bbff81898fd9a7
4
- data.tar.gz: a83aaa1a7d828dc311ada7c1c4d65480d7bcef63cb3fa40f0e229978e8be25cb
3
+ metadata.gz: 8693e4abd154bf4592d8582f4f00c542a22440a47554529cabca27a2acca9102
4
+ data.tar.gz: 2baa318c0578781d9419bb7916d26eeb59a09783d4ccaddfe577d485a9a6a3da
5
5
  SHA512:
6
- metadata.gz: 3290890d3abc1b59a82b053d038cae873b0038b478253f7e12ea8a7ee20d2c216c3ae5e86e9d80f8970cdc4b6245e516c723ba34ac60b16a12e45a90b37a1d83
7
- data.tar.gz: f3e684ef553213512ff80f9252a171b32055746c1d9b4a1934cf4e470e30caf7ee594248ee5fbf42887435d25573be57d70be9d022ba1bfa4784e32d770bf34c
6
+ metadata.gz: 2ea1da8888f62de6903138ae9f116578f155e044a6375ee2646f8ae416c2b4ba53c903e7adc9922fa85d02d8d5f6cb48a9244251d78d9650d3f6a85019127177
7
+ data.tar.gz: dec264b7bcdf723b6e0da2ed3c5d7554f645797e5f4ace298effb046b2aca1da7077b977e2b06d46c82ce840af158c605e470787ee6d1b10a98b916929fc7b05
data/Changes CHANGED
@@ -1,3 +1,7 @@
1
+ v0.1.1 2026-11-11
2
+ --------------------
3
+ Improve robustness of token migration task when using a spreadsheet
4
+
1
5
  v0.1.0 2026-11-10
2
6
  --------------------
3
7
  Add OAuth::AccessToken to support Shopify expiring tokens
data/README.md CHANGED
@@ -290,8 +290,8 @@ bundle exec rake shopify_api:graphql:request:migrate_access_tokens SHOPIFY_API_K
290
290
  bundle exec rake shopify_api:graphql:request:migrate_access_tokens SHOPIFY_API_KEY=X SHOPIFY_API_SECRET=Y FILE=tokens.csv HANDLER=update_token.rb
291
291
  ```
292
292
 
293
- A single shop's tokens are always printed. `HANDLER=file.rb` is required with `FILE` (nothing is printed for CSV) and optional with `SHOP`. Use it to persist the new tokens. The file is `load`ed and must define `update_token(shop, tokens)`, which is called with the
294
- shop and the return value of `#migrate`:
293
+ A single shop's tokens are always printed. `HANDLER=file.rb` is required with `FILE` (nothing is printed for CSV) and optional with `SHOP`. Use it to persist the new tokens.
294
+ The file is `load`ed and must define `update_token(shop, tokens)`, which is called with the shop and the return value of `#migrate`:
295
295
 
296
296
  ```rb
297
297
  # update_token.rb
@@ -304,6 +304,8 @@ end
304
304
  bundle exec rake shopify_api:graphql:request:migrate_access_tokens SHOPIFY_API_KEY=X SHOPIFY_API_SECRET=Y FILE=tokens.csv HANDLER=update_token.rb
305
305
  ```
306
306
 
307
+ A summary of succeeded and failed shops (with the error for each failure) is printed when done. A failure for one shop does not stop the others; the task exits with status 1 if any shop failed.
308
+
307
309
  #### Recovering a Lost Response
308
310
 
309
311
  If a migration request fails or the response is lost, you can safely repeat the `#migrate` call with the original non-expiring token within
@@ -58,11 +58,15 @@ module ShopifyAPI
58
58
  #
59
59
  # === Returns
60
60
  #
61
- # [Array<Hash>] One +{ :shop => String, :result => Hash }+ per migrated shop
61
+ # [Array<Hash>] One status per shop, in input order:
62
+ # +{ :shop => String, :result => Hash, :error => nil }+ or
63
+ # +{ :shop => String, :result => nil, :error => String }+.
64
+ # Per-shop errors (+StandardError+, including those raised by the handler) are
65
+ # rescued so one failure does not stop the rest.
62
66
  #
63
67
  # === Errors
64
68
  #
65
- # ArgumentError, AccessToken::InvalidTokenError, AccessToken::Error
69
+ # ArgumentError for invalid input (before any shop is processed)
66
70
  #
67
71
  def run
68
72
  pairs = @shop ? [single_shop_and_token] : rows
@@ -111,7 +115,9 @@ module ShopifyAPI
111
115
 
112
116
  call_handler(result, shop) if @handler
113
117
 
114
- { :shop => shop, :result => result }
118
+ { :shop => shop, :result => result, :error => nil }
119
+ rescue StandardError => e
120
+ { :shop => shop, :result => nil, :error => "#{e.class}: #{e.message}" }
115
121
  end
116
122
 
117
123
  def call_handler(result, shop)
@@ -3,7 +3,7 @@
3
3
  module ShopifyAPI
4
4
  module GraphQL
5
5
  class Request
6
- VERSION = "0.1.0"
6
+ VERSION = "0.1.1"
7
7
  end
8
8
  end
9
9
  end
@@ -15,7 +15,7 @@ namespace :shopify_api do
15
15
  abort "SHOPIFY_API_SECRET required" if client_secret.empty?
16
16
 
17
17
  begin
18
- ShopifyAPI::GraphQL::Request::OAuth::AccessTokenMigrator.new(
18
+ statuses = ShopifyAPI::GraphQL::Request::OAuth::AccessTokenMigrator.new(
19
19
  client_id,
20
20
  client_secret,
21
21
  :shop => ENV["SHOP"],
@@ -26,6 +26,16 @@ namespace :shopify_api do
26
26
  rescue ArgumentError => e
27
27
  abort e.message
28
28
  end
29
+
30
+ failed, succeeded = statuses.partition { |status| status[:error] }
31
+
32
+ puts "Succeeded (#{succeeded.size}):"
33
+ succeeded.each { |status| puts " #{status[:shop]}" }
34
+
35
+ puts "Failed (#{failed.size}):"
36
+ failed.each { |status| puts " #{status[:shop]}: #{status[:error]}" }
37
+
38
+ exit 1 unless failed.empty?
29
39
  end
30
40
  end
31
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api-graphql-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-11-10 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shopify_api-graphql-tiny