Sha256: 86931867d806aac41647f6ebb3511550fce4658bea82d0d994534f1cc2728be4

Contents?: true

Size: 881 Bytes

Versions: 18

Compression:

Stored size: 881 Bytes

Contents

# frozen_string_literal: true

module WorkOS
  # 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.
  class Factor
    include HashProvider
    attr_accessor :id, :object, :type, :sms, :totp, :updated_at, :created_at

    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

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
workos-5.9.0 lib/workos/factor.rb
workos-5.8.0 lib/workos/factor.rb
workos-5.7.0 lib/workos/factor.rb
workos-5.6.0 lib/workos/factor.rb
workos-5.5.1 lib/workos/factor.rb
workos-5.5.0 lib/workos/factor.rb
workos-5.4.0 lib/workos/factor.rb
workos-5.3.0 lib/workos/factor.rb
workos-5.2.1 lib/workos/factor.rb
workos-5.2.0 lib/workos/factor.rb
workos-5.1.0 lib/workos/factor.rb
workos-5.0.0 lib/workos/factor.rb
workos-4.8.0 lib/workos/factor.rb
workos-4.5.0 lib/workos/factor.rb
workos-4.4.0 lib/workos/factor.rb
workos-4.3.0 lib/workos/factor.rb
workos-4.2.1 lib/workos/factor.rb
workos-4.2.0 lib/workos/factor.rb