shopify_api-graphql-request 0.0.1 → 0.0.2

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: 0ac24b90edcc2ac73f86627c06801e1ef9ae67a470cd466befaacc920009e9c3
4
- data.tar.gz: 8f56fd88505e60ce25cd4287b7ac781e9874f8507cf76a83080277953bec152a
3
+ metadata.gz: 392d3a9629abbbe7f7c768b5d2af6597f90dfc5728c4c55d2908d41730b66497
4
+ data.tar.gz: 790ba7b6a275ef632d0a43b86e4b141065ebd2a6bde41bc5b90bff7961018b96
5
5
  SHA512:
6
- metadata.gz: 5cbb9adffc7ce34f8a46eee7698955153402ca5bd72232bf25653409d99be4c766b8cddf302ec7e42506c0db26d3e76e877c08b640750aec7306c1424c5781ea
7
- data.tar.gz: 5aa3ddc3ba5dca7315e3a1a9e3af2f80389f3391cd09dae55986f8ba47d43319f70dd134808a34819105616ca4e38bc31054a2611294d58e76a15a57e1f7d39d
6
+ metadata.gz: 65b742996ac8a08a6e878424c0f293ccc3d899cd55a7a562de76eccb559d63163738faf0a3dfe1cc6f87e7cb9104cd04473c549b5f802e86f2b336973d7001d0
7
+ data.tar.gz: d8644370482c62f2aa95d22eaf7e59e406d7e32754b6ce48d70a0f0ad5cc0753d38ca13c7770f0dfaddbfd9ef4edb6cd1a0f78dd48d14aaa20f108f1b915b84f
data/Changes ADDED
@@ -0,0 +1,4 @@
1
+ v0.0.2 2026-04-19
2
+ --------------------
3
+ Require TinyGID >= 0.1.2. This version allows one to call #parse and #to_s methods on #gid.
4
+ Make #transform_keys private to communicate to implementors that it should not be called
data/README.md CHANGED
@@ -5,11 +5,36 @@ Comes with built-in retry, pagination, error handling, and more!
5
5
 
6
6
  ## Usage
7
7
 
8
- It's recommended to organize queries and mutations by subclassing `ShopifyAPI::GraphQL::Request`:
8
+ Queries:
9
9
 
10
10
  ```rb
11
11
  require "shopify_api/graphql/request"
12
12
 
13
+ request = ShopifyAPI::GraphQL::Request.new("a-shop", token)
14
+
15
+ begin
16
+ product = request.execute(query, :id => "gid://shopify/Product/123").dig(:data, :product)
17
+ p product[:title]
18
+ p product[:description_html]
19
+ rescue ShopifyAPI::GraphQL::Request::NotFoundError => e
20
+ p e
21
+ end
22
+ ```
23
+
24
+ And mutations:
25
+
26
+ ```rb
27
+ begin
28
+ product = request.execute(mutation, :id => "gid://shopify/Product/123", :title => "Foo Hoo!").dig(:data, :product)
29
+ rescue ShopifyAPI::GraphQL::Request::UserError => e
30
+ p e
31
+ end
32
+ ```
33
+
34
+ If your application contains a lot of query and/or mutations it's recommended to organize them by
35
+ subclassing `ShopifyAPI::GraphQL::Request`:
36
+
37
+ ```rb
13
38
  class ShopifyProduct < ShopifyAPI::GraphQL::Request
14
39
  # Define your queries/mutations
15
40
  FIND =<<-GQL
@@ -149,37 +174,25 @@ class ShopifyProduct < ShopifyAPI::GraphQL::Request
149
174
  end
150
175
  ```
151
176
 
152
- ### Making Requests Without Subclassing
153
-
154
- Of course you can make requests directly on an instance of `ShopifyAPI::GraphQL::Request`:
155
-
156
- ```rb
157
- require "shopify_api/graphql/request"
177
+ ### More Info
158
178
 
159
- request = ShopifyAPI::GraphQL::Request.new("a-shop", token)
179
+ For more information checkout [the API docs](https://rdoc.info/gems/shopify_api-graphql-request)
160
180
 
161
- begin
162
- product = request.execute(query, :id => "gid://shopify/Product/123").dig(:data, :product)
163
- p product[:title]
164
- p product[:description_html]
165
- rescue ShopifyAPI::GraphQL::Request::NotFoundError => e
166
- p e
167
- end
168
- ```
181
+ ## Why Use This Instead of Shopify's API Client?
169
182
 
170
- And mutations:
183
+ - Easy-to-use
184
+ - Built-in retry
185
+ - Built-in pagination
186
+ - Improved exception handling
187
+ - You can use `:snake_case` hash keys
188
+ - Lightweight
171
189
 
172
- ```rb
173
- begin
174
- product = request.execute(mutation, :id => "gid://shopify/Product/123", :title => "Foo Hoo!").dig(:data, :product)
175
- rescue ShopifyAPI::GraphQL::Request::UserError => e
176
- p e
177
- end
178
- ```
190
+ Overall, Shopify's API client is bloated trash that will give you development headaches and long-term maintenance nightmares.
179
191
 
