Class: WorkOS::AuthenticationFactorAndChallenge

Inherits:
Object
  • Object
show all
Includes:
HashProvider
Defined in:
lib/workos/authentication_factor_and_challenge.rb

Overview

The AuthenticationFactorAndChallenge class represents an authentication factor and challenge for a given user.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(authentication_response_json) ⇒ AuthenticationFactorAndChallenge

Returns a new instance of AuthenticationFactorAndChallenge.



11
12
13
14
15
16
17
18
19
# File 'lib/workos/authentication_factor_and_challenge.rb', line 11

def initialize(authentication_response_json)
  json = JSON.parse(authentication_response_json, symbolize_names: true)
  @authentication_factor = WorkOS::Factor.new(
    json[:authentication_factor].to_json,
  )
  @authentication_challenge = WorkOS::Challenge.new(
    json[:authentication_challenge].to_json,
  )
end

Instance Attribute Details

#authentication_challengeObject

Returns the value of attribute authentication_challenge.



9
10
11
# File 'lib/workos/authentication_factor_and_challenge.rb', line 9

def authentication_challenge
  @authentication_challenge
end

#authentication_factorObject

Returns the value of attribute authentication_factor.



9
10
11
# File 'lib/workos/authentication_factor_and_challenge.rb', line 9

def authentication_factor
  @authentication_factor
end

Instance Method Details

#to_jsonObject



21
22
23
24
25
26
# File 'lib/workos/authentication_factor_and_challenge.rb', line 21

def to_json(*)
  {
    authentication_factor: authentication_factor.to_json,
    authentication_challenge: authentication_challenge.to_json,
  }
end