Skip to content

Commit ef77062

Browse files
authored
add last_sign_in_at to user (#352)
1 parent 6f2e8fd commit ef77062

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/workos/user.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class User
88
include HashProvider
99

1010
attr_accessor :id, :email, :first_name, :last_name, :email_verified,
11-
:profile_picture_url, :created_at, :updated_at
11+
:profile_picture_url, :last_sign_in_at, :created_at, :updated_at
1212

1313
def initialize(json)
1414
hash = JSON.parse(json, symbolize_names: true)
@@ -19,6 +19,7 @@ def initialize(json)
1919
@last_name = hash[:last_name]
2020
@email_verified = hash[:email_verified]
2121
@profile_picture_url = hash[:profile_picture_url]
22+
@last_sign_in_at = hash[:last_sign_in_at]
2223
@created_at = hash[:created_at]
2324
@updated_at = hash[:updated_at]
2425
end
@@ -31,6 +32,7 @@ def to_json(*)
3132
last_name: last_name,
3233
email_verified: email_verified,
3334
profile_picture_url: profile_picture_url,
35+
last_sign_in_at: last_sign_in_at,
3436
created_at: created_at,
3537
updated_at: updated_at,
3638
}

spec/lib/workos/user_management_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@
229229

230230
expect(user.id.instance_of?(String))
231231
expect(user.instance_of?(WorkOS::User))
232+
expect(user.first_name).to eq('Bob')
233+
expect(user.last_name).to eq('Loblaw')
234+
expect(user.email).to eq('[email protected]')
235+
expect(user.email_verified).to eq(false)
236+
expect(user.profile_picture_url).to eq(nil)
237+
expect(user.last_sign_in_at).to eq('2024-02-06T23:13:18.137Z')
232238
end
233239
end
234240
end

spec/support/fixtures/vcr_cassettes/user_management/get_user.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)