Class: KineticSdk::CustomHttp

Inherits:
Object
  • Object
show all
Includes:
Utils::KineticHttpUtils
Defined in:
lib/kinetic_sdk/utils/kinetic-http.rb

Overview

The CustomHttp class provides functionality to make generic HTTP requests utilizing the functionality of the KineticSdk.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::KineticHttpUtils

#default_headers, default_headers, #default_jwt_headers, default_jwt_headers, #delete, #encode, #gateway_retry_delay, #gateway_retry_limit, #get, #head, #header_accept_json, header_accept_json, #header_basic_auth, header_basic_auth, header_bearer_auth, #header_bearer_auth, #header_content_json, header_content_json, header_user_agent, #header_user_agent, #max_redirects, #mimetype, #patch, #post, #post_multipart, #put, #redirect_url, #stream_download_to_file

Constructor Details

#initialize(opts = {}) ⇒ CustomHttp

Constructor

Parameters:

  • opts (Hash) (defaults to: {})

    options for HTTP requests

  • options (Hash)

    a customizable set of options

Options Hash (opts):

  • :username (String) — default: nil

    for Basic Authentication

  • :password (String) — default: nil

    for Basic Authentication

  • :options (Hash) — default: {}

    http options



831
832
833
834
835
836
837
838
# File 'lib/kinetic_sdk/utils/kinetic-http.rb', line 831

def initialize(opts={})
  @username = opts[:username]
  @password = opts[:password]
  @options = opts.delete(:options) || {}
  log_level = @options[:log_level] || @options["log_level"]
  log_output = @options[:log_output] || @options["log_output"]
  @logger = KineticSdk::Utils::KLogger.new(log_level, log_output)
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



816
817
818
# File 'lib/kinetic_sdk/utils/kinetic-http.rb', line 816

def logger
  @logger
end

#optionsObject

Returns the value of attribute options.



816
817
818
# File 'lib/kinetic_sdk/utils/kinetic-http.rb', line 816

def options
  @options
end

#passwordObject

Returns the value of attribute password.



816
817
818
# File 'lib/kinetic_sdk/utils/kinetic-http.rb', line 816

def password
  @password
end

#usernameObject

Returns the value of attribute username.



816
817
818
# File 'lib/kinetic_sdk/utils/kinetic-http.rb', line 816

def username
  @username
end