Class: AuthBasic

Inherits:
Object
  • Object
show all
Includes:
AuthProvider
Defined in:
lib/one_doc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username: nil, password: nil) ⇒ AuthBasic

Returns a new instance of AuthBasic.



35
36
37
38
# File 'lib/one_doc.rb', line 35

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

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



33
34
35
# File 'lib/one_doc.rb', line 33

def password
  @password
end

#usernameObject

Returns the value of attribute username.



33
34
35
# File 'lib/one_doc.rb', line 33

def username
  @username
end

Instance Method Details

#add_auth(http_client, req_kwargs) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/one_doc.rb', line 40

def add_auth(http_client, req_kwargs)
  if !@username.nil? && !@password.nil?
    http_client = http_client.basic_auth(user: @username, pass: @password)
  end

  return http_client, req_kwargs
end