Sha256: 1dfb9c07a97ed5e9e931cd64dd59f366a6364e5804f4bf91ba0aa0040cc141aa

Contents?: true

Size: 940 Bytes

Versions: 19

Compression:

Stored size: 940 Bytes

Contents

# frozen_string_literal: true

module WorkOS
  # The MagicAuth class provides a lightweight wrapper around a WorkOS MagicAuth
  # resource. This class is not meant to be instantiated in a user space,
  # and is instantiated internally but exposed.
  class MagicAuth
    include HashProvider

    attr_accessor :id, :user_id, :email,
                  :expires_at, :code, :created_at, :updated_at

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

      @id = hash[:id]
      @user_id = hash[:user_id]
      @email = hash[:email]
      @code = hash[:code]
      @expires_at = hash[:expires_at]
      @created_at = hash[:created_at]
      @updated_at = hash[:updated_at]
    end

    def to_json(*)
      {
        id: id,
        user_id: user_id,
        email: email,
        code: code,
        expires_at: expires_at,
        created_at: created_at,
        updated_at: updated_at,
      }
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
workos-5.13.0 lib/workos/magic_auth.rb
workos-5.12.0 lib/workos/magic_auth.rb
workos-5.11.1 lib/workos/magic_auth.rb
workos-5.11.0 lib/workos/magic_auth.rb
workos-5.10.0 lib/workos/magic_auth.rb
workos-5.9.0 lib/workos/magic_auth.rb
workos-5.8.0 lib/workos/magic_auth.rb
workos-5.7.0 lib/workos/magic_auth.rb
workos-5.6.0 lib/workos/magic_auth.rb
workos-5.5.1 lib/workos/magic_auth.rb
workos-5.5.0 lib/workos/magic_auth.rb
workos-5.4.0 lib/workos/magic_auth.rb
workos-5.3.0 lib/workos/magic_auth.rb
workos-5.2.1 lib/workos/magic_auth.rb
workos-5.2.0 lib/workos/magic_auth.rb
workos-5.1.0 lib/workos/magic_auth.rb
workos-5.0.0 lib/workos/magic_auth.rb
workos-4.8.0 lib/workos/magic_auth.rb
workos-4.5.0 lib/workos/magic_auth.rb