Class: MusicBrainz::ReleaseGroup

Inherits:
BaseModel show all
Defined in:
lib/musicbrainz/models/release_group.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

inherited

Class Method Details

.find(id) ⇒ Object


22
23
24
25
26
27
# File 'lib/musicbrainz/models/release_group.rb', line 22

def find(id)
  client.load(:release_group, { id: id, inc: [:url_rels] }, {
    binding: :release_group,
    create_model: :release_group
  })
end

.find_by_artist_and_title(artist_name, title, type = nil) ⇒ Object


37
38
39
40
# File 'lib/musicbrainz/models/release_group.rb', line 37

def find_by_artist_and_title(artist_name, title, type = nil )
  matches = search(artist_name, title, type)
  matches.nil? || matches.empty? ? nil : find(matches.first[:id])
end

.search(artist_name, title, type = nil) ⇒ Object


29
30
31
32
33
34
35
# File 'lib/musicbrainz/models/release_group.rb', line 29

def search(artist_name, title, type = nil)
				if type
					super({artist: artist_name, releasegroup: title, type: type})
				else
					super({artist: artist_name, releasegroup: title})
				end
end

Instance Method Details

#releasesObject


13
14
15
16
17
18
19
# File 'lib/musicbrainz/models/release_group.rb', line 13

def releases
  @releases ||= client.load(:release, { release_group: id, inc: [:media, :release_groups], limit: 100 }, {
    binding: :release_group_releases,
    create_models: :release,
    sort: :date
  }) unless @id.nil?
end