2019-07-02 03:10:25 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::GroupRelationshipSerializer < ActiveModel::Serializer
|
2020-09-10 17:07:00 -05:00
|
|
|
attributes :id, :member, :admin, :moderator, :requested
|
2019-07-02 03:10:25 -04:00
|
|
|
|
|
|
|
def id
|
|
|
|
object.id.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def member
|
|
|
|
instance_options[:relationships].member[object.id] ? true : false
|
|
|
|
end
|
|
|
|
|
|
|
|
def admin
|
|
|
|
instance_options[:relationships].admin[object.id] ? true : false
|
|
|
|
end
|
2019-07-20 02:04:08 +03:00
|
|
|
|
2020-09-02 18:06:38 -05:00
|
|
|
def moderator
|
|
|
|
instance_options[:relationships].moderator[object.id] ? true : false
|
|
|
|
end
|
|
|
|
|
2020-09-10 17:07:00 -05:00
|
|
|
def requested
|
|
|
|
instance_options[:relationships].requested[object.id] ? true : false
|
|
|
|
end
|
|
|
|
|
2019-07-02 03:10:25 -04:00
|
|
|
end
|