180
- ### More Info
192
+ We used to use it, staring way back in 2015, but eventually had to pivot away from their Ruby libraries due to developer
193
+ frustration and high maintenance cost (and don't get us started on the ShopifyApp gem!@#).
181
194
 
182
- For more information checkout [the API docs](https://rdoc.info/gems/shopify_api-graphql-request)
195
+ For more information see: https://github.com/Shopify/shopify-api-ruby/issues/1181
183
196
 
184
197
  ## Testing
185
198
 
@@ -188,7 +201,6 @@ For more information checkout [the API docs](https://rdoc.info/gems/shopify_api-
188
201
  ## See Also
189
202
 
190
203
  - [Shopify Dev Tools](https://github.com/ScreenStaring/shopify-dev-tools/) - Command-line program to assist with the development and/or maintenance of Shopify apps and stores
191
- - [Shopify ID Export](https://github.com/ScreenStaring/shopify_id_export/) - Dump Shopify product and variant IDs —along with other identifiers— to a CSV or JSON file
192
204
  - [`ShopifyAPI::GraphQL::Tiny`](https://github.com/ScreenStaring/shopify_api-graphql-tiny/) - Lightweight, no-nonsense, Shopify GraphQL Admin API client with built-in pagination and retry
193
205
  - [`TinyGID`](https://github.com/sshaw/tiny_gid/) - Build Global ID (`gid://`) URI strings from scalar values
194
206
 
@@ -198,4 +210,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
198
210
 
199
211
  ---
200
212
 
201
- Made by [ScreenStaring](http://screenstaring.com)
213
+ Made by [ScreenStaring](https://screenstaring.com)
@@ -3,7 +3,7 @@
3
3
  module ShopifyAPI
4
4
  module GraphQL
5
5
  class Request
6
- VERSION = "0.0.1"
6
+ VERSION = "0.0.2"
7
7
  end
8
8
  end
9
9
  end
@@ -89,9 +89,9 @@ module ShopifyAPI
89
89
  #
90
90
  # These override the instance's defaults for a single query or mutation.
91
91
  #
92
- # [:raise_if_not_found (Boolean)]
93
- # [:raise_if_user_errors (Boolean)]
94
- # [:snake_case (Boolean)]
92
+ # [:raise_if_not_found (Boolean)] - raise a `ShopifyAPI::GraphQL::Request::NotFoundError` if query target is not found; defaults to +true+
93
+ # [:raise_if_user_errors (Boolean)] - raise a `ShopifyAPI::GraphQL::Request::UserError` if the response contains them; defaults to +true+
94
+ # [:snake_case (Boolean)] - Accept `:snake_case`-style hash keys and returned response hash keys to be snake_case; defaults to +true+
95
95
  #
96
96
  # === Returns
97
97
  #
@@ -137,7 +137,7 @@ module ShopifyAPI
137
137
  #
138
138
  # === Errors
139
139
  #
140
- # See #execute
140
+ # See #execute
141
141
  #
142
142
  def paginate(query, variables = nil, options = nil)
143
143
  options = @options.merge(options || {})
@@ -189,6 +189,8 @@ module ShopifyAPI
189
189
  transform_keys(object) { |key| Strings::Case.snakecase(key).to_sym }
190
190
  end
191
191
 
192
+ private
193
+
192
194
  def transform_keys(object, &transformer)
193
195
  case object
194
196
  when Hash
metadata CHANGED
@@ -1,13 +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.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skye Shaw
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 2026-01-24 00:00:00.000000000 Z
11
+ date: 2026-04-19 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: shopify_api-graphql-tiny
@@ -35,14 +36,20 @@ dependencies:
35
36
  requirements:
36
37
  - - ">="
37
38
  - !ruby/object:Gem::Version
38
- version: '0'
39
+ version: 0.1.2
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2'
39
43
  type: :runtime
40
44
  prerelease: false
41
45
  version_requirements: !ruby/object:Gem::Requirement
42
46
  requirements:
43
47
  - - ">="
44
48
  - !ruby/object:Gem::Version
45
- version: '0'
49
+ version: 0.1.2
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '2'
46
53
  - !ruby/object:Gem::Dependency
47
54
  name: strings-case
48
55
  requirement: !ruby/object:Gem::Requirement
@@ -99,6 +106,7 @@ dependencies:
99
106
  - - "~>"
100
107
  - !ruby/object:Gem::Version
101
108
  version: '3.0'
109
+ description:
102
110
  email:
103
111
  - skye.shaw@gmail.com
104
112
  executables: []
@@ -107,11 +115,13 @@ extra_rdoc_files: []
107
115
  files:
108
116
  - ".env.template"
109
117
  - ".rspec"
118
+ - Changes
110
119
  - LICENSE.txt
111
120
  - README.md
112
121
  - Rakefile
113
122
  - lib/shopify_api/graphql/request.rb
114
123
  - lib/shopify_api/graphql/request/version.rb
124
+ homepage:
115
125
  licenses:
116
126
  - MIT
117
127
  metadata:
@@ -119,6 +129,7 @@ metadata:
119
129
  changelog_uri: https://github.com/ScreenStaring/shopify_api-graphql-request/blob/master/Changes
120
130
  documentation_uri: https://rubydoc.info/gems/shopify_api-graphql-request
121
131
  source_code_uri: https://github.com/ScreenStaring/shopify_api-graphql-request
132
+ post_install_message:
122
133
  rdoc_options: []
123
134
  require_paths:
124
135
  - lib
@@ -133,7 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
144
  - !ruby/object:Gem::Version
134
145
  version: '0'
135
146
  requirements: []
136
- rubygems_version: 3.6.2
147
+ rubygems_version: 3.5.16
148
+ signing_key:
137
149
  specification_version: 4
138
150
  summary: Small class to simplify the writing and handling of GraphQL queries and mutations
139
151
  for the Shopify Admin API. Comes with built-in retry, pagination, error handling,