metamaps--metamaps/app/serializers/api/v2/map_serializer.rb
Devin Howard d193c9a53c add starred to maps API (#719)
* add starred to maps API and endpoint to create/delete

* add token to requests without token param

* add minor version number to api version

* metacode/user use uri in schema

* make code climate happier
2016-10-05 10:36:03 -04:00

34 lines
726 B
Ruby

# frozen_string_literal: true
module Api
module V2
class MapSerializer < ApplicationSerializer
attributes :id,
:name,
:desc,
:permission,
:screenshot,
:starred,
:created_at,
:updated_at
def starred
object.starred_by_user?(scope[:current_user])
end
def self.embeddable
{
user: {},
topics: {},
synapses: {},
mappings: {},
contributors: { serializer: UserSerializer },
collaborators: { serializer: UserSerializer }
}
end
class_eval do
embed_dat
end
end
end
end