Class: SpotifyWebApi::SavedAlbumObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::SavedAlbumObject
- Defined in:
- lib/spotify_web_api/models/saved_album_object.rb
Overview
SavedAlbumObject Model.
Instance Attribute Summary collapse
-
#added_at ⇒ DateTime
The date and time the album was saved Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ.
-
#album ⇒ AlbumObject
Information about the album.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(added_at = SKIP, album = SKIP) ⇒ SavedAlbumObject
constructor
A new instance of SavedAlbumObject.
- #to_custom_added_at ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(added_at = SKIP, album = SKIP) ⇒ SavedAlbumObject
Returns a new instance of SavedAlbumObject.
47 48 49 50 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 47 def initialize(added_at = SKIP, album = SKIP) @added_at = added_at unless added_at == SKIP @album = album unless album == SKIP end |
Instance Attribute Details
#added_at ⇒ DateTime
The date and time the album was saved Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ. If the time is imprecise (for example, the date/time of an album release), an additional field indicates the precision; see for example, release_date in an album object.
20 21 22 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 20 def added_at @added_at end |
#album ⇒ AlbumObject
Information about the album.
24 25 26 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 24 def album @album end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. added_at = if hash.key?('added_at') (DateTimeHelper.from_rfc3339(hash['added_at']) if hash['added_at']) else SKIP end album = AlbumObject.from_hash(hash['album']) if hash['album'] # Create object from extracted values. SavedAlbumObject.new(added_at, album) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['added_at'] = 'added_at' @_hash['album'] = 'album' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
35 36 37 38 39 40 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 35 def self.optionals %w[ added_at album ] end |
Instance Method Details
#to_custom_added_at ⇒ Object
69 70 71 |
# File 'lib/spotify_web_api/models/saved_album_object.rb', line 69 def to_custom_added_at DateTimeHelper.to_rfc3339(added_at) end |