Skip to content

Commit 678615a

Browse files
authored
Add email standard attribute to DirectoryUser and mark deprecated standard attributes. (#355)
1 parent 497f073 commit 678615a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/workos/directory_user.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module WorkOS
77
class DirectoryUser < DeprecatedHashWrapper
88
include HashProvider
99

10-
attr_accessor :id, :idp_id, :emails, :first_name, :last_name, :job_title, :username, :state,
10+
attr_accessor :id, :idp_id, :email, :emails, :first_name, :last_name, :job_title, :username, :state,
1111
:groups, :role, :custom_attributes, :raw_attributes, :directory_id, :organization_id,
1212
:created_at, :updated_at
1313

@@ -19,10 +19,20 @@ def initialize(json)
1919
@directory_id = hash[:directory_id]
2020
@organization_id = hash[:organization_id]
2121
@idp_id = hash[:idp_id]
22+
@email = hash[:email]
23+
# @deprecated Will be removed in a future major version.
24+
# Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
25+
# See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
2226
@emails = hash[:emails]
2327
@first_name = hash[:first_name]
2428
@last_name = hash[:last_name]
29+
# @deprecated Will be removed in a future major version.
30+
# Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
31+
# See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
2532
@job_title = hash[:job_title]
33+
# @deprecated Will be removed in a future major version.
34+
# Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
35+
# See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
2636
@username = hash[:username]
2737
@state = hash[:state]
2838
@groups = hash[:groups]
@@ -42,6 +52,7 @@ def to_json(*)
4252
directory_id: directory_id,
4353
organization_id: organization_id,
4454
idp_id: idp_id,
55+
email: email,
4556
emails: emails,
4657
first_name: first_name,
4758
last_name: last_name,
@@ -57,6 +68,7 @@ def to_json(*)
5768
}
5869
end
5970

71+
# @deprecated Will be removed in a future major version. Use {#email} instead.
6072
def primary_email
6173
primary_email = (emails || []).find { |email| email[:primary] }
6274
return primary_email[:value] if primary_email

0 commit comments

Comments
 (0)