1
0
Fork 0

Adds type field to release model.

This commit is contained in:
Mathias Gawlista 2013-01-24 21:12:58 +01:00
parent abd67818d3
commit ebf475e9c8
5 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@ module MusicBrainz
hash = {
id: (xml.attribute('id').value rescue nil),
type: (xml.xpath('./release-group').attribute('type').value rescue nil),
title: (xml.xpath('./title').text rescue nil),
status: (xml.xpath('./status').text rescue nil),
country: (xml.xpath('./country').text rescue nil),

View File

@ -1,6 +1,7 @@
module MusicBrainz
class Release < BaseModel
field :id, String
field :type, String
field :title, String
field :status, String
field :format, String
@ -20,7 +21,7 @@ module MusicBrainz
class << self
def find(id)
client.load(:release, { id: id, inc: [:media] }, {
client.load(:release, { id: id, inc: [:media, :release_groups] }, {
binding: :release,
create_model: :release
})

View File

@ -9,7 +9,7 @@ module MusicBrainz
alias_method :disambiguation, :desc
def releases
@releases ||= client.load(:release, { release_group: id, inc: [:media], limit: 100 }, {
@releases ||= client.load(:release, { release_group: id, inc: [:media, :release_groups], limit: 100 }, {
binding: :release_group_releases,
create_models: :release,
sort: :date

View File

@ -60,6 +60,7 @@ describe MusicBrainz::ReleaseGroup do
releases.first.title.should == "Empire"
releases.first.date.should == Date.new(2006, 8, 28)
releases.first.country.should == "GB"
releases.first.type.should == "Album"
end
end
end

View File

@ -24,6 +24,7 @@ describe MusicBrainz::Release do
release.asin.should == 'B002NOYX6I'
release.barcode.should == '602527197692'
release.quality.should == 'normal'
release.type.should == 'Album'
end
it "gets correct release tracks" do