Sha256: 696dc07ef8260d79f5c750018a5368cdfe7b24e3077afa1129f50b3c394134e3

Contents?: true

Size: 569 Bytes

Versions: 13

Compression:

Stored size: 569 Bytes

Contents

module MyApp
  class SongSerializer
    include RestPack::Serializer
    attributes :id, :title, :album_id
    can_include :albums, :artists
    can_filter_by :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 ArtistSerializer
    include RestPack::Serializer
    attributes :id, :name, :website
    can_include :albums, :songs
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
restpack_serializer-0.4.25 spec/fixtures/serializers.rb
restpack_serializer-0.4.24 spec/fixtures/serializers.rb
restpack_serializer-0.4.23 spec/fixtures/serializers.rb
restpack_serializer-0.4.21 spec/fixtures/serializers.rb
restpack_serializer-0.4.20 spec/fixtures/serializers.rb
restpack_serializer-0.4.19 spec/fixtures/serializers.rb
restpack_serializer-0.4.18 spec/fixtures/serializers.rb
restpack_serializer-0.4.17 spec/fixtures/serializers.rb
restpack_serializer-0.4.16 spec/fixtures/serializers.rb
restpack_serializer-0.4.15 spec/fixtures/serializers.rb
restpack_serializer-0.4.14 spec/fixtures/serializers.rb
restpack_serializer-0.4.13 spec/fixtures/serializers.rb
restpack_serializer-0.4.12 spec/fixtures/serializers.rb