Merge pull request #13 from Applicat/add_asin_attribute_to_release2
Adds release fields asin, barcode and quality.
This commit is contained in:
		
						commit
						5d1eeb009a
					
				@ -109,7 +109,10 @@ MusicBrainz::Release.find(id)
 | 
				
			|||||||
  :status  => String,
 | 
					  :status  => String,
 | 
				
			||||||
  :format  => String,
 | 
					  :format  => String,
 | 
				
			||||||
  :date    => Date,
 | 
					  :date    => Date,
 | 
				
			||||||
  :country => String
 | 
					  :country => String,
 | 
				
			||||||
 | 
					  :asin    => String,
 | 
				
			||||||
 | 
					  :barcode => String,
 | 
				
			||||||
 | 
					  :quality => String
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,10 @@ module MusicBrainz
 | 
				
			|||||||
          title: (xml.xpath('./title').text rescue nil),
 | 
					          title: (xml.xpath('./title').text rescue nil),
 | 
				
			||||||
          status: (xml.xpath('./status').text rescue nil),
 | 
					          status: (xml.xpath('./status').text rescue nil),
 | 
				
			||||||
          country: (xml.xpath('./country').text rescue nil),
 | 
					          country: (xml.xpath('./country').text rescue nil),
 | 
				
			||||||
          date: (xml.xpath('./date').text rescue nil)
 | 
					          date: (xml.xpath('./date').text rescue nil),
 | 
				
			||||||
 | 
					          asin: (xml.xpath('./asin').text rescue nil),
 | 
				
			||||||
 | 
					          barcode: (xml.xpath('./barcode').text rescue nil),
 | 
				
			||||||
 | 
					          quality: (xml.xpath('./quality').text rescue nil)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        formats = (xml.xpath('./medium-list/medium/format') rescue []).map(&:text)
 | 
					        formats = (xml.xpath('./medium-list/medium/format') rescue []).map(&:text)
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,9 @@ module MusicBrainz
 | 
				
			|||||||
    field :format, String
 | 
					    field :format, String
 | 
				
			||||||
    field :date, Date
 | 
					    field :date, Date
 | 
				
			||||||
    field :country, String
 | 
					    field :country, String
 | 
				
			||||||
 | 
					    field :asin, String
 | 
				
			||||||
 | 
					    field :barcode, String
 | 
				
			||||||
 | 
					    field :quality, String
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def tracks
 | 
					    def tracks
 | 
				
			||||||
      @tracks ||= client.load(:release, { id: id, inc: [:recordings, :media], limit: 100 }, {
 | 
					      @tracks ||= client.load(:release, { id: id, inc: [:recordings, :media], limit: 100 }, {
 | 
				
			||||||
 | 
				
			|||||||
@ -15,12 +15,15 @@ describe MusicBrainz::Release do
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it "gets correct release data" do
 | 
					  it "gets correct release data" do
 | 
				
			||||||
    release = MusicBrainz::Release.find("2225dd4c-ae9a-403b-8ea0-9e05014c778f")
 | 
					    release = MusicBrainz::Release.find("b94cb547-cf7a-4357-894c-53c3bf33b093")
 | 
				
			||||||
    release.id.should == "2225dd4c-ae9a-403b-8ea0-9e05014c778f"
 | 
					    release.id.should == "b94cb547-cf7a-4357-894c-53c3bf33b093"
 | 
				
			||||||
    release.title.should == "Empire"
 | 
					    release.title.should == "Humanoid"
 | 
				
			||||||
    release.status.should == "Official"
 | 
					    release.status.should == "Official"
 | 
				
			||||||
    release.date.should == Date.new(2006, 8, 28)
 | 
					    release.date.should == Date.new(2009, 10, 6)
 | 
				
			||||||
    release.country.should == "GB"
 | 
					    release.country.should == "US"
 | 
				
			||||||
 | 
					    release.asin.should == 'B002NOYX6I'
 | 
				
			||||||
 | 
					    release.barcode.should == '602527197692'
 | 
				
			||||||
 | 
					    release.quality.should == 'normal'
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it "gets correct release tracks" do
 | 
					  it "gets correct release tracks" do
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user