Skip to content
Snippets Groups Projects
user_devise_serializer.rb 1.41 KiB
Newer Older
bfs15's avatar
bfs15 committed

# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec.  If not, see <http://www.gnu.org/licenses/>.

class UserDeviseSerializer < ActiveModel::Serializer
  def avatar_file_name
    object.avatar.url
  def cover_file_name
    object.cover.url
  end

  attributes :id, :email, :teacher_id, :birthday, :provider, :avatar_file_name, :avatar_content_type, :uid, :name, :submitter_request,  :avatar_file_size, :avatar_updated_at,
             :bookmarks_count, :user_category_id, :score, :follows_count, :deleted_at, :description, :likes_count,
             :learning_objects_count, :collections_count, :cover_file_name, :cover_content_type, :cover_file_size, :cover_updated_at, :ask_teacher_question
  has_many :roles