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
-
#big_icon ⇒ Object
big icon.
-
#is_compilation ⇒ Object
indicates if the album is a compilation.
-
#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, extras = 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, extras = 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.
-
#compilation? ⇒ Boolean
indicates if the album is a compilation.
-
#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.
96 97 98 |
# File 'lib/rdio/types.rb', line 96 def initialize(api) super api end |
Instance Attribute Details
#big_icon ⇒ Object
big icon
101 102 103 |
# File 'lib/rdio/types.rb', line 101 def big_icon @big_icon end |
#is_compilation ⇒ Object
indicates if the album is a compilation
113 114 115 |
# File 'lib/rdio/types.rb', line 113 def is_compilation @is_compilation end |
#secondary_id ⇒ Object
the secondary id
107 108 109 |
# File 'lib/rdio/types.rb', line 107 def secondary_id @secondary_id end |
#track_ids ⇒ Object
the track ids
104 105 106 |
# File 'lib/rdio/types.rb', line 104 def track_ids @track_ids end |
#tracks(extras = nil) ⇒ Object
Return an array of Track
110 111 112 |
# File 'lib/rdio/types.rb', line 110 def tracks @tracks end |
Class Method Details
.all(keys, extras = nil) ⇒ Object
Fetch one or more objects from Rdio of type Album.
152 153 154 |
# File 'lib/rdio/types.rb', line 152 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.
163 164 165 |
# File 'lib/rdio/types.rb', line 163 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, extras = nil) ⇒ Object
Get the albums in the user’s collection by a particular artist.
168 169 170 |
# File 'lib/rdio/types.rb', line 168 def self.for_artist_in_collection(artist,user=nil,extras=nil) Rdio::api.getAlbumsForArtistInCollection artist,user,extras 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.
185 186 187 |
# File 'lib/rdio/types.rb', line 185 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.
191 192 193 |
# File 'lib/rdio/types.rb', line 191 def self.from_url(url) Rdio::api.getObjectFromUrl url,Album end |
.get(key, extras = nil) ⇒ Object
Fetch one object from Rdio of type Album.
157 158 159 160 |
# File 'lib/rdio/types.rb', line 157 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, extras = nil) ⇒ Object
Get all of the albums in the user’s collection.
173 174 175 176 |
# File 'lib/rdio/types.rb', line 173 def self.in_collection(user=nil,start=nil,count=nil, sort=nil,query=nil,extras=nil) Rdio::api.getAlbumsInCollection user,start,count,sort,query,extras end |
.new_releases(time) ⇒ Object
Return new albums released across a timeframe.
179 180 181 |
# File 'lib/rdio/types.rb', line 179 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
146 147 148 149 |
# File 'lib/rdio/types.rb', line 146 def self.search(query,never_or=nil,extras=nil,start=nil,count=nil) extras = Rdio::add_to_array extras,'albums' Search.search query,Album,never_or,extras,start,count end |
Instance Method Details
#artist ⇒ Object
Returns the Artist
131 132 133 |
# File 'lib/rdio/types.rb', line 131 def artist Artist.get artist_key end |
#artist_name ⇒ Object
Returns the String artist name
136 137 138 |
# File 'lib/rdio/types.rb', line 136 def artist_name @artist end |
#clean? ⇒ Boolean
is the album clean
126 127 128 |
# File 'lib/rdio/types.rb', line 126 def clean? is_clean end |
#compilation? ⇒ Boolean
indicates if the album is a compilation
116 117 118 |
# File 'lib/rdio/types.rb', line 116 def compilation? is_compilation end |
#explicit? ⇒ Boolean
is the album explicit?
121 122 123 |
# File 'lib/rdio/types.rb', line 121 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.
201 202 203 |
# File 'lib/rdio/types.rb', line 201 def tracks_in_collection(user=nil,extras=nil) api.getTracksForAlbumInCollection self,user,extras end |