2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
class InviteSerializer < ApplicationSerializer
|
|
|
|
|
2019-11-26 02:52:48 -05:00
|
|
|
attributes :email, :updated_at, :redeemed_at, :expired, :user
|
2013-02-05 14:16:51 -05:00
|
|
|
|
|
|
|
def include_email?
|
2020-03-04 11:47:09 -05:00
|
|
|
options[:show_emails] && !object.redeemed?
|
2013-02-05 14:16:51 -05:00
|
|
|
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
|