Class: WorkOS::DirectoryUser

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/directory_sync/directory_user.rb

Constant Summary collapse

HASH_ATTRS =
{
  object: :object,
  id: :id,
  directory_id: :directory_id,
  organization_id: :organization_id,
  idp_id: :idp_id,
  email: :email,
  first_name: :first_name,
  last_name: :last_name,
  emails: :emails,
  job_title: :job_title,
  username: :username,
  state: :state,
  raw_attributes: :raw_attributes,
  custom_attributes: :custom_attributes,
  role: :role,
  roles: :roles,
  created_at: :created_at,
  updated_at: :updated_at
}.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) ⇒ DirectoryUser

Returns a new instance of DirectoryUser.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/workos/directory_sync/directory_user.rb', line 81

def initialize(json)
  hash = self.class.normalize(json)
  @object = hash[:object]
  @id = hash[:id]
  @directory_id = hash[:directory_id]
  @organization_id = hash[:organization_id]
  @idp_id = hash[:idp_id]
  @email = hash[:email]
  @first_name = hash[:first_name]
  @last_name = hash[:last_name]
  @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserEmail.new(item) : nil }
  @job_title = hash[:job_title]
  @username = hash[:username]
  @state = hash[:state]
  @raw_attributes = hash[:raw_attributes] || {}
  @custom_attributes = hash[:custom_attributes] || {}
  @role = hash[:role] ? WorkOS::SlimRole.new(hash[:role]) : nil
  @roles = (hash[:roles] || []).map { |item| item ? WorkOS::SlimRole.new(item) : nil }
  @created_at = hash[:created_at]
  @updated_at = hash[:updated_at]
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def created_at
  @created_at
end

#custom_attributesObject

Returns the value of attribute custom_attributes.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def custom_attributes
  @custom_attributes
end

#directory_idObject

Returns the value of attribute directory_id.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def directory_id
  @directory_id
end

#emailObject

Returns the value of attribute email.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def email
  @email
end

#emailsObject

Deprecated.

A list of email addresses for the user.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/workos/directory_sync/directory_user.rb', line 37

attr_accessor \
:object,
:id,
:directory_id,
:organization_id,
:idp_id,
:email,
:first_name,
:last_name,
:state,
:custom_attributes,
:role,
:roles,
:created_at,
:updated_at

#first_nameObject

Returns the value of attribute first_name.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def first_name
  @first_name
end

#idObject

Returns the value of attribute id.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def id
  @id
end

#idp_idObject

Returns the value of attribute idp_id.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def idp_id
  @idp_id
end

#job_titleObject

Deprecated.

The job title of the user.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/workos/directory_sync/directory_user.rb', line 37

attr_accessor \
:object,
:id,
:directory_id,
:organization_id,
:idp_id,
:email,
:first_name,
:last_name,
:state,
:custom_attributes,
:role,
:roles,
:created_at,
:updated_at

#last_nameObject

Returns the value of attribute last_name.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def last_name
  @last_name
end

#objectObject

Returns the value of attribute object.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def object
  @object
end

#organization_idObject

Returns the value of attribute organization_id.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def organization_id
  @organization_id
end

#raw_attributesObject

Deprecated.

The raw attributes received from the directory provider.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/workos/directory_sync/directory_user.rb', line 37

attr_accessor \
:object,
:id,
:directory_id,
:organization_id,
:idp_id,
:email,
:first_name,
:last_name,
:state,
:custom_attributes,
:role,
:roles,
:created_at,
:updated_at

#roleObject

Returns the value of attribute role.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def role
  @role
end

#rolesObject

Returns the value of attribute roles.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def roles
  @roles
end

#stateObject

Returns the value of attribute state.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def state
  @state
end

#updated_atObject

Returns the value of attribute updated_at.



37
38
39
# File 'lib/workos/directory_sync/directory_user.rb', line 37

def updated_at
  @updated_at
end

#usernameObject

Deprecated.

The username of the user.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/workos/directory_sync/directory_user.rb', line 37

attr_accessor \
:object,
:id,
:directory_id,
:organization_id,
:idp_id,
:email,
:first_name,
:last_name,
:state,
:custom_attributes,
:role,
:roles,
:created_at,
:updated_at