lib/infoblox/connection.rb in infoblox-2.0.5 vs lib/infoblox/connection.rb in infoblox-3.0.0
- old
+ new
@@ -8,11 +8,12 @@
:connection,
:host,
:logger,
:password,
:ssl_opts,
- :username
+ :username,
+ :timeout
def get(href, params={})
wrap do
connection.get(href, params)
end
@@ -46,13 +47,17 @@
self.username = opts[:username]
self.password = opts[:password]
self.host = opts[:host]
self.logger = opts[:logger]
self.ssl_opts = opts[:ssl_opts] || {}
+ self.timeout = opts[:timeout] || 60
end
def connection
- @connection ||= Faraday.new(:url => self.host, :ssl => self.ssl_opts) do |faraday|
+ @connection ||= Faraday.new(
+ :request => {:timeout => self.timeout, :open_timeout => self.timeout},
+ :url => self.host,
+ :ssl => self.ssl_opts) do |faraday|
faraday.use Faraday::Response::Logger, logger if logger
faraday.request :json
faraday.basic_auth(self.username, self.password)
faraday.adapter(self.adapter, &self.adapter_block)
end