Class: Drum::PlaylistSpotify
- Defined in:
- lib/drum/model/playlist.rb
Overview
Spotify-specific metadata about the playlist.
Instance Attribute Summary collapse
-
#collaborative ⇒ optional, Boolean
Whether the playlist is collaborative on Spotify.
-
#id ⇒ String
The id of the playlist on Spotify.
-
#image_url ⇒ optional, String
The playlist cover URL.
-
#public ⇒ optional, Boolean
Whether the playlist is public on Spotify.
Class Method Summary collapse
-
.deserialize(h) ⇒ PlaylistSpotify
Parses spotify metadata from a Hash that uses string keys.
Instance Method Summary collapse
-
#serialize ⇒ Hash<String, Object>
Serializes the metadata to a Hash that uses string keys.
Instance Attribute Details
#collaborative ⇒ optional, Boolean
Returns Whether the playlist is collaborative on Spotify.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/drum/model/playlist.rb', line 144 PlaylistSpotify = Struct.new( :id, :public, :collaborative, :image_url, keyword_init: true ) do # Parses spotify metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistSpotify] The parsed metadata def self.deserialize(h) PlaylistSpotify.new( id: h['id'], public: h['public'], collaborative: h['collaborative'], image_url: h['image_url'] ) end # Serializes the metadata to a Hash that uses string keys. # # @return [Hash<String, Object>] The serialized representation def serialize { 'id' => self.id, 'public' => self.public, 'collaborative' => self.collaborative, 'image_url' => self.image_url }.compact end end |
#id ⇒ String
Returns The id of the playlist on Spotify.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/drum/model/playlist.rb', line 144 PlaylistSpotify = Struct.new( :id, :public, :collaborative, :image_url, keyword_init: true ) do # Parses spotify metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistSpotify] The parsed metadata def self.deserialize(h) PlaylistSpotify.new( id: h['id'], public: h['public'], collaborative: h['collaborative'], image_url: h['image_url'] ) end # Serializes the metadata to a Hash that uses string keys. # # @return [Hash<String, Object>] The serialized representation def serialize { 'id' => self.id, 'public' => self.public, 'collaborative' => self.collaborative, 'image_url' => self.image_url }.compact end end |
#image_url ⇒ optional, String
Returns The playlist cover URL.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/drum/model/playlist.rb', line 144 PlaylistSpotify = Struct.new( :id, :public, :collaborative, :image_url, keyword_init: true ) do # Parses spotify metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistSpotify] The parsed metadata def self.deserialize(h) PlaylistSpotify.new( id: h['id'], public: h['public'], collaborative: h['collaborative'], image_url: h['image_url'] ) end # Serializes the metadata to a Hash that uses string keys. # # @return [Hash<String, Object>] The serialized representation def serialize { 'id' => self.id, 'public' => self.public, 'collaborative' => self.collaborative, 'image_url' => self.image_url }.compact end end |
#public ⇒ optional, Boolean
Returns Whether the playlist is public on Spotify.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/drum/model/playlist.rb', line 144 PlaylistSpotify = Struct.new( :id, :public, :collaborative, :image_url, keyword_init: true ) do # Parses spotify metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistSpotify] The parsed metadata def self.deserialize(h) PlaylistSpotify.new( id: h['id'], public: h['public'], collaborative: h['collaborative'], image_url: h['image_url'] ) end # Serializes the metadata to a Hash that uses string keys. # # @return [Hash<String, Object>] The serialized representation def serialize { 'id' => self.id, 'public' => self.public, 'collaborative' => self.collaborative, 'image_url' => self.image_url }.compact end end |
Class Method Details
.deserialize(h) ⇒ PlaylistSpotify
Parses spotify metadata from a Hash that uses string keys.
154 155 156 157 158 159 160 161 |
# File 'lib/drum/model/playlist.rb', line 154 def self.deserialize(h) PlaylistSpotify.new( id: h['id'], public: h['public'], collaborative: h['collaborative'], image_url: h['image_url'] ) end |
Instance Method Details
#serialize ⇒ Hash<String, Object>
Serializes the metadata to a Hash that uses string keys.
166 167 168 169 170 171 172 173 |
# File 'lib/drum/model/playlist.rb', line 166 def serialize { 'id' => self.id, 'public' => self.public, 'collaborative' => self.collaborative, 'image_url' => self.image_url }.compact end |