Class: Drum::AlbumSpotify
Overview
Spotify-specific metadata about the album.
Instance Attribute Summary collapse
-
#id ⇒ String
The id of the album on Spotify.
-
#image_url ⇒ String
The URL of the album cover art on Spotify.
Class Method Summary collapse
-
.deserialize(h) ⇒ AlbumSpotify
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
#id ⇒ String
Returns The id of the album on Spotify.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/drum/model/album.rb', line 60 AlbumSpotify = Struct.new( :id, :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 [AlbumSpotify] The parsed metadata def self.deserialize(h) AlbumSpotify.new( id: h['id'], 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, 'image_url' => self.image_url }.compact end end |
#image_url ⇒ String
Returns The URL of the album cover art on Spotify.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/drum/model/album.rb', line 60 AlbumSpotify = Struct.new( :id, :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 [AlbumSpotify] The parsed metadata def self.deserialize(h) AlbumSpotify.new( id: h['id'], 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, 'image_url' => self.image_url }.compact end end |
Class Method Details
.deserialize(h) ⇒ AlbumSpotify
Parses spotify metadata from a Hash that uses string keys.
69 70 71 72 73 74 |
# File 'lib/drum/model/album.rb', line 69 def self.deserialize(h) AlbumSpotify.new( id: h['id'], image_url: h['image_url'] ) end |