Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/workos/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class User
include HashProvider

attr_accessor :id, :email, :first_name, :last_name, :email_verified,
:profile_picture_url, :external_id, :last_sign_in_at, :created_at, :updated_at
:profile_picture_url, :external_id, :locale, :last_sign_in_at, :created_at, :updated_at

def initialize(json)
hash = JSON.parse(json, symbolize_names: true)
Expand All @@ -20,6 +20,7 @@ def initialize(json)
@email_verified = hash[:email_verified]
@profile_picture_url = hash[:profile_picture_url]
@external_id = hash[:external_id]
@locale = hash[:locale]
@last_sign_in_at = hash[:last_sign_in_at]
@created_at = hash[:created_at]
@updated_at = hash[:updated_at]
Expand All @@ -34,6 +35,7 @@ def to_json(*)
email_verified: email_verified,
profile_picture_url: profile_picture_url,
external_id: external_id,
locale: locale,
last_sign_in_at: last_sign_in_at,
created_at: created_at,
updated_at: updated_at,
Expand Down
3 changes: 3 additions & 0 deletions lib/workos/user_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ def create_user(
# @param [String] last_name The user's last name.
# @param [Boolean] email_verified Whether the user's email address was previously verified.
# @param [String] external_id The users's external ID
# @param [String] locale The user's locale.
# @param [String] password The user's password.
# @param [String] password_hash The user's hashed password.
# @option [String] password_hash_type The algorithm originally used to hash the password.
Expand All @@ -243,6 +244,7 @@ def update_user(
last_name: :not_set,
email_verified: :not_set,
external_id: :not_set,
locale: :not_set,
password: :not_set,
password_hash: :not_set,
password_hash_type: :not_set
Expand All @@ -255,6 +257,7 @@ def update_user(
last_name: last_name,
email_verified: email_verified,
external_id: external_id,
locale: locale,
password: password,
password_hash: password_hash,
password_hash_type: password_hash_type,
Expand Down
11 changes: 11 additions & 0 deletions spec/lib/workos/user_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,16 @@
end
end

it 'can update user locale' do
VCR.use_cassette 'user_management/update_user/locale' do
user = described_class.update_user(
id: 'user_01K78B3ZB5B7119MYEXTQE5KNE',
locale: 'en-US',
)
expect(user.locale).to eq('en-US')
end
end

it 'can update email addresses' do
VCR.use_cassette 'user_management/update_user/email' do
user = described_class.update_user(
Expand All @@ -462,6 +472,7 @@
expect(body).not_to have_key(:first_name)
expect(body).not_to have_key(:last_name)
expect(body).not_to have_key(:email)
expect(body).not_to have_key(:locale)

# Return a mock request object
double('request')
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.