Class: UserAuthTokenSerializer

Inherits:
ApplicationSerializer show all
Includes:
UserAuthTokensMixin
Defined in:
app/serializers/user_auth_token_serializer.rb

Instance Method Summary collapse

Methods included from UserAuthTokensMixin

#browser, #client_ip, #device, #icon, #location, #os

Methods inherited from ApplicationSerializer

expire_cache_fragment!, fragment_cache

Methods inherited from ActiveModel::Serializer

#include!

Instance Method Details

#include_is_active?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/serializers/user_auth_token_serializer.rb', line 9

def include_is_active?
  scope && scope.request
end

#is_activeObject



13
14
15
# File 'app/serializers/user_auth_token_serializer.rb', line 13

def is_active
  scope.auth_token == object.auth_token
end

#seen_atObject



17
18
19
20
21
# File 'app/serializers/user_auth_token_serializer.rb', line 17

def seen_at
  return object.created_at unless object.seen_at.present?

  object.seen_at
end