Class: Drum::AlbumAppleMusic
Overview
Apple Music-specific metadata about the album.
Instance Attribute Summary collapse
-
#image_url ⇒ optional, String
The cover image of the album.
Class Method Summary collapse
-
.deserialize(h) ⇒ AlbumAppleMusic
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
#image_url ⇒ optional, String
Returns The cover image of the album.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/drum/model/album.rb', line 91 AlbumAppleMusic = Struct.new( :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 [AlbumAppleMusic] The parsed metadata def self.deserialize(h) AlbumAppleMusic.new( 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 { 'image_url' => self.image_url }.compact end end |
Class Method Details
.deserialize(h) ⇒ AlbumAppleMusic
Parses Apple Music metadata from a Hash that uses string keys.
99 100 101 102 103 |
# File 'lib/drum/model/album.rb', line 99 def self.deserialize(h) AlbumAppleMusic.new( image_url: h['image_url'] ) end |