shopify_graphql 0.3.0 → 0.4.1

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: f83ddde3e8efc1ff6c4a0f3659bd9472dfe913263b7abc0abc1a54d19d53f52b
4
- data.tar.gz: d11009b737947b6ae12f6a937fc20f31f95c3b1ab24789ddb029c5cf67c88bd3
3
+ metadata.gz: 21b4a873e0cc66c1e23474a6a8ca3ea2494aa8e42e202efef805119191d11d3f
4
+ data.tar.gz: e182f04e2d786bac83085e8f5117bf84af4f2e9373ee185d1263632b15ec6345
5
5
  SHA512:
6
- metadata.gz: 63267a73113766a3a219f3d2594ee2a9111487cf46189d9a68185d012fb10d468b9d4e0a268cf49501ed9f0e9af7b1ef7e01d6f0080d4e5487fee7012eb99ca8
7
- data.tar.gz: e3e83f19fa77eb179f15f6331f1850adb6f4841848c0622420afc22808387c48dce1c3de593cdb1330230091d6f79a50e321031b7d4b046b332b4ff01ffebdb7
6
+ metadata.gz: b167b5b9ac039c1c353228d3ee5d8abd412baebe908d8828fb93ff1c2d023bbd6690075e10a1dc01fdbaaa966b88f07ed164ca6686983a27557a63ef61fb3702
7
+ data.tar.gz: be973dee48594d75a347ab63b0569e75395bcd6c20e4fb7871730cc4c01037498b0831fc500356648d8b3e03cf55e85a60e7287df9ac5a634efe57a013a48fa0
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Less painful way to work with [Shopify Graphql API](https://shopify.dev/api/admin/graphql/reference) in Ruby.
4
4
 
5
- > **This library is under active development. Breaking changes are likely until stable release.**
5
+ > **NOTE: The library only supports `shopify_api` < 10.0 at the moment.**
6
6
 
7
7
  ## Features
8
8
 
@@ -10,8 +10,8 @@ Less painful way to work with [Shopify Graphql API](https://shopify.dev/api/admi
10
10
  - Graphql webhooks integration
11
11
  - Built-in error handling
12
12
  - No schema and no memory issues
13
+ - Buil-in retry on error
13
14
  - (Planned) Testing helpers
14
- - (Planned) Buil-in retry on error
15
15
  - (Planned) Pre-built calls for common Graphql operations
16
16
 
17
17
  ## Usage
@@ -21,6 +21,10 @@ module ShopifyGraphql
21
21
  private
22
22
 
23
23
  def parse_data(data)
24
+ unless data.node
25
+ raise ResourceNotFound.new(200, "Subscription not found")
26
+ end
27
+
24
28
  OpenStruct.new(
25
29
  subscription: AppSubscriptionFields.parse(data.node),
26
30
  )
@@ -1,5 +1,16 @@
1
1
  module ShopifyGraphql
2
2
  class Client
3
+ RETRIABLE_EXCEPTIONS = [
4
+ Errno::ETIMEDOUT,
5
+ Errno::ECONNREFUSED,
6
+ Errno::EHOSTUNREACH,
7
+ 'Timeout::Error',
8
+ Faraday::TimeoutError,
9
+ Faraday::RetriableResponse,
10
+ Faraday::ParsingError,
11
+ Faraday::ConnectionFailed,
12
+ ].freeze
13
+
3
14
  def initialize(api_version = ShopifyAPI::Base.api_version)
4
15
  @api_version = api_version
5
16
  end
@@ -29,6 +40,7 @@ module ShopifyGraphql
29
40
  @connection ||= Faraday.new(url: api_url, headers: request_headers) do |conn|
30
41
  conn.request :json
31
42
  conn.response :json, parser_options: { object_class: OpenStruct }
43
+ conn.request :retry, max: 3, interval: 1, backoff_factor: 2, exceptions: RETRIABLE_EXCEPTIONS
32
44
  end
33
45
  end
34
46
 
@@ -1,3 +1,3 @@
1
1
  module ShopifyGraphql
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Platonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-11 00:00:00.000000000 Z
11
+ date: 2022-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: shopify_api
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: shopify_app
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.2.22
138
+ rubygems_version: 3.2.33
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Less painful way to work with Shopify Graphql API in Ruby.