Class: AdvancedBilling::BasicAuthCredentials
- Inherits:
-
Object
- Object
- AdvancedBilling::BasicAuthCredentials
- Defined in:
- lib/advanced_billing/http/auth/basic_auth.rb
Overview
Data class for BasicAuthCredentials.
Instance Attribute Summary collapse
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #clone_with(username: nil, password: nil) ⇒ Object
-
#initialize(username:, password:) ⇒ BasicAuthCredentials
constructor
A new instance of BasicAuthCredentials.
Constructor Details
#initialize(username:, password:) ⇒ BasicAuthCredentials
Returns a new instance of BasicAuthCredentials.
35 36 37 38 39 40 41 |
# File 'lib/advanced_billing/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
#password ⇒ Object (readonly)
Returns the value of attribute password.
33 34 35 |
# File 'lib/advanced_billing/http/auth/basic_auth.rb', line 33 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
33 34 35 |
# File 'lib/advanced_billing/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/advanced_billing/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 |