Class: Rdio::Artist

Inherits:
ArtistData show all
Defined in:
lib/rdio/types.rb

Overview


Represents an artist on Rdio, either an individual performer or a group


Instance Attribute Summary collapse

Attributes inherited from ArtistData

#album_count, #base_icon, #has_radio, #icon, #length, #name, #short_url, #type, #url

Attributes inherited from BaseObj

#key

Attributes inherited from ApiObj

#api

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseObj

#eql?, #to_k

Methods inherited from ApiObj

#fill

Constructor Details

#initialize(api) ⇒ Artist

Returns a new instance of Artist.



11
12
13
# File 'lib/rdio/types.rb', line 11

def initialize(api)
  super api
end

Instance Attribute Details

#album_keysObject

Returns the value of attribute album_keys.



31
32
33
# File 'lib/rdio/types.rb', line 31

def album_keys
  @album_keys
end

#albums(featuring = nil, extras = nil, start = nil, count = nil) ⇒ Object

Get all the albums by this artist



45
46
47
# File 'lib/rdio/types.rb', line 45

def albums
  @albums
end

#artist_nameObject

Returns the value of attribute artist_name.



27
28
29
# File 'lib/rdio/types.rb', line 27

def artist_name
  @artist_name
end

#artist_urlObject

Returns the value of attribute artist_url.



25
26
27
# File 'lib/rdio/types.rb', line 25

def artist_url
  @artist_url
end

#countObject

Returns the value of attribute count.



18
19
20
# File 'lib/rdio/types.rb', line 18

def count
  @count
end

#frozen_track_listObject

Returns the value of attribute frozen_track_list.



24
25
26
# File 'lib/rdio/types.rb', line 24

def frozen_track_list
  @frozen_track_list
end

#has_offlineObject

Returns the value of attribute has_offline.



19
20
21
# File 'lib/rdio/types.rb', line 19

def has_offline
  @has_offline
end

#idObject

Returns the value of attribute id.



21
22
23
# File 'lib/rdio/types.rb', line 21

def id
  @id
end

#play_countObject

Returns the value of attribute play_count.



16
17
18
# File 'lib/rdio/types.rb', line 16

def play_count
  @play_count
end

#secondary_idObject

Returns the value of attribute secondary_id.



17
18
19
# File 'lib/rdio/types.rb', line 17

def secondary_id
  @secondary_id
end

#sortable_nameObject

Returns the value of attribute sortable_name.



20
21
22
# File 'lib/rdio/types.rb', line 20

def sortable_name
  @sortable_name
end

#tracks(appears_on = nil, start = nil, count = nil, extras = nil) ⇒ Object

Get all of the tracks by this artist.



40
41
42
# File 'lib/rdio/types.rb', line 40

def tracks
  @tracks
end

#user_keyObject

Returns the value of attribute user_key.



26
27
28
# File 'lib/rdio/types.rb', line 26

def user_key
  @user_key
end

#user_nameObject

Returns the value of attribute user_name.



23
24
25
# File 'lib/rdio/types.rb', line 23

def user_name
  @user_name
end

Class Method Details

.all(keys, extras = nil) ⇒ Object

Fetch one or more objects from Rdio of type Artist.



55
56
57
# File 'lib/rdio/types.rb', line 55

def self.all(keys,extras=nil)
  Rdio::api.get keys,Artist,extras
end

.from_short_code(short_code) ⇒ Object

Return the Artist that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.



72
73
74
# File 'lib/rdio/types.rb', line 72

def self.from_short_code(short_code)
  Rdio::api.getObjectFromShortCode short_code,Artist
end

.from_url(url) ⇒ Object

Return the Artist that the supplied Rdio url is a representation of, or null if the url doesn’t represent an object.



78
79
80
# File 'lib/rdio/types.rb', line 78

def self.from_url(url)
  Rdio::api.getObjectFromUrl url,Artist
end

.get(key, extras = nil) ⇒ Object

Fetch one object from Rdio of type Artist.



60
61
62
63
# File 'lib/rdio/types.rb', line 60

def self.get(key,extras=nil)
  arr = all [key],extras
  (arr and not arr.empty?) ? arr[0] : nil
end

.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object

Returns an array of Artist for the query and other params



34
35
36
37
# File 'lib/rdio/types.rb', line 34

def self.search(query,never_or=nil,extras=nil,start=nil,count=nil)
  extras = Rdio::add_to_array extras,'artists'
  Search.search query,Artist,never_or,extras,start,count
end

.top_chartsObject

Return the site-wide most popular items for Artists



83
84
85
# File 'lib/rdio/types.rb', line 83

def self.top_charts
  Rdio::api.getTopCharts Artist
end

Instance Method Details

#in_collection(user = nil, start = nil, count = nil, sort = nil, query = nil) ⇒ Object

Get all of the artist in a user’s collection.



66
67
68
# File 'lib/rdio/types.rb', line 66

def in_collection(user=nil,start=nil,count=nil,sort=nil,query=nil)
  api.getArtistsInCollection user,start,count,sort,query
end

#tracks_in_collection(user = nil, extras = nil) ⇒ Object

Which tracks from the given artist are in the user’s collection.



50
51
52
# File 'lib/rdio/types.rb', line 50

def tracks_in_collection(user=nil,extras=nil)
  api.getTracksForArtistInCollection self,user,extras
end