gds-api-adapters 49.3.0 → 49.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
  SHA1:
3
- metadata.gz: 1811f31795287b01d49addb28509c144263c3fcc
4
- data.tar.gz: e43b4cc0b1e878fad234e34a1f91c45101a0bf8a
3
+ metadata.gz: 62fb1a303990d06bb0aa4c5839ae7a233626c461
4
+ data.tar.gz: baba94202d20913a07a3053a4d47a504c9c3b2f8
5
5
  SHA512:
6
- metadata.gz: 6e2f4643a8a92cb59b64f264155394b493dc1b39571bf52d0bc0cdf39fc033357ef6351b7152de3bc7235193828bd75ade8f55824152e529c7b89c6083a05af0
7
- data.tar.gz: 637d7d47848459512fd0277d9aaecd9a8ac0627d4a5c447a89d4e7feddaeeb39533ae3f3b9bdc8a4deddce0e8b25fa5bfbf9c1e3874d0dfd75f69a94c4e0b53a
6
+ metadata.gz: f347372495223c6fc802472f12d772dc8f86685303b74b7b8db6cfaa3b4fd98325b64672c7b2787dd85a8024e9ce5dfcc4370c00eb6c98121e1b831976379cc3
7
+ data.tar.gz: 2c4eaee67894ab3ac70d1ea25e546ef8a2e8ba95261ac88fe0f814a1e269e53e705fc4b918d704e020e3c9a009046306a646f1e8f3dc037964ba6794c9efa1d7
@@ -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, default_headers, additional_headers)
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)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '49.3.0'.freeze
2
+ VERSION = '49.3.1'.freeze
3
3
  end
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.0
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-26 00:00:00.000000000 Z
11
+ date: 2017-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek