Class: IBM::Cloud::SDKHTTP::HTTPConnection

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/ibm/cloud/sdk_http/connection.rb

Overview

Class to wrap the HTTP Provider implementation.

Instance Method Summary collapse

Constructor Details

#initialize(logger) ⇒ HTTPConnection

Returns a new instance of HTTPConnection.



13
14
15
16
# File 'lib/ibm/cloud/sdk_http/connection.rb', line 13

def initialize(logger)
  @logger = logger
  self.class.logger(logger, :debug, :apache)
end

Instance Method Details

#add_proxy(host, port, user, password) ⇒ Object



27
28
29
# File 'lib/ibm/cloud/sdk_http/connection.rb', line 27

def add_proxy(host, port, user, password)
  self.class.http_proxy(host, port, user, password)
end

#default_optionsObject



23
24
25
# File 'lib/ibm/cloud/sdk_http/connection.rb', line 23

def default_options
  self.class.default_options
end

#request(method, path, params) ⇒ Object



31
32
33
34
# File 'lib/ibm/cloud/sdk_http/connection.rb', line 31

def request(method, path, params)
  response = self.class.send(method.to_sym, path, params)
  SDKResponse.new(response)
end

#verbose_logger=(verbosity) ⇒ Object

Set the logger type to curl which has more information.



19
20
21
# File 'lib/ibm/cloud/sdk_http/connection.rb', line 19

def verbose_logger=(verbosity)
  default_options[:log_format] = verbosity ? :curl : :apache
end