Class: Rdio::Album
- Defined in:
- lib/rdio/types.rb
Overview
Represents a recording on Rdio, usually an album but often a single, EP or compilation
Instance Attribute Summary collapse
-
#secondary_id ⇒ Object
the secondary id.
-
#track_ids ⇒ Object
the track ids.
-
#tracks(extras = nil) ⇒ Object
Return an array of Track.
Attributes inherited from AlbumData
#artist_key, #artist_url, #base_icon, #can_sample, #can_stream, #can_tether, #display_date, #duration, #embed_url, #icon, #is_clean, #is_explicit, #length, #name, #price, #release_date, #release_date_iso, #short_url, #track_keys, #type, #url
Attributes inherited from BaseObj
Attributes inherited from ApiObj
Class Method Summary collapse
-
.all(keys, extras = nil) ⇒ Object
Fetch one or more objects from Rdio of type Album.
-
.for_artist(artist, featuring = nil, extras = nil, start = nil, count = nil) ⇒ Object
Return the albums by (or featuring) an artist.
-
.for_artist_in_collection(artist, user = nil) ⇒ Object
Get the albums in the user’s collection by a particular artist.
-
.from_short_code(short_code) ⇒ Object
Return the Albums that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.
-
.from_url(url) ⇒ Object
Return the Album that the supplied Rdio url is a representation of, or null if the url doesn’t represent an object.
-
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type Album.
-
.in_collection(user = nil, start = nil, count = nil, sort = nil, query = nil) ⇒ Object
Get all of the albums in the user’s collection.
-
.new_releases(time) ⇒ Object
Return new albums released across a timeframe.
-
.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object
Returns an array of Album for the query and other params.
-
.top_charts ⇒ Object
Return the site-wide most popular items for Albums.
Instance Method Summary collapse
-
#artist ⇒ Object
Returns the Artist.
-
#artist_name ⇒ Object
Returns the String artist name.
-
#clean? ⇒ Boolean
is the album clean.
-
#explicit? ⇒ Boolean
is the album explicit?.
-
#initialize(api) ⇒ Album
constructor
A new instance of Album.
-
#tracks_in_collection(user = nil, extras = nil) ⇒ Object
Which tracks on the given album are in the user’s collection.
Methods inherited from BaseObj
Methods inherited from ApiObj
Constructor Details
#initialize(api) ⇒ Album
Returns a new instance of Album.
95 96 97 |
# File 'lib/rdio/types.rb', line 95 def initialize(api) super api end |
Instance Attribute Details
#secondary_id ⇒ Object
the secondary id
103 104 105 |
# File 'lib/rdio/types.rb', line 103 def secondary_id @secondary_id end |
#track_ids ⇒ Object
the track ids
100 101 102 |
# File 'lib/rdio/types.rb', line 100 def track_ids @track_ids end |
#tracks(extras = nil) ⇒ Object
Return an array of Track
106 107 108 |
# File 'lib/rdio/types.rb', line 106 def tracks @tracks end |
Class Method Details
.all(keys, extras = nil) ⇒ Object
Fetch one or more objects from Rdio of type Album.
140 141 142 |
# File 'lib/rdio/types.rb', line 140 def self.all(keys,extras=nil) Rdio::api.get keys,Album,extras end |
.for_artist(artist, featuring = nil, extras = nil, start = nil, count = nil) ⇒ Object
Return the albums by (or featuring) an artist.
151 152 153 |
# File 'lib/rdio/types.rb', line 151 def self.for_artist(artist,featuring=nil,extras=nil,start=nil,count=nil) Rdio::api.getAlbumsForArtist artist,featuring,extras,start,count end |
.for_artist_in_collection(artist, user = nil) ⇒ Object
Get the albums in the user’s collection by a particular artist.
156 157 158 |
# File 'lib/rdio/types.rb', line 156 def self.for_artist_in_collection(artist,user=nil) Rdio::api.getAlbumsForArtistInCollection artist,user end |
.from_short_code(short_code) ⇒ Object
Return the Albums that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.
173 174 175 |
# File 'lib/rdio/types.rb', line 173 def self.from_short_code(short_code) Rdio::api.getObjectFromShortCode short_code,Album end |
.from_url(url) ⇒ Object
Return the Album that the supplied Rdio url is a representation of, or null if the url doesn’t represent an object.
179 180 181 |
# File 'lib/rdio/types.rb', line 179 def self.from_url(url) Rdio::api.getObjectFromUrl url,Album end |
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type Album.
145 146 147 148 |
# File 'lib/rdio/types.rb', line 145 def self.get(key,extras=nil) arr = all [key],extras (arr and not arr.empty?) ? arr[0] : nil end |
.in_collection(user = nil, start = nil, count = nil, sort = nil, query = nil) ⇒ Object
Get all of the albums in the user’s collection.
161 162 163 164 |
# File 'lib/rdio/types.rb', line 161 def self.in_collection(user=nil,start=nil,count=nil, sort=nil,query=nil) Rdio::api.getAlbumsInCollection user,start,count,sort,query end |
.new_releases(time) ⇒ Object
Return new albums released across a timeframe.
167 168 169 |
# File 'lib/rdio/types.rb', line 167 def self.new_releases(time) Rdio::api.getNewReleases time end |
.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object
Returns an array of Album for the query and other params
134 135 136 137 |
# File 'lib/rdio/types.rb', line 134 def self.search(query,never_or=nil,extras=nil,start=nil,count=nil) extras = add_to_array extras,'albums' Search.search query,Album,never_or,extras,start,count end |
Instance Method Details
#artist ⇒ Object
Returns the Artist
119 120 121 |
# File 'lib/rdio/types.rb', line 119 def artist Artist.get artist_key end |
#artist_name ⇒ Object
Returns the String artist name
124 125 126 |
# File 'lib/rdio/types.rb', line 124 def artist_name @artist end |
#clean? ⇒ Boolean
is the album clean
114 115 116 |
# File 'lib/rdio/types.rb', line 114 def clean? is_clean end |
#explicit? ⇒ Boolean
is the album explicit?
109 110 111 |
# File 'lib/rdio/types.rb', line 109 def explicit? is_explicit end |
#tracks_in_collection(user = nil, extras = nil) ⇒ Object
Which tracks on the given album are in the user’s collection.
189 190 191 |
# File 'lib/rdio/types.rb', line 189 def tracks_in_collection(user=nil,extras=nil) api.getTracksForAlbumInCollection self,user,extras end |