2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-09 11:19:32 -04:00
|
|
|
class InvitedUserSerializer < ApplicationSerializer
|
|
|
|
attributes :id, :redeemed_at, :user, :invite_source
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2020-06-09 11:19:32 -04:00
|
|
|
def id
|
|
|
|
object.invite.id
|
2013-10-04 04:06:32 -04:00
|
|
|
end
|
|
|
|
|
2020-06-09 11:19:32 -04:00
|
|
|
def user
|
|
|
|
ser = InvitedUserRecordSerializer.new(object.user, scope: scope, root: false)
|
|
|
|
ser.invited_by = object.invite.invited_by
|
|
|
|
ser.as_json
|
2014-03-21 14:13:04 -04:00
|
|
|
end
|
|
|
|
|
2020-06-09 11:19:32 -04:00
|
|
|
def invite_source
|
|
|
|
object.invite.is_invite_link? ? "link" : "email"
|
2013-10-04 04:06:32 -04:00
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|