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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a733a4c42a0abd03c46fbe63cae65c00c8ebc5c3ea293e2ba97e952dd8f27c8
4
- data.tar.gz: 2e120b0bdafa8e823f7720be8d339709fecbac979f7e52cb34b851dc4c281410
3
+ metadata.gz: 773807324a20dfec2c2ce74fa29afa75e522ea6415ea7130418224605657e31e
4
+ data.tar.gz: dfe5829570cbdfebaea360833d416d811d920519e13d5448db689fd046698e91
5
5
  SHA512:
6
- metadata.gz: a6455f8aec6ee8c635a615795c1f2958b7bfb4f9e48566a89398bdf0ae9a106a80dc3bbff6f98a3ee97c7335e3a0e20c1534ea61ec6b67832e6ad9906bbe0e98
7
- data.tar.gz: 7e7ee2fb4473d9fb9e763e097bebeb7ca2a77cd28f062506bd089ca8393e2557853f7eafa4c1efb866c6a7334473f27b436e8bc88389fd71c254de03d36e8152
6
+ metadata.gz: 3e4337daeda20eb84a9de29d09f941bb9a865e1af83d895999313d5374f4befa71d57dda9a4704c0d6c8aef44701f927b771eaa4eba48c13676b89d1ecd33cd2
7
+ data.tar.gz: 0c60f572296a6efabf85bab88dc1f0bee61916626d23ce604bb54d9562fa980f8722ab6187f8e6493967ac9443d5c6cba4c3fde1744a90ea961ad6744ee5de9d
data/Changelog.md CHANGED
@@ -1,3 +1,9 @@
1
- 0.1.0 - 08/13/2021
1
+ 0.3.0 - 09/06/2022
2
+ Allow specifying the parsing class
3
+
4
+ 0.2.0 - 08/13/2021
5
+ Use openstruct
2
6
 
7
+ 0.1.0 - 08/13/2021
8
+ ------------------
3
9
  Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_graphql_client (0.2.0)
4
+ simple_graphql_client (0.3.0)
5
5
  rest-client (~> 2.1)
6
6
 
7
7
  GEM
@@ -61,6 +61,7 @@ GEM
61
61
  unicode-display_width (1.7.0)
62
62
 
63
63
  PLATFORMS
64
+ ruby
64
65
  x86_64-linux
65
66
 
66
67
  DEPENDENCIES
@@ -5,9 +5,12 @@ require "json"
5
5
 
6
6
  module SimpleGraphqlClient
7
7
  class Client
8
- def initialize(url:, &block)
8
+ attr_reader :options
9
+
10
+ def initialize(url:, options: {}, &block)
9
11
  @url = url
10
- @options = block
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 = @options ? @options.call : {}
28
+ options = @request_options ? @request_options.call : {}
26
29
  base_options.merge(options)
27
30
  end
28
31
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SimpleGraphqlClient
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
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.2.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: 2021-08-13 00:00:00.000000000 Z
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.2.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