Class: RestClientWrapper::Authenticator::Basic

Inherits:
Object
  • Object
show all
Includes:
RestClientWrapper::Auth
Defined in:
lib/rest_client_wrapper/authenticators/basic.rb

Overview

Basic

Instance Method Summary collapse

Constructor Details

#initialize(username:, password:) ⇒ Basic

Returns a new instance of Basic.



32
33
34
35
# File 'lib/rest_client_wrapper/authenticators/basic.rb', line 32

def initialize(username:, password:)
  @username = username
  @password = password
end

Instance Method Details

#generate_authObject



37
38
39
# File 'lib/rest_client_wrapper/authenticators/basic.rb', line 37

def generate_auth
  return { Authorization: "Basic #{ Base64.strict_encode64("#{ @username }:#{ @password }") }" }
end