Class: Hallon::Album
- Defined in:
- lib/hallon/album.rb
Overview
Pretty much all methods require the album to be #loaded? to return meaningful results.
Albums are non-detailed metadata about actual music albums.
To retrieve copyrights, album review and tracks you need to browse the album. You do this by calling #browse to retrieve an AlbumBrowse instance.
It does still allow you to query some metadata information, such as its’ #name, #release_year, #type, #artist, #cover…
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.types ⇒ Array<Symbol>
An array of different kinds of albums (compilations, singles, …).
Instance Method Summary collapse
-
#artist ⇒ Artist?
Album artist.
-
#available? ⇒ Boolean
True if the album is available.
-
#browse ⇒ AlbumBrowse
Browse the Album by creating an AlbumBrowse instance from it.
-
#cover(size = :normal) ⇒ Image?
Album cover as an Image.
-
#cover_link(size = :normal) ⇒ Link?
Album cover as a spotify URI.
-
#from_link ⇒ Spotify::Link
private
Pointer representation of given link.
-
#initialize(link) ⇒ Album
constructor
Construct an Album from a link.
-
#loaded? ⇒ Boolean
True if the album is loaded.
-
#name ⇒ String
Name of the album.
-
#release_year ⇒ Integer
Release year of the album.
-
#to_link ⇒ Hallon::Link
Link for the current object.
-
#type ⇒ Symbol
Album type.
Methods included from Loadable
Methods included from Linkable
Methods inherited from Base
#==, from, from_link, #is_linkable?, #session, to_link, #to_pointer, #to_s
Constructor Details
Class Method Details
.types ⇒ Array<Symbol>
Returns an array of different kinds of albums (compilations, singles, …).
22 23 24 |
# File 'lib/hallon/album.rb', line 22 def self.types Spotify.enum_type(:albumtype).symbols end |
Instance Method Details
#artist ⇒ Artist?
Returns album artist.
76 77 78 79 |
# File 'lib/hallon/album.rb', line 76 def artist artist = Spotify.album_artist(pointer) Artist.from(artist) end |
#available? ⇒ Boolean
Returns true if the album is available.
66 67 68 |
# File 'lib/hallon/album.rb', line 66 def available? Spotify.album_is_available(pointer) end |
#browse ⇒ AlbumBrowse
Browse the Album by creating an Hallon::AlbumBrowse instance from it.
100 101 102 |
# File 'lib/hallon/album.rb', line 100 def browse AlbumBrowse.new(pointer) end |
#cover(size = :normal) ⇒ Image?
Returns album cover as an Image.
84 85 86 87 |
# File 'lib/hallon/album.rb', line 84 def cover(size = :normal) cover = Spotify.album_cover(pointer, size) Image.from(cover) end |
#cover_link(size = :normal) ⇒ Link?
Returns album cover as a spotify URI.
92 93 94 95 |
# File 'lib/hallon/album.rb', line 92 def cover_link(size = :normal) cover = Spotify.link_create_from_album_cover(pointer, size) Link.from(cover) end |
#from_link ⇒ Spotify::Link (private)
Returns pointer representation of given link.
31 |
# File 'lib/hallon/album.rb', line 31 from_link :as_album |
#loaded? ⇒ Boolean
Returns true if the album is loaded.
71 72 73 |
# File 'lib/hallon/album.rb', line 71 def loaded? Spotify.album_is_loaded(pointer) end |
#name ⇒ String
Returns name of the album.
50 51 52 |
# File 'lib/hallon/album.rb', line 50 def name Spotify.album_name(pointer) end |
#release_year ⇒ Integer
Returns release year of the album.
55 56 57 |
# File 'lib/hallon/album.rb', line 55 def release_year Spotify.album_year(pointer) end |
#to_link ⇒ Hallon::Link
Returns Link for the current object.
29 |
# File 'lib/hallon/album.rb', line 29 to_link :from_album |
#type ⇒ Symbol
Returns album type.
61 62 63 |
# File 'lib/hallon/album.rb', line 61 def type Spotify.album_type(pointer) end |