Class: WorkOS::ProfileAndToken
- Inherits:
-
Object
- Object
- WorkOS::ProfileAndToken
- Includes:
- HashProvider
- Defined in:
- lib/workos/profile_and_token.rb
Overview
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.
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#profile ⇒ Object
Returns the value of attribute profile.
Instance Method Summary collapse
-
#initialize(profile_and_token_json) ⇒ ProfileAndToken
constructor
A new instance of ProfileAndToken.
- #to_json ⇒ Object
Methods included from HashProvider
Constructor Details
#initialize(profile_and_token_json) ⇒ ProfileAndToken
Returns a new instance of ProfileAndToken.
12 13 14 15 16 17 |
# File 'lib/workos/profile_and_token.rb', line 12 def initialize(profile_and_token_json) json = JSON.parse(profile_and_token_json, symbolize_names: true) @access_token = json[:access_token] @profile = WorkOS::Profile.new(json[:profile].to_json) end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
10 11 12 |
# File 'lib/workos/profile_and_token.rb', line 10 def access_token @access_token end |
#profile ⇒ Object
Returns the value of attribute profile.
10 11 12 |
# File 'lib/workos/profile_and_token.rb', line 10 def profile @profile end |
Instance Method Details
#to_json ⇒ Object
19 20 21 22 23 24 |
# File 'lib/workos/profile_and_token.rb', line 19 def to_json(*) { access_token: access_token, profile: profile.to_json, } end |