lib/manageiq/api/client/connection.rb in manageiq-api-client-0.2.0 vs lib/manageiq/api/client/connection.rb in manageiq-api-client-0.3.0
- old
+ new
@@ -65,23 +65,25 @@
else
URI.join(url, path.to_s.starts_with?(API_PREFIX) ? path.to_s : "#{API_PREFIX}/#{path}").to_s
end
end
- private
-
def handle
ssl_options = @connection_options[:ssl]
Faraday.new(:url => url, :ssl => ssl_options) do |faraday|
faraday.request(:url_encoded) # form-encode POST params
+ faraday.options.open_timeout = @connection_options[:open_timeout] if @connection_options[:open_timeout]
+ faraday.options.timeout = @connection_options[:timeout] if @connection_options[:timeout]
faraday.response(:logger, client.logger)
faraday.use FaradayMiddleware::FollowRedirects, :limit => 3, :standards_compliant => true
faraday.adapter(Faraday.default_adapter) # make requests with Net::HTTP
if authentication.token.blank? && authentication.miqtoken.blank?
faraday.basic_auth(authentication.user, authentication.password)
end
end
end
+
+ private
def send_request(method, path, params, &block)
begin
@error = nil
@response = handle.run_request(method.to_sym, api_path(path), nil, nil) do |request|