Class: WorkOS::DirectoryUser
- Inherits:
-
DeprecatedHashWrapper
- Object
- Hash
- DeprecatedHashWrapper
- WorkOS::DirectoryUser
- Includes:
- HashProvider
- Defined in:
- lib/workos/directory_user.rb
Overview
The DirectoryUser class provides a lightweight wrapper around a WorkOS DirectoryUser resource. This class is not meant to be instantiated in DirectoryUser space, and is instantiated internally but exposed.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#custom_attributes ⇒ Object
Returns the value of attribute custom_attributes.
-
#directory_id ⇒ Object
Returns the value of attribute directory_id.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#id ⇒ Object
Returns the value of attribute id.
-
#idp_id ⇒ Object
Returns the value of attribute idp_id.
-
#job_title ⇒ Object
Returns the value of attribute job_title.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#raw_attributes ⇒ Object
Returns the value of attribute raw_attributes.
-
#role ⇒ Object
Returns the value of attribute role.
-
#state ⇒ Object
Returns the value of attribute state.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(json) ⇒ DirectoryUser
constructor
rubocop:disable Metrics/AbcSize.
- #primary_email ⇒ Object
-
#to_json ⇒ Object
rubocop:enable Metrics/AbcSize.
Methods included from HashProvider
Methods inherited from DeprecatedHashWrapper
Constructor Details
#initialize(json) ⇒ DirectoryUser
rubocop:disable Metrics/AbcSize
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/workos/directory_user.rb', line 15 def initialize(json) hash = JSON.parse(json, symbolize_names: true) @id = hash[:id] @directory_id = hash[:directory_id] @organization_id = hash[:organization_id] @idp_id = hash[:idp_id] @emails = hash[:emails] @first_name = hash[:first_name] @last_name = hash[:last_name] @job_title = hash[:job_title] @username = hash[:username] @state = hash[:state] @groups = hash[:groups] @role = hash[:role] @custom_attributes = hash[:custom_attributes] @raw_attributes = hash[:raw_attributes] @created_at = hash[:created_at] @updated_at = hash[:updated_at] replace_without_warning(to_json) end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def created_at @created_at end |
#custom_attributes ⇒ Object
Returns the value of attribute custom_attributes.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def custom_attributes @custom_attributes end |
#directory_id ⇒ Object
Returns the value of attribute directory_id.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def directory_id @directory_id end |
#emails ⇒ Object
Returns the value of attribute emails.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def emails @emails end |
#first_name ⇒ Object
Returns the value of attribute first_name.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def first_name @first_name end |
#groups ⇒ Object
Returns the value of attribute groups.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def groups @groups end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def id @id end |
#idp_id ⇒ Object
Returns the value of attribute idp_id.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def idp_id @idp_id end |
#job_title ⇒ Object
Returns the value of attribute job_title.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def job_title @job_title end |
#last_name ⇒ Object
Returns the value of attribute last_name.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def last_name @last_name end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def organization_id @organization_id end |
#raw_attributes ⇒ Object
Returns the value of attribute raw_attributes.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def raw_attributes @raw_attributes end |
#role ⇒ Object
Returns the value of attribute role.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def role @role end |
#state ⇒ Object
Returns the value of attribute state.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def state @state end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def updated_at @updated_at end |
#username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/workos/directory_user.rb', line 10 def username @username end |
Instance Method Details
#primary_email ⇒ Object
60 61 62 63 |
# File 'lib/workos/directory_user.rb', line 60 def primary_email primary_email = (emails || []).find { |email| email[:primary] } return primary_email[:value] if primary_email end |
#to_json ⇒ Object
rubocop:enable Metrics/AbcSize
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/workos/directory_user.rb', line 39 def to_json(*) { id: id, directory_id: directory_id, organization_id: organization_id, idp_id: idp_id, emails: emails, first_name: first_name, last_name: last_name, job_title: job_title, username: username, state: state, groups: groups, role: role, custom_attributes: custom_attributes, raw_attributes: raw_attributes, created_at: created_at, updated_at: updated_at, } end |