gds-api-adapters 0.0.36 → 0.0.37

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.
data/lib/gds_api/base.rb CHANGED
@@ -23,6 +23,7 @@ class GdsApi::Base
23
23
 
24
24
  class << self
25
25
  attr_writer :logger
26
+ attr_accessor :default_options
26
27
  end
27
28
 
28
29
  def self.logger
@@ -31,11 +32,13 @@ class GdsApi::Base
31
32
 
32
33
  def initialize(platform, options_or_endpoint_url=nil, maybe_options=nil)
33
34
  if options_or_endpoint_url.is_a?(String)
34
- @options = maybe_options || {}
35
- @options[:endpoint_url] = options_or_endpoint_url
35
+ options = maybe_options || {}
36
+ options[:endpoint_url] = options_or_endpoint_url
36
37
  else
37
- @options = options_or_endpoint_url || {}
38
+ options = options_or_endpoint_url || {}
38
39
  end
40
+ default_options = GdsApi::Base.default_options || {}
41
+ @options = default_options.merge(options)
39
42
  self.endpoint = options[:endpoint_url] || endpoint_for_platform(adapter_name, platform)
40
43
  end
41
44
 
@@ -41,7 +41,9 @@ module GdsApi
41
41
  path = path + "?" + url.query if url.query
42
42
 
43
43
  response = Net::HTTP.start(url.host, url.port, nil, nil, nil, nil, {use_ssl: url.port == 443, verify_mode: (OpenSSL::SSL::VERIFY_NONE if url.port == 443)}) do |http|
44
- http.read_timeout = options[:timeout] || DEFAULT_TIMEOUT_IN_SECONDS
44
+ unless options[:disable_timeout]
45
+ http.read_timeout = options[:timeout] || DEFAULT_TIMEOUT_IN_SECONDS
46
+ end
45
47
  request = method_class.new(path, REQUEST_HEADERS)
46
48
  request.basic_auth(@options[:basic_auth][:user], @options[:basic_auth][:password]) if @options[:basic_auth]
47
49
  request.body = params.to_json if params
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '0.0.36'
2
+ VERSION = '0.0.37'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.36
5
+ version: 0.0.37
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -161,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - ">="
163
163
  - !ruby/object:Gem::Version
164
- hash: 4150429579943977469
164
+ hash: 3917338129765576762
165
165
  segments:
166
166
  - 0
167
167
  version: "0"
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- hash: 4150429579943977469
173
+ hash: 3917338129765576762
174
174
  segments:
175
175
  - 0
176
176
  version: "0"