Class: SecondFactor::AuthManagerResult
- Inherits:
-
Object
- Object
- SecondFactor::AuthManagerResult
- Defined in:
- lib/second_factor/auth_manager_result.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(status, data) ⇒ AuthManagerResult
constructor
A new instance of AuthManagerResult.
- #no_second_factors_enabled? ⇒ Boolean
- #second_factor_auth_completed? ⇒ Boolean
- #second_factor_auth_skipped? ⇒ Boolean
Constructor Details
#initialize(status, data) ⇒ AuthManagerResult
Returns a new instance of AuthManagerResult.
13 14 15 16 17 18 19 20 21 |
# File 'lib/second_factor/auth_manager_result.rb', line 13 def initialize(status, data) if !STATUSES.key?(status) raise ArgumentError.new( "#{status.inspect} is not a valid status. Allowed statuses: #{STATUSES.inspect}", ) end @status_id = STATUSES[status] @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
11 12 13 |
# File 'lib/second_factor/auth_manager_result.rb', line 11 def data @data end |
Instance Method Details
#no_second_factors_enabled? ⇒ Boolean
23 24 25 |
# File 'lib/second_factor/auth_manager_result.rb', line 23 def no_second_factors_enabled? @status_id == STATUSES[:no_second_factor] end |
#second_factor_auth_completed? ⇒ Boolean
27 28 29 |
# File 'lib/second_factor/auth_manager_result.rb', line 27 def second_factor_auth_completed? @status_id == STATUSES[:second_factor_auth_completed] end |
#second_factor_auth_skipped? ⇒ Boolean
31 32 33 |
# File 'lib/second_factor/auth_manager_result.rb', line 31 def second_factor_auth_skipped? @status_id == STATUSES[:second_factor_auth_skipped] end |