Sha256: 2e63712c42734afa6aefce94d6efce931177b5c3fd806f8c0d0d4dee89bbbea8

Contents?: true

Size: 786 Bytes

Versions: 22

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true
# typed: true

module WorkOS
  # The ProfileAndToken class represents a Profile and a corresponding
  # Access Token. This class is not meant to be instantiated in user space, and
  # is instantiated internally but exposed.
  class ProfileAndToken
    include HashProvider
    extend T::Sig

    attr_accessor :access_token, :profile

    sig { params(profile_and_token_json: String).void }
    def initialize(profile_and_token_json)
      json = JSON.parse(profile_and_token_json, symbolize_names: true)

      @access_token = T.let(json[:access_token], String)
      @profile = WorkOS::Profile.new(json[:profile].to_json)
    end

    def to_json(*)
      {
        access_token: access_token,
        profile: profile.to_json,
      }
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
workos-4.1.0 lib/workos/profile_and_token.rb
workos-4.0.0 lib/workos/profile_and_token.rb
workos-3.1.0 lib/workos/profile_and_token.rb
workos-3.0.0 lib/workos/profile_and_token.rb
workos-2.17.0 lib/workos/profile_and_token.rb
workos-2.16.0 lib/workos/profile_and_token.rb
workos-2.15.0 lib/workos/profile_and_token.rb
workos-2.14.0 lib/workos/profile_and_token.rb
workos-2.13.0 lib/workos/profile_and_token.rb
workos-2.12.1 lib/workos/profile_and_token.rb
workos-2.12.0 lib/workos/profile_and_token.rb
workos-2.11.0 lib/workos/profile_and_token.rb
workos-2.10.0 lib/workos/profile_and_token.rb
workos-2.9.0 lib/workos/profile_and_token.rb
workos-2.8.0 lib/workos/profile_and_token.rb
workos-2.7.0 lib/workos/profile_and_token.rb
workos-2.6.0 lib/workos/profile_and_token.rb
workos-2.5.1 lib/workos/profile_and_token.rb
workos-2.5.0 lib/workos/profile_and_token.rb
workos-2.4.0 lib/workos/profile_and_token.rb