Class: SecondFactor::AuthManagerResult

Inherits:
Object
  • Object
show all
Defined in:
lib/second_factor/auth_manager_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject (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

Returns:

  • (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

Returns:

  • (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

Returns:

  • (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