Class: ApiKeys::Services::Authenticator::Result
- Inherits:
-
Struct
- Object
- Struct
- ApiKeys::Services::Authenticator::Result
- Defined in:
- lib/api_keys/services/authenticator.rb
Overview
Result object for authentication attempts.
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#message ⇒ Object
Returns the value of attribute message.
-
#success? ⇒ Object
Returns the value of attribute success?.
Class Method Summary collapse
Instance Method Summary collapse
-
#inspect ⇒ Object
(also: #to_s)
Do not delegate to Struct's default inspection: it recursively inspects the Active Record object and can expose token digests or public tokens.
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key
23 24 25 |
# File 'lib/api_keys/services/authenticator.rb', line 23 def api_key @api_key end |
#error_code ⇒ Object
Returns the value of attribute error_code
23 24 25 |
# File 'lib/api_keys/services/authenticator.rb', line 23 def error_code @error_code end |
#message ⇒ Object
Returns the value of attribute message
23 24 25 |
# File 'lib/api_keys/services/authenticator.rb', line 23 def @message end |
#success? ⇒ Object
Returns the value of attribute success?
23 24 25 |
# File 'lib/api_keys/services/authenticator.rb', line 23
def success?
@success?
end
|
Class Method Details
.failure(error_code:, message:) ⇒ Object
28 29 30 |
# File 'lib/api_keys/services/authenticator.rb', line 28 def self.failure(error_code:, message:) new(success?: false, error_code: error_code, message: ) end |
.success(api_key) ⇒ Object
24 25 26 |
# File 'lib/api_keys/services/authenticator.rb', line 24 def self.success(api_key) new(success?: true, api_key: api_key) end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
Do not delegate to Struct's default inspection: it recursively inspects the Active Record object and can expose token digests or public tokens.
34 35 36 |
# File 'lib/api_keys/services/authenticator.rb', line 34 def inspect "#<#{self.class.name} success?=#{success?.inspect} api_key_id=#{api_key&.id.inspect} error_code=#{error_code.inspect}>" end |