Class: WorkOS::UserAndToken
- Inherits:
-
Object
- Object
- WorkOS::UserAndToken
- Includes:
- HashProvider
- Defined in:
- lib/workos/user_and_token.rb
Overview
The UserAndToken class represents a User and a corresponding Token. This class is not meant to be instantiated in user space, and is instantiated internally but exposed.
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user_and_token_json) ⇒ UserAndToken
constructor
A new instance of UserAndToken.
- #to_json ⇒ Object
Methods included from HashProvider
Constructor Details
#initialize(user_and_token_json) ⇒ UserAndToken
Returns a new instance of UserAndToken.
12 13 14 15 16 17 |
# File 'lib/workos/user_and_token.rb', line 12 def initialize(user_and_token_json) json = JSON.parse(user_and_token_json, symbolize_names: true) @token = json[:token] @user = WorkOS::User.new(json[:user].to_json) end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
10 11 12 |
# File 'lib/workos/user_and_token.rb', line 10 def token @token end |
#user ⇒ Object
Returns the value of attribute user.
10 11 12 |
# File 'lib/workos/user_and_token.rb', line 10 def user @user end |
Instance Method Details
#to_json ⇒ Object
19 20 21 22 23 24 |
# File 'lib/workos/user_and_token.rb', line 19 def to_json(*) { token: token, user: user.to_json, } end |