Class: MultiAuthSample::ApiKeyCredentials
- Inherits:
-
Object
- Object
- MultiAuthSample::ApiKeyCredentials
- Defined in:
- lib/multi_auth_sample/http/auth/api_key.rb
Overview
Data class for ApiKeyCredentials. Data class for ApiKeyCredentials.
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #clone_with(token: nil, api_key: nil) ⇒ Object
-
#initialize(token:, api_key:) ⇒ ApiKeyCredentials
constructor
A new instance of ApiKeyCredentials.
Constructor Details
#initialize(token:, api_key:) ⇒ ApiKeyCredentials
Returns a new instance of ApiKeyCredentials.
32 33 34 35 36 37 38 |
# File 'lib/multi_auth_sample/http/auth/api_key.rb', line 32 def initialize(token:, api_key:) raise ArgumentError, 'token cannot be nil' if token.nil? raise ArgumentError, 'api_key cannot be nil' if api_key.nil? @token = token @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
30 31 32 |
# File 'lib/multi_auth_sample/http/auth/api_key.rb', line 30 def api_key @api_key end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
30 31 32 |
# File 'lib/multi_auth_sample/http/auth/api_key.rb', line 30 def token @token end |
Instance Method Details
#clone_with(token: nil, api_key: nil) ⇒ Object
40 41 42 43 44 45 |
# File 'lib/multi_auth_sample/http/auth/api_key.rb', line 40 def clone_with(token: nil, api_key: nil) token ||= self.token api_key ||= self.api_key ApiKeyCredentials.new(token: token, api_key: api_key) end |