Class: WorkOS::Profile

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/workos/profile.rb

Overview

The Profile class provides a lighweight wrapper around a normalized response from the various IDPs WorkOS supports as part of the SSO integration. This class is not meant ot be instantiated in user space, and is instantiated internally but exposed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile_json) ⇒ Profile

Returns a new instance of Profile



21
22
23
24
25
26
27
28
29
30
# File 'lib/workos/profile.rb', line 21

def initialize(profile_json)
  raw = parse_json(profile_json)

  @id              = T.let(raw.id, String)
  @email           = T.let(raw.email, String)
  @first_name      = T.let(raw.first_name, String)
  @last_name       = T.let(raw.last_name, String)
  @connection_type = T.let(raw.connection_type, String)
  @idp_id          = T.let(raw.idp_id, String)
end

Instance Attribute Details

#connection_typeObject

Returns the value of attribute connection_type



17
18
19
# File 'lib/workos/profile.rb', line 17

def connection_type
  @connection_type
end

#emailObject

Returns the value of attribute email



17
18
19
# File 'lib/workos/profile.rb', line 17

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name



17
18
19
# File 'lib/workos/profile.rb', line 17

def first_name
  @first_name
end

#idObject

Returns the value of attribute id



17
18
19
# File 'lib/workos/profile.rb', line 17

def id
  @id
end

#idp_idObject

Returns the value of attribute idp_id



17
18
19
# File 'lib/workos/profile.rb', line 17

def idp_id
  @idp_id
end

#last_nameObject

Returns the value of attribute last_name



17
18
19
# File 'lib/workos/profile.rb', line 17

def last_name
  @last_name
end

Instance Method Details

#full_nameObject



33
34
35
# File 'lib/workos/profile.rb', line 33

def full_name
  [first_name, last_name].compact.join(' ')
end