Class: SpotifyWebApi::SavedEpisodeObject
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- SpotifyWebApi::SavedEpisodeObject
- Defined in:
- lib/spotify_web_api/models/saved_episode_object.rb
Overview
SavedEpisodeObject Model.
Instance Attribute Summary collapse
-
#added_at ⇒ DateTime
The date and time the episode was saved.
-
#episode ⇒ EpisodeObject
Information about the episode.
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, episode = SKIP) ⇒ SavedEpisodeObject
constructor
A new instance of SavedEpisodeObject.
- #to_custom_added_at ⇒ Object
Methods inherited from BaseModel
Constructor Details
#initialize(added_at = SKIP, episode = SKIP) ⇒ SavedEpisodeObject
Returns a new instance of SavedEpisodeObject.
44 45 46 47 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 44 def initialize(added_at = SKIP, episode = SKIP) @added_at = added_at unless added_at == SKIP @episode = episode unless episode == SKIP end |
Instance Attribute Details
#added_at ⇒ DateTime
The date and time the episode was saved. Timestamps are returned in ISO 8601 format as Coordinated Universal Time (UTC) with a zero offset: YYYY-MM-DDTHH:MM:SSZ.
17 18 19 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 17 def added_at @added_at end |
#episode ⇒ EpisodeObject
Information about the episode.
21 22 23 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 21 def episode @episode end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 50 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 episode = EpisodeObject.from_hash(hash['episode']) if hash['episode'] # Create object from extracted values. SavedEpisodeObject.new(added_at, episode) end |
.names ⇒ Object
A mapping from model property names to API property names.
24 25 26 27 28 29 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 24 def self.names @_hash = {} if @_hash.nil? @_hash['added_at'] = 'added_at' @_hash['episode'] = 'episode' @_hash end |
.nullables ⇒ Object
An array for nullable fields
40 41 42 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 40 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
32 33 34 35 36 37 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 32 def self.optionals %w[ added_at episode ] end |
Instance Method Details
#to_custom_added_at ⇒ Object
66 67 68 |
# File 'lib/spotify_web_api/models/saved_episode_object.rb', line 66 def to_custom_added_at DateTimeHelper.to_rfc3339(added_at) end |