2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-09 10:19:32 -05:00
|
|
|
class InvitedUserSerializer < ApplicationSerializer
|
|
|
|
attributes :id, :redeemed_at, :user, :invite_source
|
2013-02-05 13:16:51 -06:00
|
|
|
|
2020-06-09 10:19:32 -05:00
|
|
|
def id
|
|
|
|
object.invite.id
|
2013-10-04 03:06:32 -05:00
|
|
|
end
|
|
|
|
|
2020-06-09 10:19:32 -05: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 13:13:04 -05:00
|
|
|
end
|
|
|
|
|
2020-06-09 10:19:32 -05:00
|
|
|
def invite_source
|
|
|
|
object.invite.is_invite_link? ? "link" : "email"
|
2013-10-04 03:06:32 -05:00
|
|
|
end
|
2013-02-05 13:16:51 -06:00
|
|
|
end
|