graphql_connector 1.3.0 → 1.3.1

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: dec05781e16009638ffb57356c4b648730b6d04eb60129211cc1f462c6b1db77
4
- data.tar.gz: fde0b8313c159ae15b43b3aa050c53c710902854080459e41d7da28595226c8d
3
+ metadata.gz: 4b8c2af2590f1daf462e0f348e64078c530a4c7f6833a7d8692e6bada0f11291
4
+ data.tar.gz: 52edb3725223b2538f91b1904fa57a071ab0b43b853f37f23242e1dbb8d7eb50
5
5
  SHA512:
6
- metadata.gz: 4a30c45c22bc87d78bc34377c1bca7e40c78d72c96a8d1e840ee89aec119cacfc01b1a517c86c5ca2867573a160742382bd3bf9ce02f256e8e8f42313b36aa5b
7
- data.tar.gz: 218116c1728b4da4583e709435df2f2e1ba3477edcae34ec0958f398e42ccad3fdee8b80d3de1cc3312c4d7cae9a97add6384273d2cc162a4a86031dd4c5f149
6
+ metadata.gz: c82b787552cf4590bae68e4eb15103252a47660ba4a8b2d7645deb9e218034cadbca24feaf9ef610818106e322fc7916a91fdd3726d251e49c0051224666d3c2
7
+ data.tar.gz: 491988a32bc66f1d597d32dbf0164b5f5a23a87923ac6d4da3c0fbc8272de1b6721ba8657b35e99ad221a9bcb2860431964e22281fcba341da36f3f5dd49ba1e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.3.1 (2021-06-04)
2
+
3
+ * add more specs to test headers and connectors
4
+ * make the headers option optinal
5
+ * update the readme to explain the connector functionality better
6
+
1
7
  ## 1.3.0 (2021-06-02)
2
8
 
3
9
  * add the option to use a connector instead of init header for authorization
data/README.md CHANGED
@@ -35,14 +35,22 @@ end
35
35
  ```
36
36
 
37
37
  The connector is expecting that it contains a `base` connector instance and a
38
- `method` parameter as string, where it gets the token. Currently like this:
38
+ `method` parameter as string, where it gets the token. WE expect that the
39
+ method is a public method in your connector class. Currently like this:
39
40
  ```ruby
40
41
  { base: TokenAgent.new, method: 'get_authorization_header' }
41
42
  ```
42
43
 
43
44
  Your method should return a hash like this:
44
45
  ```ruby
45
- { 'Authorization' => 'Token HERE' }
46
+ class TokenAgent
47
+ [...]
48
+ def get_authorization_header
49
+ [...]
50
+ { 'Authorization' => 'Token HERE' }
51
+ end
52
+ end
53
+ ```
46
54
 
47
55
  When you set a connector, it will override the setting in the headers for
48
56
  Authorization.
@@ -5,7 +5,7 @@ module GraphqlConnector
5
5
  # Class to wrap http_client calls under a specific namespaced class
6
6
  class BaseServerType
7
7
  class << self
8
- def build(name, uri, headers, connector = {})
8
+ def build(name, uri, headers = {}, connector = {})
9
9
  verify_new_client_type_for!(name)
10
10
  base_class = class_with(uri, headers, connector)
11
11
  base_object = GraphqlConnector.const_set(name, base_class)
@@ -39,7 +39,7 @@ module GraphqlConnector
39
39
  METHOD
40
40
  end
41
41
 
42
- def class_with(uri, headers, connector = {})
42
+ def class_with(uri, headers = {}, connector = {})
43
43
  Class.new do
44
44
  attr_accessor :uri, :headers, :connector
45
45
  @uri = uri
@@ -9,7 +9,7 @@ module GraphqlConnector
9
9
  @base_server_types = {}
10
10
  end
11
11
 
12
- def add_server(name:, uri:, headers:, connector: {})
12
+ def add_server(name:, uri:, headers: {}, connector: {})
13
13
  @base_server_types[name] =
14
14
  BaseServerType.build(name, uri, headers, connector)
15
15
  end
@@ -3,7 +3,7 @@
3
3
  module GraphqlConnector
4
4
  # Wrapper class for HTTParty post query
5
5
  class HttpClient
6
- def initialize(uri, headers, connector = {})
6
+ def initialize(uri, headers = {}, connector = {})
7
7
  @uri = uri
8
8
  @headers = headers
9
9
  @connector = connector
@@ -39,7 +39,7 @@ module GraphqlConnector
39
39
  return @headers if @connector.empty?
40
40
 
41
41
  @headers
42
- .merge(@connector[:base].send(@connector[:method]))
42
+ .merge(@connector[:base].public_send(@connector[:method]))
43
43
  end
44
44
 
45
45
  def format_body(response_body)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GraphqlConnector
4
- VERSION = '1.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garllon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2021-06-02 00:00:00.000000000 Z
12
+ date: 2021-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.1.4
145
+ rubygems_version: 3.2.7
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: GraphQL client