Class: Drum::ArtistSpotify
Overview
Spotify-specific metadata about the artist.
Instance Attribute Summary collapse
-
#id ⇒ String
The id of the artist on Spotify.
-
#image_url ⇒ optional, String
An image of the artist.
Class Method Summary collapse
-
.deserialize(h) ⇒ ArtistSpotify
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 artist on Spotify.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/drum/model/artist.rb', line 46 ArtistSpotify = 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 [ArtistSpotify] The parsed metadata def self.deserialize(h) ArtistSpotify.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 ⇒ optional, String
Returns An image of the artist.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/drum/model/artist.rb', line 46 ArtistSpotify = 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 [ArtistSpotify] The parsed metadata def self.deserialize(h) ArtistSpotify.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) ⇒ ArtistSpotify
Parses spotify metadata from a Hash that uses string keys.
55 56 57 58 59 60 |
# File 'lib/drum/model/artist.rb', line 55 def self.deserialize(h) ArtistSpotify.new( id: h['id'], image_url: h['image_url'] ) end |