Class: MusicBrainz::Artist
- Defined in:
- lib/musicbrainz/models/artist.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseModel
Class Method Details
.discography(mbid) ⇒ Object
31 32 33 34 35 |
# File 'lib/musicbrainz/models/artist.rb', line 31 def discography(mbid) artist = find(mbid) artist.release_groups.each { |rg| rg.releases.each { |r| r.tracks } } artist end |
.find(id) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/musicbrainz/models/artist.rb', line 20 def find(id) client.load(:artist, { id: id, inc: [:url_rels] }, { binding: :artist, create_model: :artist }) end |
.find_by_name(name) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/musicbrainz/models/artist.rb', line 37 def find_by_name(name) matches = search(name) if matches and not matches.empty? find(matches.first[:id]) end end |
.search(name) ⇒ Object
27 28 29 |
# File 'lib/musicbrainz/models/artist.rb', line 27 def search(name) super({artist: name}) end |
Instance Method Details
#release_groups ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/musicbrainz/models/artist.rb', line 11 def release_groups @release_groups ||= client.load(:release_group, { artist: id, inc: [:url_rels] }, { binding: :artist_release_groups, create_models: :release_group, sort: :first_release_date }) unless @id.nil? end |