shopify_api-graphql-tiny 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 642318b955f62a8f303f68ed41165130c2c282b2f37f71f54e4b0beb68978b7f
4
- data.tar.gz: 69d6fe346564ac10490119225043f3f338df160b7055bb74a3d30f24be4f00ff
3
+ metadata.gz: b83386464ba310b5225b0eaa43f9f2de9c942de2c1a1bd877e65b7aef41c4469
4
+ data.tar.gz: d6d6bc0d2a4dc61a0c430b712eadcf52dbd5355c4ed91a3a4c2b44e40933305f
5
5
  SHA512:
6
- metadata.gz: b6a3c1c73bc9604f96d4d8bb8ee3a30b34d3b7cfdf772069f2e62bcef7070e4c1098e6d35cf53f7fd5f040082775e80e66506b17718ba09c56deb9654244e764
7
- data.tar.gz: 350db8c3d0db2e212533a6593119cb3fbc1db7a274a239e35c8e208bed9ddee3bd45a48300ac6fb90478025ec21ea2d2a3cf0dc3a8ec900fb801e5f7f2633030
6
+ metadata.gz: 8b15b5bd7a5ce57beb926673041c803f822194ec1c32190a8b80099d4eda987c870084d08ab70d73f956a18b60a12130fb3b3d77846aa56d94346e254864aff6
7
+ data.tar.gz: 12235d40cea2cc700c6b74376521c4eec56369f7700232f3773d7ec08d5dd3254cb0e71ad5c2a1087591dcad6547d316841b28fcce0698d68bc097d40765ca62
data/Changes ADDED
@@ -0,0 +1,4 @@
1
+ 2022-06-08 v0.0.2
2
+ --------------------
3
+ * Add GraphQLError#response to return the parsed GQL response body
4
+ * Retry GraphQLError
@@ -1,7 +1,7 @@
1
1
  module ShopifyAPI
2
2
  module GraphQL
3
3
  class Tiny
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -13,7 +13,17 @@ module ShopifyAPI
13
13
  class Tiny
14
14
  Error = Class.new(StandardError)
15
15
  ConnectionError = Class.new(Error)
16
- GraphQLError = Class.new(Error)
16
+
17
+ class GraphQLError < Error
18
+ # Hash of failed GraphQL response
19
+ attr_reader :response
20
+
21
+ def initialize(message, response)
22
+ super(message)
23
+ @response = response
24
+ end
25
+ end
26
+
17
27
 
18
28
  class HTTPError < Error
19
29
  attr_reader :code
@@ -37,8 +47,14 @@ module ShopifyAPI
37
47
 
38
48
  ACCESS_TOKEN_HEADER = "X-Shopify-Access-Token"
39
49
  QUERY_COST_HEADER = "X-GraphQL-Cost-Include-Fields"
40
- DEFAULT_RETRY_OPTIONS = { ConnectionError => { :wait => 3, :tries => 20 }, HTTPError => { :wait => 3, :tries => 20 } }
50
+
41
51
  DEFAULT_HEADERS = { "Content-Type" => "application/json" }.freeze
52
+ DEFAULT_RETRY_OPTIONS = {
53
+ ConnectionError => { :wait => 3, :tries => 20 },
54
+ GraphQLError => { :wait => 3, :tries => 20 },
55
+ HTTPError => { :wait => 3, :tries => 20 }
56
+ }
57
+
42
58
  ENDPOINT = "https://%s/admin/api%s/graphql.json" # Note that we omit the "/" after API for the case where there's no version.
43
59
 
44
60
  ##
@@ -147,7 +163,7 @@ module ShopifyAPI
147
163
  return json
148
164
  end
149
165
 
150
- raise GraphQLError, prefix + errors
166
+ raise GraphQLError.new(prefix + errors, json)
151
167
  end
152
168
  end
153
169
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api-graphql-tiny
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
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shopify_api_retry
@@ -91,6 +91,7 @@ files:
91
91
  - ".github/workflows/ci.yml"
92
92
  - ".gitignore"
93
93
  - ".rspec"
94
+ - Changes
94
95
  - Gemfile
95
96
  - LICENSE.txt
96
97
  - README.md
@@ -119,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.7.6
123
+ rubygems_version: 3.1.4
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Lightweight, no-nonsense, Shopify Admin API GraphQL client with built-in