shopify_api_bruv 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/shopify_api_bruv/resources/graphql/resource.rb +5 -7
- data/lib/shopify_api_bruv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 071160b2ae93014ee98671f497785156a97fb15784e1b667af8fcfb8c0578531
|
4
|
+
data.tar.gz: 82b819215557f3c9f4f9a15adffe1cd3e5981f393ab03a80c8556fe8ced971b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8709e9ca0f3636aabbab6b6a8eefa94a0f50948021a09d287270d2e455f66563cb834bf24e26ff8b1428495f8720693396c89e4ff7a725d21937e2fc95bbeb43
|
7
|
+
data.tar.gz: 66135b6719c383bd0ff6a80e1ea7d13e0d1c5578a22c9b918fbe6904d52c8c3547ec1004df3e613a7e6503f6eeabdb8bc6181f2001a6182c0113de85f13a317c
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -4,29 +4,27 @@ module ShopifyApiBruv
|
|
4
4
|
module Resources
|
5
5
|
module Graphql
|
6
6
|
class Resource < Base
|
7
|
-
attr_reader :client
|
7
|
+
attr_reader :client
|
8
8
|
attr_accessor :query
|
9
9
|
|
10
10
|
MAX_TRIES = ENV.fetch('SHOPIFY_API_BRUV_REQUEST_MAX_TRIES', 3).to_i
|
11
11
|
SLEEP_TIMER = ENV.fetch('SHOPIFY_API_BRUV_REQUEST_SLEEP_TIMER', 4).to_i
|
12
12
|
|
13
|
-
def initialize(config
|
13
|
+
def initialize(config:)
|
14
14
|
@client = Clients::Graphql::Client.new(config:)
|
15
|
-
@variables = variables
|
16
|
-
@mutation_object_name = mutation_object_name
|
17
15
|
end
|
18
16
|
|
19
|
-
def request(tries: 0)
|
17
|
+
def request(variables: nil, mutation_object_name: nil, tries: 0)
|
20
18
|
raise NotImplementedError, 'Please set a query in the derived class' if query.nil?
|
21
19
|
|
22
20
|
response = client.request(query:, variables:)
|
23
21
|
|
24
|
-
handle_response(response:, query:, variables:, tries:)
|
22
|
+
handle_response(response:, query:, variables:, mutation_object_name:, tries:)
|
25
23
|
end
|
26
24
|
|
27
25
|
private
|
28
26
|
|
29
|
-
def handle_response(response:, query:, variables:, tries:)
|
27
|
+
def handle_response(response:, query:, variables:, mutation_object_name:, tries:)
|
30
28
|
body = response.body
|
31
29
|
|
32
30
|
handle_response_errors(body:, query:, variables:, tries:)
|