Class: Drum::PlaylistAppleMusic
- Defined in:
- lib/drum/model/playlist.rb
Overview
Apple Music-specific metadata about the playlist.
Instance Attribute Summary collapse
-
#editable ⇒ optional, Boolean
Whether the playlist is editable.
-
#global_id ⇒ optional, String
The global id of the playlist (implies that it is available through the catalog API).
-
#image_url ⇒ optional, String
The playlist cover image, if present.
-
#library_id ⇒ optional, String
The library-internal id of the playlist.
-
#public ⇒ optional, Boolean
Whether the playlist is public.
Class Method Summary collapse
-
.deserialize(h) ⇒ PlaylistAppleMusic
Parses Apple Music 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
#editable ⇒ optional, Boolean
Returns Whether the playlist is editable.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/drum/model/playlist.rb', line 190 PlaylistAppleMusic = Struct.new( :library_id, :global_id, :public, :editable, :image_url, keyword_init: true ) do # Parses Apple Music metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistAppleMusic] The parsed metadata def self.deserialize(h) PlaylistAppleMusic.new( library_id: h['library_id'], global_id: h['global_id'], public: h['public'], editable: h['editable'], 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 { 'library_id' => self.library_id, 'global_id' => self.global_id, 'public' => self.public, 'editable' => self.editable, 'image_url' => self.image_url }.compact end end |
#global_id ⇒ optional, String
Returns The global id of the playlist (implies that it is available through the catalog API).
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/drum/model/playlist.rb', line 190 PlaylistAppleMusic = Struct.new( :library_id, :global_id, :public, :editable, :image_url, keyword_init: true ) do # Parses Apple Music metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistAppleMusic] The parsed metadata def self.deserialize(h) PlaylistAppleMusic.new( library_id: h['library_id'], global_id: h['global_id'], public: h['public'], editable: h['editable'], 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 { 'library_id' => self.library_id, 'global_id' => self.global_id, 'public' => self.public, 'editable' => self.editable, 'image_url' => self.image_url }.compact end end |
#image_url ⇒ optional, String
Returns The playlist cover image, if present.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/drum/model/playlist.rb', line 190 PlaylistAppleMusic = Struct.new( :library_id, :global_id, :public, :editable, :image_url, keyword_init: true ) do # Parses Apple Music metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistAppleMusic] The parsed metadata def self.deserialize(h) PlaylistAppleMusic.new( library_id: h['library_id'], global_id: h['global_id'], public: h['public'], editable: h['editable'], 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 { 'library_id' => self.library_id, 'global_id' => self.global_id, 'public' => self.public, 'editable' => self.editable, 'image_url' => self.image_url }.compact end end |
#library_id ⇒ optional, String
Returns The library-internal id of the playlist.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/drum/model/playlist.rb', line 190 PlaylistAppleMusic = Struct.new( :library_id, :global_id, :public, :editable, :image_url, keyword_init: true ) do # Parses Apple Music metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistAppleMusic] The parsed metadata def self.deserialize(h) PlaylistAppleMusic.new( library_id: h['library_id'], global_id: h['global_id'], public: h['public'], editable: h['editable'], 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 { 'library_id' => self.library_id, 'global_id' => self.global_id, 'public' => self.public, 'editable' => self.editable, 'image_url' => self.image_url }.compact end end |
#public ⇒ optional, Boolean
Returns Whether the playlist is public.
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/drum/model/playlist.rb', line 190 PlaylistAppleMusic = Struct.new( :library_id, :global_id, :public, :editable, :image_url, keyword_init: true ) do # Parses Apple Music metadata from a Hash that uses string keys. # # @param [Hash<String, Object>] h The Hash to be parsed # @return [PlaylistAppleMusic] The parsed metadata def self.deserialize(h) PlaylistAppleMusic.new( library_id: h['library_id'], global_id: h['global_id'], public: h['public'], editable: h['editable'], 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 { 'library_id' => self.library_id, 'global_id' => self.global_id, 'public' => self.public, 'editable' => self.editable, 'image_url' => self.image_url }.compact end end |
Class Method Details
.deserialize(h) ⇒ PlaylistAppleMusic
Parses Apple Music metadata from a Hash that uses string keys.
199 200 201 202 203 204 205 206 207 |
# File 'lib/drum/model/playlist.rb', line 199 def self.deserialize(h) PlaylistAppleMusic.new( library_id: h['library_id'], global_id: h['global_id'], public: h['public'], editable: h['editable'], image_url: h['image_url'] ) end |
Instance Method Details
#serialize ⇒ Hash<String, Object>
Serializes the metadata to a Hash that uses string keys.
212 213 214 215 216 217 218 219 220 |
# File 'lib/drum/model/playlist.rb', line 212 def serialize { 'library_id' => self.library_id, 'global_id' => self.global_id, 'public' => self.public, 'editable' => self.editable, 'image_url' => self.image_url }.compact end |