Class: LoyaltyApIs::CustomerHeaderCredentials
- Inherits:
-
Object
- Object
- LoyaltyApIs::CustomerHeaderCredentials
- Defined in:
- lib/loyalty_ap_is/http/auth/customer_header.rb
Overview
Data class for CustomerHeaderCredentials. Data class for CustomerHeaderCredentials.
Instance Attribute Summary collapse
-
#authorization_token ⇒ Object
readonly
Returns the value of attribute authorization_token.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(authorization_token: nil) ⇒ Object
-
#initialize(authorization_token:) ⇒ CustomerHeaderCredentials
constructor
A new instance of CustomerHeaderCredentials.
Constructor Details
#initialize(authorization_token:) ⇒ CustomerHeaderCredentials
Returns a new instance of CustomerHeaderCredentials.
30 31 32 33 34 |
# File 'lib/loyalty_ap_is/http/auth/customer_header.rb', line 30 def initialize(authorization_token:) raise ArgumentError, 'authorization_token cannot be nil' if .nil? @authorization_token = end |
Instance Attribute Details
#authorization_token ⇒ Object (readonly)
Returns the value of attribute authorization_token.
28 29 30 |
# File 'lib/loyalty_ap_is/http/auth/customer_header.rb', line 28 def @authorization_token end |
Class Method Details
.from_env ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/loyalty_ap_is/http/auth/customer_header.rb', line 36 def self.from_env = ENV['CUSTOMER_HEADER_AUTHORIZATION_TOKEN'] all_nil = [ ].all?(&:nil?) return nil if all_nil new(authorization_token: ) end |
Instance Method Details
#clone_with(authorization_token: nil) ⇒ Object
46 47 48 49 50 |
# File 'lib/loyalty_ap_is/http/auth/customer_header.rb', line 46 def clone_with(authorization_token: nil) ||= self. CustomerHeaderCredentials.new(authorization_token: ) end |