Skip to content

Commit

Permalink
add last_sign_in_at to user
Browse files Browse the repository at this point in the history
  • Loading branch information
stacurry committed Feb 13, 2025
1 parent f947050 commit 3d5582b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
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, :created_at, :updated_at
:profile_picture_url, :last_sign_in_at, :created_at, :updated_at

def initialize(json)
hash = JSON.parse(json, symbolize_names: true)
Expand All @@ -19,6 +19,7 @@ def initialize(json)
@last_name = hash[:last_name]
@email_verified = hash[:email_verified]
@profile_picture_url = hash[:profile_picture_url]
@last_sign_in_at = hash[:last_sign_in_at]
@created_at = hash[:created_at]
@updated_at = hash[:updated_at]
end
Expand All @@ -31,6 +32,7 @@ def to_json(*)
last_name: last_name,
email_verified: email_verified,
profile_picture_url: profile_picture_url,
last_sign_in_at: last_sign_in_at,
created_at: created_at,
updated_at: updated_at,
}
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/workos/user_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@

expect(user.id.instance_of?(String))
expect(user.instance_of?(WorkOS::User))
expect(user.first_name).to eq('Bob')
expect(user.last_name).to eq('Loblaw')
expect(user.email).to eq('[email protected]')
expect(user.email_verified).to eq(false)
expect(user.profile_picture_url). to eq(nil)
expect(user.last_sign_in_at).to eq('2024-02-06T23:13:18.137Z')
end
end
end
Expand Down

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

0 comments on commit 3d5582b

Please sign in to comment.