Class: WorkOS::Profile
- Inherits:
-
Object
- Object
- WorkOS::Profile
- 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
-
#connection_type ⇒ Object
Returns the value of attribute connection_type.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#idp_id ⇒ Object
Returns the value of attribute idp_id.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
Instance Method Summary collapse
- #full_name ⇒ Object
-
#initialize(profile_json) ⇒ Profile
constructor
A new instance of Profile.
- #to_json ⇒ Object
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_type ⇒ Object
Returns the value of attribute connection_type.
17 18 19 |
# File 'lib/workos/profile.rb', line 17 def connection_type @connection_type end |
#email ⇒ Object
Returns the value of attribute email.
17 18 19 |
# File 'lib/workos/profile.rb', line 17 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
17 18 19 |
# File 'lib/workos/profile.rb', line 17 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
17 18 19 |
# File 'lib/workos/profile.rb', line 17 def id @id end |
#idp_id ⇒ Object
Returns the value of attribute idp_id.
17 18 19 |
# File 'lib/workos/profile.rb', line 17 def idp_id @idp_id end |
#last_name ⇒ Object
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_name ⇒ Object
33 34 35 |
# File 'lib/workos/profile.rb', line 33 def full_name [first_name, last_name].compact.join(' ') end |
#to_json ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/workos/profile.rb', line 37 def to_json(*) { id: id, email: email, first_name: first_name, last_name: last_name, connection_type: connection_type, idp_id: idp_id, } end |