Sha256: 9571172124e13ffa1f264d5ac8924f5465d55acb21da722b8842fe7bcfacaa25

Contents?: true

Size: 914 Bytes

Versions: 22

Compression:

Stored size: 914 Bytes

Contents

module MyApp
  class SongSerializer
    include RestPack::Serializer
    attributes :id, :title, :album_id
    can_include :albums, :artists
    can_filter_by :title
    can_sort_by :id, :title

    def title
      @context[:reverse_title?] ? @model.title.reverse : @model.title
    end
  end

  class AlbumSerializer
    include RestPack::Serializer
    attributes :id, :title, :year, :artist_id
    can_include :artists, :songs
    can_filter_by :year
  end

  class AlbumReviewSerializer
    include RestPack::Serializer
    attributes :message
    can_filter_by :album
  end

  class ArtistSerializer
    include RestPack::Serializer
    attributes :id, :name, :website
    can_include :albums, :songs, :fans, :stalkers
  end

  class FanSerializer
    include RestPack::Serializer
    attributes :id, :name
  end

  class StalkerSerializer
    include RestPack::Serializer
    attributes :id, :name
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
restpack_serializer-0.6.15 spec/fixtures/serializers.rb
restpack_serializer-0.6.14 spec/fixtures/serializers.rb
restpack_serializer-0.6.13 spec/fixtures/serializers.rb
restpack_serializer-0.6.12 spec/fixtures/serializers.rb
restpack_serializer-0.6.11 spec/fixtures/serializers.rb
restpack_serializer-0.6.10 spec/fixtures/serializers.rb
restpack_serializer-0.6.9 spec/fixtures/serializers.rb
restpack_serializer-0.6.8 spec/fixtures/serializers.rb
restpack_serializer-0.6.7 spec/fixtures/serializers.rb
restpack_serializer-0.6.6 spec/fixtures/serializers.rb
restpack_serializer-0.6.5 spec/fixtures/serializers.rb
restpack_serializer-0.6.4 spec/fixtures/serializers.rb
restpack_serializer-0.6.3 spec/fixtures/serializers.rb
restpack_serializer-0.6.2 spec/fixtures/serializers.rb
restpack_serializer-0.6.1 spec/fixtures/serializers.rb
restpack_serializer-0.5.10 spec/fixtures/serializers.rb
restpack_serializer-0.5.9 spec/fixtures/serializers.rb
restpack_serializer-0.5.8 spec/fixtures/serializers.rb
restpack_serializer-0.5.7 spec/fixtures/serializers.rb
restpack_serializer-0.5.6 spec/fixtures/serializers.rb