gds-api-adapters 49.3.0 → 49.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/json_client.rb +10 -10
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62fb1a303990d06bb0aa4c5839ae7a233626c461
|
4
|
+
data.tar.gz: baba94202d20913a07a3053a4d47a504c9c3b2f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f347372495223c6fc802472f12d772dc8f86685303b74b7b8db6cfaa3b4fd98325b64672c7b2787dd85a8024e9ce5dfcc4370c00eb6c98121e1b831976379cc3
|
7
|
+
data.tar.gz: 2c4eaee67894ab3ac70d1ea25e546ef8a2e8ba95261ac88fe0f814a1e269e53e705fc4b918d704e020e3c9a009046306a646f1e8f3dc037964ba6794c9efa1d7
|
data/lib/gds_api/json_client.rb
CHANGED
@@ -59,9 +59,13 @@ module GdsApi
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def self.default_request_with_json_body_headers
|
62
|
-
self.default_request_headers.merge(
|
62
|
+
self.default_request_headers.merge(self.json_body_headers)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.json_body_headers
|
66
|
+
{
|
63
67
|
'Content-Type' => 'application/json',
|
64
|
-
|
68
|
+
}
|
65
69
|
end
|
66
70
|
|
67
71
|
DEFAULT_TIMEOUT_IN_SECONDS = 4
|
@@ -134,6 +138,9 @@ module GdsApi
|
|
134
138
|
# from the Net::HTTPResponse
|
135
139
|
def do_json_request(method, url, params = nil, additional_headers = {}, &create_response)
|
136
140
|
begin
|
141
|
+
if params
|
142
|
+
additional_headers.merge!(self.class.json_body_headers)
|
143
|
+
end
|
137
144
|
response = do_request_with_cache(method, url, (params.to_json if params), additional_headers)
|
138
145
|
rescue RestClient::Exception => e
|
139
146
|
# Attempt to parse the body as JSON if possible
|
@@ -242,16 +249,9 @@ module GdsApi
|
|
242
249
|
url: url,
|
243
250
|
}
|
244
251
|
|
245
|
-
case method
|
246
|
-
when :get, :delete
|
247
|
-
default_headers = self.class.default_request_headers
|
248
|
-
else
|
249
|
-
default_headers = self.class.default_request_with_json_body_headers
|
250
|
-
end
|
251
|
-
|
252
252
|
method_params[:payload] = params
|
253
253
|
method_params = with_timeout(method_params)
|
254
|
-
method_params = with_headers(method_params,
|
254
|
+
method_params = with_headers(method_params, self.class.default_request_headers, additional_headers)
|
255
255
|
method_params = with_auth_options(method_params)
|
256
256
|
if URI.parse(url).is_a? URI::HTTPS
|
257
257
|
method_params = with_ssl_options(method_params)
|
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 49.3.
|
4
|
+
version: 49.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|