Class: MusicBrainz::Webservice::ArtistIncludes

Inherits:
AbstractIncludes show all
Defined in:
lib/rbrainz/webservice/includes.rb

Overview

A specification on how much data to return with an artist.

The MusicBrainz server only supports some combinations of release types for the releases and vaReleases include tags. At the moment, not more than two release types should be selected, while one of them has to be Release.TYPE_OFFICIAL, Release.TYPE_PROMOTION or Release.TYPE_BOOTLEG.

Instance Method Summary collapse

Methods inherited from AbstractIncludes

#to_s

Constructor Details

#initialize(includes) ⇒ ArtistIncludes

Includes is a hash with the following fields: [:aliases] Include aliases (boolean). [:release_groups] Include release groups (boolean). [:releases] Array of release types that should be included in the result. All releases of the artist that match all of those types will be included. Use the constants defined in Model::Release for the release types. [:va_releases] Array of release types. All various artist releases the artist appears on and that match all of those types will be included. Use the constants defined in Model::Release for the release types. [:artist_rels] Include artist relationships (boolean). [:release_rels] Include release relationships (boolean). [:track_rels] Include track relationships (boolean). [:label_rels] Include label relationships (boolean). [:url_rels] Include url relationships (boolean). [:counts] Includes the track number (boolean). [:release_events] Includes the release events (boolean). [:discs] Include the disc IDs (boolean). [:labels] Include the labels under which the release [:tags] Include tags (boolean). [:user_tags] Include user tags (boolean). [:ratings] Include ratings (boolean). [:user_ratings] Include user ratings (boolean).

--

TODO

Check release types. It's possible that :releases and :va_releases can't be used in parallel.

++



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/rbrainz/webservice/includes.rb', line 73

def initialize(includes)
  Utils.check_options includes, 
    :aliases, :artist_rels, :release_rels, :track_rels, :label_rels,
    :url_rels, :tags, :release_groups, :releases, :va_releases, :counts,
    :release_events, :discs, :labels, :user_tags, :ratings, :user_ratings
  @parameters = Array.new
  @parameters << 'aliases'      if includes[:aliases]
  @parameters << 'artist-rels'  if includes[:artist_rels]
  @parameters << 'release-rels' if includes[:release_rels]
  @parameters << 'track-rels'   if includes[:track_rels]
  @parameters << 'label-rels'   if includes[:label_rels]
  @parameters << 'url-rels'     if includes[:url_rels]
  @parameters << 'counts'       if includes[:counts]
  @parameters << 'release-events' if includes[:release_events]
  @parameters << 'release-groups' if includes[:release_groups]
  @parameters << 'discs'        if includes[:discs]
  @parameters << 'labels'       if includes[:labels]
  @parameters << 'tags'         if includes[:tags]
  @parameters << 'user-tags'    if includes[:user_tags]
  @parameters << 'ratings'      if includes[:ratings]
  @parameters << 'user-ratings' if includes[:user_ratings]
  
  includes[:releases].each {|release_type|
    @parameters << 'sa-' + Utils.remove_namespace(release_type.to_s)
  } if includes[:releases]
  
  includes[:va_releases].each {|release_type|
    @parameters << 'va-' + Utils.remove_namespace(release_type.to_s)
  } if includes[:va_releases]
end