Module: MusicBrainz::Bindings::ReleaseGroupSearch

Extended by:
ReleaseGroupSearch
Included in:
ReleaseGroupSearch
Defined in:
lib/musicbrainz/bindings/release_group_search.rb

Instance Method Summary collapse

Instance Method Details

#parse(xml) ⇒ Object


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/musicbrainz/bindings/release_group_search.rb', line 5

def parse(xml)
  xml.xpath('./release-group-list/release-group').map do |xml|
    {
      id: (xml.attribute('id').value rescue nil),
      mbid: (xml.attribute('id').value rescue nil), # Old shit
      title: (xml.xpath('./title').text.gsub(/[`’]/, "'") rescue nil),
      type: (xml.attribute('type').value rescue nil),
      score: (xml.attribute('score').value.to_i rescue nil)
    } rescue nil
  end.delete_if{ |item| item.nil? }
end