Class: ShellCardManagementApIs::BasicAuthCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/http/auth/basic_auth.rb

Overview

Data class for BasicAuthCredentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username:, password:) ⇒ BasicAuthCredentials

Returns a new instance of BasicAuthCredentials.

Raises:

  • (ArgumentError)


35
36
37
38
39
40
41
# File 'lib/shell_card_management_ap_is/http/auth/basic_auth.rb', line 35

def initialize(username:, password:)
  raise ArgumentError, 'username cannot be nil' if username.nil?
  raise ArgumentError, 'password cannot be nil' if password.nil?

  @username = username
  @password = password
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



33
34
35
# File 'lib/shell_card_management_ap_is/http/auth/basic_auth.rb', line 33

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



33
34
35
# File 'lib/shell_card_management_ap_is/http/auth/basic_auth.rb', line 33

def username
  @username
end

Instance Method Details

#clone_with(username: nil, password: nil) ⇒ Object



43
44
45
46
47
48
# File 'lib/shell_card_management_ap_is/http/auth/basic_auth.rb', line 43

def clone_with(username: nil, password: nil)
  username ||= self.username
  password ||= self.password

  BasicAuthCredentials.new(username: username, password: password)
end