Class: WorkOS::Factor

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

Overview

The Factor class provides a lightweight wrapper around a WorkOS DirectoryUser resource. This class is not meant to be instantiated in DirectoryUser space, and is instantiated internally but exposed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashProvider

#to_h

Constructor Details

#initialize(json) ⇒ Factor

Returns a new instance of Factor.



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

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

  @id = hash[:id]
  @object = hash[:object]
  @type = hash[:type]
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
  @totp = hash[:totp]
  @sms = hash[:sms]
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#objectObject

Returns the value of attribute object.



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

def object
  @object
end

#smsObject

Returns the value of attribute sms.



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

def sms
  @sms
end

#totpObject

Returns the value of attribute totp.



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

def totp
  @totp
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



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

def updated_at
  @updated_at
end

Instance Method Details

#to_jsonObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/workos/factor.rb', line 23

def to_json(*)
  {
    id: id,
    object: object,
    type: type,
    totp: totp,
    sms: sms,
    created_at: created_at,
    updated_at: updated_at,
  }
end