Class: WorkOS::VerifyChallenge

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

Overview

The VerifyChallenge class provides a lightweight wrapper around a WorkOS Authentication Challenge resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(json) ⇒ VerifyChallenge

Returns a new instance of VerifyChallenge.



11
12
13
14
15
16
# File 'lib/workos/verify_challenge.rb', line 11

def initialize(json)
  hash = JSON.parse(json, symbolize_names: true)

  @challenge = hash[:challenge]
  @valid = hash[:valid]
end

Instance Attribute Details

#challengeObject

Returns the value of attribute challenge.



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

def challenge
  @challenge
end

#validObject

Returns the value of attribute valid.



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

def valid
  @valid
end

Instance Method Details

#to_jsonObject



18
19
20
21
22
23
# File 'lib/workos/verify_challenge.rb', line 18

def to_json(*)
  {
    challenge: challenge,
    valid: valid,
  }
end