metamaps--metamaps/app/serializers/api/v2/map_serializer.rb

37 lines
776 B
Ruby
Raw Normal View History

2016-09-24 03:00:46 +00:00
# frozen_string_literal: true
2017-11-06 16:15:18 +00:00
module Api
module V2
class MapSerializer < ApplicationSerializer
attributes :id,
2016-09-24 03:00:46 +00:00
:name,
:desc,
:permission,
:screenshot,
:starred,
2016-09-24 03:00:46 +00:00
:created_at,
:updated_at
def starred
object.starred_by_user?(scope[:current_user])
end
def self.embeddable
{
user: {},
source: { serializer: MapSerializer },
topics: {},
synapses: {},
mappings: {},
contributors: { serializer: UserSerializer },
collaborators: { serializer: UserSerializer }
}
end
2016-09-24 03:00:46 +00:00
class_eval do
embed_dat
end
end
end
end