class WorkOS::ProfileAndToken

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.

Attributes

access_token[RW]
profile[RW]

Public Class Methods

new(profile_and_token_json) click to toggle source
# File lib/workos/profile_and_token.rb, line 14
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

Public Instance Methods

to_json(*) click to toggle source
# File lib/workos/profile_and_token.rb, line 21
def to_json(*)
  {
    access_token: access_token,
    profile: profile.to_json,
  }
end