Sha256: a789f9b1ebbaf5b5c54d055027232a0767ac9a44ce2d58aac68f674854be3f0f

Contents?: true

Size: 1022 Bytes

Versions: 18

Compression:

Stored size: 1022 Bytes

Contents

# frozen_string_literal: true

module WorkOS
  # The Challnge 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 Challenge
    include HashProvider

    attr_accessor :id, :object, :expires_at, :code, :authentication_factor_id, :updated_at, :created_at

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

      @id = hash[:id]
      @object = hash[:object]
      @expires_at = hash[:expires_at]
      @code = hash[:code]
      @authentication_factor_id = hash[:authentication_factor_id]
      @created_at = hash[:created_at]
      @updated_at = hash[:updated_at]
    end

    def to_json(*)
      {
        id: id,
        object: object,
        expires_at: expires_at,
        code: code,
        authentication_factor_id: authentication_factor_id,
        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/challenge.rb
workos-5.8.0 lib/workos/challenge.rb
workos-5.7.0 lib/workos/challenge.rb
workos-5.6.0 lib/workos/challenge.rb
workos-5.5.1 lib/workos/challenge.rb
workos-5.5.0 lib/workos/challenge.rb
workos-5.4.0 lib/workos/challenge.rb
workos-5.3.0 lib/workos/challenge.rb
workos-5.2.1 lib/workos/challenge.rb
workos-5.2.0 lib/workos/challenge.rb
workos-5.1.0 lib/workos/challenge.rb
workos-5.0.0 lib/workos/challenge.rb
workos-4.8.0 lib/workos/challenge.rb
workos-4.5.0 lib/workos/challenge.rb
workos-4.4.0 lib/workos/challenge.rb
workos-4.3.0 lib/workos/challenge.rb
workos-4.2.1 lib/workos/challenge.rb
workos-4.2.0 lib/workos/challenge.rb