Class: Rdio::Track
- Defined in:
- lib/rdio/types.rb
Overview
Represents a song on Rdio
Instance Attribute Summary collapse
-
#big_icon ⇒ Object
big icon.
-
#is_on_compilation ⇒ Object
indicates if the track is on a compilation.
-
#secondary_id ⇒ Object
the secondary id.
-
#track_num ⇒ Object
the track number.
Attributes inherited from TrackData
#album_artist_key, #album_key, #album_url, #artist_key, #artist_url, #base_icon, #can_download, #can_download_album_only, #can_sample, #can_stream, #can_tether, #duration, #embed_url, #icon, #is_clean, #is_explicit, #length, #name, #play_count, #price, #short_url, #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 Track.
-
.for_album_in_collection(album, user = nil, extras = nil) ⇒ Object
Which tracks on the given album are in the user’s collection.
-
.for_artist(artist, appears_on = nil, start = nil, count = nil, extras = nil) ⇒ Object
Get all of the tracks by this artist.
-
.for_artist_in_collection(artist, user = nil, extras = nil) ⇒ Object
Which tracks from the given artist are in the user’s collection.
-
.from_short_code(short_code) ⇒ Object
Return the Track that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.
-
.from_url(url) ⇒ Object
Return the Track 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 Track.
-
.in_collection(user = nil, start = nil, count = nil, sort = nil, query = nil, extras = nil) ⇒ Object
Get all of the tracks in the user’s collection.
-
.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object
Returns an array of Track for the query and other params.
-
.top_charts ⇒ Object
Return the site-wide most popular items for Tracks.
Instance Method Summary collapse
-
#album(extras = nil) ⇒ Object
Returns the Album.
-
#album_artist(extras = nil) ⇒ Object
Returns the album Artist.
-
#album_artist_name ⇒ Object
Returns the string album artist name.
-
#album_name ⇒ Object
Returns the String album name.
-
#artist(extras = nil) ⇒ Object
Returns the Artist.
-
#artist_name ⇒ Object
Returns the string artist name.
-
#initialize(api) ⇒ Track
constructor
A new instance of Track.
-
#on_compilation? ⇒ Boolean
indicates if the track is on a compilation.
Methods inherited from BaseObj
Methods inherited from ApiObj
Constructor Details
#initialize(api) ⇒ Track
Returns a new instance of Track.
212 213 214 |
# File 'lib/rdio/types.rb', line 212 def initialize(api) super api end |
Instance Attribute Details
#big_icon ⇒ Object
big icon
226 227 228 |
# File 'lib/rdio/types.rb', line 226 def big_icon @big_icon end |
#is_on_compilation ⇒ Object
indicates if the track is on a compilation
223 224 225 |
# File 'lib/rdio/types.rb', line 223 def is_on_compilation @is_on_compilation end |
#secondary_id ⇒ Object
the secondary id
220 221 222 |
# File 'lib/rdio/types.rb', line 220 def secondary_id @secondary_id end |
#track_num ⇒ Object
the track number
217 218 219 |
# File 'lib/rdio/types.rb', line 217 def track_num @track_num end |
Class Method Details
.all(keys, extras = nil) ⇒ Object
Fetch one or more objects from Rdio of type Track.
287 288 289 |
# File 'lib/rdio/types.rb', line 287 def self.all(keys,extras=nil) Rdio::api.get keys,Track,extras end |
.for_album_in_collection(album, user = nil, extras = nil) ⇒ Object
Which tracks on the given album are in the user’s collection.
315 316 317 |
# File 'lib/rdio/types.rb', line 315 def self.for_album_in_collection(album,user=nil,extras=nil) Rdio::api.getTracksForAlbumInCollection album,user,extras end |
.for_artist(artist, appears_on = nil, start = nil, count = nil, extras = nil) ⇒ Object
Get all of the tracks by this artist.
276 277 278 279 |
# File 'lib/rdio/types.rb', line 276 def self.for_artist(artist,appears_on=nil,start=nil, count=nil,extras=nil) Rdio::api.getTracksForArtist artist,appears_on,start,count,extras end |
.for_artist_in_collection(artist, user = nil, extras = nil) ⇒ Object
Which tracks from the given artist are in the user’s collection.
282 283 284 |
# File 'lib/rdio/types.rb', line 282 def self.for_artist_in_collection(artist,user=nil,extras=nil) Rdio::api.getTracksForArtistInCollection artist,user,extras end |
.from_short_code(short_code) ⇒ Object
Return the Track that the supplied Rdio short-code is a representation of, or null if the short-code is invalid.
299 300 301 |
# File 'lib/rdio/types.rb', line 299 def self.from_short_code(short_code) Rdio::api.getObjectFromShortCode short_code,Track end |
.from_url(url) ⇒ Object
Return the Track that the supplied Rdio url is a representation of, or null if the url doesn’t represent an object.
305 306 307 |
# File 'lib/rdio/types.rb', line 305 def self.from_url(url) Rdio::api.getObjectFromUrl url,Track end |
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type Track.
292 293 294 295 |
# File 'lib/rdio/types.rb', line 292 def self.get(key,extras=nil) arr = all [key],extras return (arr and not arr.empty?) ? arr[0] : nil end |
.in_collection(user = nil, start = nil, count = nil, sort = nil, query = nil, extras = nil) ⇒ Object
Get all of the tracks in the user’s collection.
270 271 272 273 |
# File 'lib/rdio/types.rb', line 270 def self.in_collection(user=nil,start=nil,count=nil, sort=nil,query=nil,extras=nil) Rdio::api.getTracksInCollection user,start,count,sort,query,extras end |
.search(query, never_or = nil, extras = nil, start = nil, count = nil) ⇒ Object
Returns an array of Track for the query and other params
264 265 266 267 |
# File 'lib/rdio/types.rb', line 264 def self.search(query,never_or=nil,extras=nil,start=nil,count=nil) extras = Rdio::add_to_array extras,'tracks' Search.search query,Track,never_or,extras,start,count end |
Instance Method Details
#album(extras = nil) ⇒ Object
Returns the Album
234 235 236 |
# File 'lib/rdio/types.rb', line 234 def album(extras=nil) Album.get @album_key,extras end |
#album_artist(extras = nil) ⇒ Object
Returns the album Artist
244 245 246 |
# File 'lib/rdio/types.rb', line 244 def album_artist(extras=nil) Artist.get @album_artist_key,extras end |
#album_artist_name ⇒ Object
Returns the string album artist name
259 260 261 |
# File 'lib/rdio/types.rb', line 259 def album_artist_name @album_artist end |
#album_name ⇒ Object
Returns the String album name
249 250 251 |
# File 'lib/rdio/types.rb', line 249 def album_name @album end |
#artist(extras = nil) ⇒ Object
Returns the Artist
239 240 241 |
# File 'lib/rdio/types.rb', line 239 def artist(extras=nil) Artist.get @artist_key,extras end |
#artist_name ⇒ Object
Returns the string artist name
254 255 256 |
# File 'lib/rdio/types.rb', line 254 def artist_name @artist end |
#on_compilation? ⇒ Boolean
indicates if the track is on a compilation
229 230 231 |
# File 'lib/rdio/types.rb', line 229 def on_compilation? is_on_compilation end |