Class: WorkOS::DirectoryUserWithGroups

Inherits:
Types::BaseModel show all
Defined in:
lib/workos/directory_sync/directory_user_with_groups.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,
  name: :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,
  groups: :groups
}.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) ⇒ DirectoryUserWithGroups

Returns a new instance of DirectoryUserWithGroups.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 93

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]
  @name = hash[:name]
  @emails = (hash[:emails] || []).map { |item| item ? WorkOS::DirectoryUserWithGroupsEmail.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]
  @groups = (hash[:groups] || []).map { |item| item ? WorkOS::DirectoryGroup.new(item) : nil }
end

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def created_at
  @created_at
end

#custom_attributesObject

Returns the value of attribute custom_attributes.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def custom_attributes
  @custom_attributes
end

#directory_idObject

Returns the value of attribute directory_id.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def directory_id
  @directory_id
end

#emailObject

Returns the value of attribute email.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def email
  @email
end

#emailsObject

Deprecated.

A list of email addresses for the user.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

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

#first_nameObject

Returns the value of attribute first_name.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def first_name
  @first_name
end

#groupsObject

Deprecated.

The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a user filter to fetch a user's group memberships.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

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

#idObject

Returns the value of attribute id.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def id
  @id
end

#idp_idObject

Returns the value of attribute idp_id.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def idp_id
  @idp_id
end

#job_titleObject

Deprecated.

The job title of the user.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

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

#last_nameObject

Returns the value of attribute last_name.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def last_name
  @last_name
end

#nameObject

Returns the value of attribute name.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def name
  @name
end

#objectObject

Returns the value of attribute object.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def object
  @object
end

#organization_idObject

Returns the value of attribute organization_id.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def organization_id
  @organization_id
end

#raw_attributesObject

Deprecated.

The raw attributes received from the directory provider.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

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

#roleObject

Returns the value of attribute role.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def role
  @role
end

#rolesObject

Returns the value of attribute roles.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def roles
  @roles
end

#stateObject

Returns the value of attribute state.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def state
  @state
end

#updated_atObject

Returns the value of attribute updated_at.



41
42
43
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

def updated_at
  @updated_at
end

#usernameObject

Deprecated.

The username of the user.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/workos/directory_sync/directory_user_with_groups.rb', line 41

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