Sha256: 7bc8e4e9a826cb1fb2c12ef43e49619338fc8a5a468de5a59aa8481983fda704

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

module MusicBrainz
  class Release < BaseModel
    field :id, String
    field :type, String
    field :title, String
    field :status, String
    field :format, String
    field :date, Date
    field :country, String
    field :asin, String
    field :barcode, String
    field :quality, String

    def tracks
      @tracks ||= client.load(:release, { id: id, inc: [:recordings, :media], limit: 100 }, {
        binding: :release_tracks,
        create_models: :track,
        sort: :position
      }) unless @id.nil?
    end

    class << self
      def find(id)
        client.load(:release, { id: id, inc: [:media, :release_groups] }, {
          binding: :release,
          create_model: :release
        })
      end

      def find_by_discid(id)
        client.load(:discid, { id: id }, {
          binding: :discid_releases,
          create_models: :release
        })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
musicbrainz-0.8.0 lib/musicbrainz/models/release.rb