simple_graphql_client 0.2.0 → 0.3.0
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 +4 -4
- data/Changelog.md +7 -1
- data/Gemfile.lock +2 -1
- data/lib/simple_graphql_client/client.rb +7 -4
- data/lib/simple_graphql_client/version.rb +1 -1
- metadata +3 -4
- data/simple_graphql_client-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 773807324a20dfec2c2ce74fa29afa75e522ea6415ea7130418224605657e31e
|
4
|
+
data.tar.gz: dfe5829570cbdfebaea360833d416d811d920519e13d5448db689fd046698e91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e4337daeda20eb84a9de29d09f941bb9a865e1af83d895999313d5374f4befa71d57dda9a4704c0d6c8aef44701f927b771eaa4eba48c13676b89d1ecd33cd2
|
7
|
+
data.tar.gz: 0c60f572296a6efabf85bab88dc1f0bee61916626d23ce604bb54d9562fa980f8722ab6187f8e6493967ac9443d5c6cba4c3fde1744a90ea961ad6744ee5de9d
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -5,9 +5,12 @@ require "json"
|
|
5
5
|
|
6
6
|
module SimpleGraphqlClient
|
7
7
|
class Client
|
8
|
-
|
8
|
+
attr_reader :options
|
9
|
+
|
10
|
+
def initialize(url:, options: {}, &block)
|
9
11
|
@url = url
|
10
|
-
@options =
|
12
|
+
@options = options
|
13
|
+
@request_options = block
|
11
14
|
end
|
12
15
|
|
13
16
|
def query(gql:, variables: {})
|
@@ -15,14 +18,14 @@ module SimpleGraphqlClient
|
|
15
18
|
query: gql,
|
16
19
|
variables: variables
|
17
20
|
}.to_json, request_options)
|
18
|
-
handle_response(JSON.parse(response.body, object_class: OpenStruct))
|
21
|
+
handle_response(JSON.parse(response.body, object_class: options.fetch(:parsing_class, OpenStruct)))
|
19
22
|
end
|
20
23
|
|
21
24
|
private
|
22
25
|
|
23
26
|
def request_options
|
24
27
|
base_options = { content_type: :json }
|
25
|
-
options = @
|
28
|
+
options = @request_options ? @request_options.call : {}
|
26
29
|
base_options.merge(options)
|
27
30
|
end
|
28
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_graphql_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christophe Verbinnen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -48,7 +48,6 @@ files:
|
|
48
48
|
- lib/simple_graphql_client/client.rb
|
49
49
|
- lib/simple_graphql_client/errors/query_error.rb
|
50
50
|
- lib/simple_graphql_client/version.rb
|
51
|
-
- simple_graphql_client-0.1.0.gem
|
52
51
|
- simple_graphql_client.gemspec
|
53
52
|
homepage: https://github.com/djpate/simple-graphql-client
|
54
53
|
licenses:
|
@@ -72,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
71
|
- !ruby/object:Gem::Version
|
73
72
|
version: '0'
|
74
73
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
74
|
+
rubygems_version: 3.1.6
|
76
75
|
signing_key:
|
77
76
|
specification_version: 4
|
78
77
|
summary: Dead simple GQL client
|
Binary file
|