Sha256: 0180f48114e2af53e8897fffd2cd2f94ee10deba4d2f985d5fc104416a6ed2e6

Contents?: true

Size: 761 Bytes

Versions: 13

Compression:

Stored size: 761 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
    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

13 entries across 13 versions & 1 rubygems

Version Path
workos-2.2.0 lib/workos/profile_and_token.rb
workos-2.1.1 lib/workos/profile_and_token.rb
workos-2.1.0 lib/workos/profile_and_token.rb
workos-2.0.0 lib/workos/profile_and_token.rb
workos-1.6.1 lib/workos/profile_and_token.rb
workos-1.6.0 lib/workos/profile_and_token.rb
workos-1.5.1 lib/workos/profile_and_token.rb
workos-1.5.0 lib/workos/profile_and_token.rb
workos-1.4.0 lib/workos/profile_and_token.rb
workos-1.3.0 lib/workos/profile_and_token.rb
workos-1.2.1 lib/workos/profile_and_token.rb
workos-1.2.0 lib/workos/profile_and_token.rb
workos-1.1.0 lib/workos/profile_and_token.rb