Class: WorkOS::SSOTokenResponse

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/sso/sso_token_response.rb

Constant Summary collapse

HASH_ATTRS =
{
  token_type: :token_type,
  access_token: :access_token,
  expires_in: :expires_in,
  profile: :profile,
  oauth_tokens: :oauth_tokens
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

normalize

Methods included from HashProvider

#inspect, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ SSOTokenResponse

Returns a new instance of SSOTokenResponse.



22
23
24
25
26
27
28
29
# File 'lib/workos/sso/sso_token_response.rb', line 22

def initialize(json)
  hash = self.class.normalize(json)
  @token_type = hash[:token_type]
  @access_token = hash[:access_token]
  @expires_in = hash[:expires_in]
  @profile = hash[:profile] ? WorkOS::Profile.new(hash[:profile]) : nil
  @oauth_tokens = hash[:oauth_tokens] ? WorkOS::SSOTokenResponseOAuthToken.new(hash[:oauth_tokens]) : nil
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



15
16
17
# File 'lib/workos/sso/sso_token_response.rb', line 15

def access_token
  @access_token
end

#expires_inObject

Returns the value of attribute expires_in.



15
16
17
# File 'lib/workos/sso/sso_token_response.rb', line 15

def expires_in
  @expires_in
end

#oauth_tokensObject

Returns the value of attribute oauth_tokens.



15
16
17
# File 'lib/workos/sso/sso_token_response.rb', line 15

def oauth_tokens
  @oauth_tokens
end

#profileObject

Returns the value of attribute profile.



15
16
17
# File 'lib/workos/sso/sso_token_response.rb', line 15

def profile
  @profile
end

#token_typeObject

Returns the value of attribute token_type.



15
16
17
# File 'lib/workos/sso/sso_token_response.rb', line 15

def token_type
  @token_type
end