shopify_api-graphql-tiny 0.0.2 → 0.1.0

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: b83386464ba310b5225b0eaa43f9f2de9c942de2c1a1bd877e65b7aef41c4469
4
- data.tar.gz: d6d6bc0d2a4dc61a0c430b712eadcf52dbd5355c4ed91a3a4c2b44e40933305f
3
+ metadata.gz: 4c46728d688b8edf620e1d9e5d9f78b32dcb4dde40854996e2a42b66f642596b
4
+ data.tar.gz: 5640ff9490907231cb4d2a9bae7d8f4f96460265bfcd6d77572d4f90e2b758d7
5
5
  SHA512:
6
- metadata.gz: 8b15b5bd7a5ce57beb926673041c803f822194ec1c32190a8b80099d4eda987c870084d08ab70d73f956a18b60a12130fb3b3d77846aa56d94346e254864aff6
7
- data.tar.gz: 12235d40cea2cc700c6b74376521c4eec56369f7700232f3773d7ec08d5dd3254cb0e71ad5c2a1087591dcad6547d316841b28fcce0698d68bc097d40765ca62
6
+ metadata.gz: 5e1f350a6269fbb377f29c2342add0ae82b103aa940047995e5f377896e7c0ca0ca555b3eb4f9083bfea8edf8e3f310ae2caf99e7de5ac1b1451b6b12d45158e
7
+ data.tar.gz: 9c5fad042bcb6cb2b638178bfe7a0dc5920ca585b1e317c310b25be9ec6c79476c2cf6342bde98ad0c3a467b4864edf37a7cdf9153f4b2ddbe58b49def372b4a
data/Changes CHANGED
@@ -1,3 +1,8 @@
1
+ 2022-06-16 v0.1.0
2
+ --------------------
3
+ * Make RateLimitError a subclass of GraphQLError
4
+ * Set HTTP user-agent header
5
+
1
6
  2022-06-08 v0.0.2
2
7
  --------------------
3
8
  * Add GraphQLError#response to return the parsed GQL response body
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Lightweight, no-nonsense, Shopify GraphQL Admin API client with built-in retry.
4
4
 
5
- ![CI](https://github.com/ScreenStaring/shopify_api-graphql-tiny/actions/workflows/ci.yml/badge.svg)
5
+ [![CI](https://github.com/ScreenStaring/shopify_api-graphql-tiny/actions/workflows/ci.yml/badge.svg)](https://github.com/ScreenStaring/shopify_api-graphql-tiny/actions)
6
6
 
7
7
  ## Usage
8
8
 
@@ -1,7 +1,7 @@
1
1
  module ShopifyAPI
2
2
  module GraphQL
3
3
  class Tiny
4
- VERSION = "0.0.2"
4
+ VERSION = "0.1.0"
5
5
  end
6
6
  end
7
7
  end
@@ -24,6 +24,7 @@ module ShopifyAPI
24
24
  end
25
25
  end
26
26
 
27
+ RateLimitError = Class.new(GraphQLError)
27
28
 
28
29
  class HTTPError < Error
29
30
  attr_reader :code
@@ -34,14 +35,7 @@ module ShopifyAPI
34
35
  end
35
36
  end
36
37
 
37
- class RateLimitError < Error
38
- attr_reader :response
39
-
40
- def initialize(message, response)
41
- super(message)
42
- @response = response
43
- end
44
- end
38
+ USER_AGENT = "ShopifyAPI::GraphQL::Tiny v#{VERSION} (Ruby v#{RUBY_VERSION})"
45
39
 
46
40
  SHOPIFY_DOMAIN = ".myshopify.com"
47
41
 
@@ -71,7 +65,7 @@ module ShopifyAPI
71
65
  #
72
66
  # [:retry (Boolean|Hash)] +Hash+ can be retry config options. For the format see {ShopifyAPIRetry}[https://github.com/ScreenStaring/shopify_api_retry/#usage]. Defaults to +true+
73
67
  # [:version (String)] Shopify API version to use. Defaults to the latest version.
74
- # [:debug (Boolean)] Output the HTTP request/response to +STDERR+. Defaults to +false+.
68
+ # [:debug (Boolean|IO)] Output the HTTP request/response to +STDERR+ or to its value if it's an +IO+. Defaults to +false+.
75
69
  #
76
70
  # === Errors
77
71
  #
@@ -138,12 +132,18 @@ module ShopifyAPI
138
132
 
139
133
  post = Net::HTTP::Post.new(@endpoint.path)
140
134
  post.body = params.to_json
135
+ post["User-Agent"] = USER_AGENT
141
136
 
142
137
  @headers.each { |k,v| post[k] = v }
143
138
 
144
139
  request = Net::HTTP.new(@endpoint.host, @endpoint.port)
145
140
  request.use_ssl = true
146
- request.set_debug_output($stderr) if @options[:debug]
141
+
142
+ if @options[:debug]
143
+ request.set_debug_output(
144
+ @options[:debug].is_a?(IO) ? @options[:debug] : $stderr
145
+ )
146
+ end
147
147
 
148
148
  response = request.start { |http| http.request(post) }
149
149
  rescue => e
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.2
4
+ version: 0.1.0
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-06-08 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: shopify_api_retry
@@ -120,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.1.4
123
+ rubyforge_project:
124
+ rubygems_version: 2.7.6
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: Lightweight, no-nonsense, Shopify Admin API GraphQL client with built-in