graphql_connector 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +10 -2
- data/lib/graphql_connector/base_server_type.rb +2 -2
- data/lib/graphql_connector/configuration.rb +1 -1
- data/lib/graphql_connector/http_client.rb +2 -2
- data/lib/graphql_connector/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b8c2af2590f1daf462e0f348e64078c530a4c7f6833a7d8692e6bada0f11291
|
4
|
+
data.tar.gz: 52edb3725223b2538f91b1904fa57a071ab0b43b853f37f23242e1dbb8d7eb50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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
|
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].
|
42
|
+
.merge(@connector[:base].public_send(@connector[:method]))
|
43
43
|
end
|
44
44
|
|
45
45
|
def format_body(response_body)
|
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.
|
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-
|
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.
|
145
|
+
rubygems_version: 3.2.7
|
146
146
|
signing_key:
|
147
147
|
specification_version: 4
|
148
148
|
summary: GraphQL client
|