2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-08-31 03:18:06 -05:00
|
|
|
class UserAuthTokenSerializer < ApplicationSerializer
|
2018-09-02 21:44:22 -05:00
|
|
|
include UserAuthTokensMixin
|
2018-08-31 03:18:06 -05:00
|
|
|
|
2018-09-02 21:44:22 -05:00
|
|
|
attributes :seen_at
|
2018-10-09 09:21:41 -05:00
|
|
|
attributes :is_active
|
|
|
|
|
|
|
|
def include_is_active?
|
|
|
|
scope && scope.request
|
|
|
|
end
|
|
|
|
|
|
|
|
def is_active
|
2018-10-11 18:40:48 -05:00
|
|
|
scope.auth_token == object.auth_token
|
2018-10-09 09:21:41 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def seen_at
|
|
|
|
return object.created_at unless object.seen_at.present?
|
|
|
|
|
|
|
|
object.seen_at
|
|
|
|
end
|
2018-08-31 03:18:06 -05:00
|
|
|
end
|