2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
class InviteSerializer < ApplicationSerializer
|
|
|
|
|
2014-03-21 14:13:04 -04:00
|
|
|
attributes :email, :created_at, :redeemed_at, :expired, :user
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
def include_email?
|
|
|
|
!object.redeemed?
|
|
|
|
end
|
|
|
|
|
2014-01-21 15:13:55 -05:00
|
|
|
def expired
|
|
|
|
object.expired?
|
|
|
|
end
|
|
|
|
|
2014-03-21 14:13:04 -04:00
|
|
|
def user
|
|
|
|
ser = InvitedUserSerializer.new(object.user, scope: scope, root: false)
|
|
|
|
ser.invited_by = object.invited_by
|
|
|
|
ser.as_json
|
|
|
|
end
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|