Class: WorkOS::AuthenticateResponse

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/user_management/authenticate_response.rb

Constant Summary collapse

HASH_ATTRS =
{
  user: :user,
  organization_id: :organization_id,
  authkit_authorization_code: :authkit_authorization_code,
  access_token: :access_token,
  refresh_token: :refresh_token,
  authentication_method: :authentication_method,
  impersonator: :impersonator,
  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) ⇒ AuthenticateResponse

Returns a new instance of AuthenticateResponse.



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/workos/user_management/authenticate_response.rb', line 28

def initialize(json)
  hash = self.class.normalize(json)
  @user = hash[:user] ? WorkOS::User.new(hash[:user]) : nil
  @organization_id = hash[:organization_id]
  @authkit_authorization_code = hash[:authkit_authorization_code]
  @access_token = hash[:access_token]
  @refresh_token = hash[:refresh_token]
  @authentication_method = hash[:authentication_method]
  @impersonator = hash[:impersonator] ? WorkOS::AuthenticateResponseImpersonator.new(hash[:impersonator]) : nil
  @oauth_tokens = hash[:oauth_tokens] ? WorkOS::AuthenticateResponseOAuthToken.new(hash[:oauth_tokens]) : nil
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def access_token
  @access_token
end

#authentication_methodObject

Returns the value of attribute authentication_method.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def authentication_method
  @authentication_method
end

#authkit_authorization_codeObject

Returns the value of attribute authkit_authorization_code.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def authkit_authorization_code
  @authkit_authorization_code
end

#impersonatorObject

Returns the value of attribute impersonator.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def impersonator
  @impersonator
end

#oauth_tokensObject

Returns the value of attribute oauth_tokens.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def oauth_tokens
  @oauth_tokens
end

#organization_idObject

Returns the value of attribute organization_id.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def organization_id
  @organization_id
end

#refresh_tokenObject

Returns the value of attribute refresh_token.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def refresh_token
  @refresh_token
end

#userObject

Returns the value of attribute user.



18
19
20
# File 'lib/workos/user_management/authenticate_response.rb', line 18

def user
  @user
end