Class: Drum::TrackAppleMusic
Overview
Apple Music-specific metadata about the track.
Instance Attribute Summary collapse
-
#catalog_id ⇒ optional, String
The global catalog id of the track.
-
#library_id ⇒ optional, String
The library-internal id of the track.
-
#preview_url ⇒ optional, String
A short preview of the song audio.
Class Method Summary collapse
-
.deserialize(h) ⇒ TrackAppleMusic
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
#catalog_id ⇒ optional, String
Returns The global catalog id of the track.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/drum/model/track.rb', line 129 TrackAppleMusic = Struct.new( :library_id, :catalog_id, :preview_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 [TrackAppleMusic] The parsed metadata def self.deserialize(h) TrackAppleMusic.new( library_id: h['library_id'], catalog_id: h['catalog_id'], preview_url: h['preview_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, 'catalog_id' => self.catalog_id, 'preview_url' => self.preview_url }.compact end end |
#library_id ⇒ optional, String
Returns The library-internal id of the track.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/drum/model/track.rb', line 129 TrackAppleMusic = Struct.new( :library_id, :catalog_id, :preview_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 [TrackAppleMusic] The parsed metadata def self.deserialize(h) TrackAppleMusic.new( library_id: h['library_id'], catalog_id: h['catalog_id'], preview_url: h['preview_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, 'catalog_id' => self.catalog_id, 'preview_url' => self.preview_url }.compact end end |
#preview_url ⇒ optional, String
Returns A short preview of the song audio.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/drum/model/track.rb', line 129 TrackAppleMusic = Struct.new( :library_id, :catalog_id, :preview_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 [TrackAppleMusic] The parsed metadata def self.deserialize(h) TrackAppleMusic.new( library_id: h['library_id'], catalog_id: h['catalog_id'], preview_url: h['preview_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, 'catalog_id' => self.catalog_id, 'preview_url' => self.preview_url }.compact end end |
Class Method Details
.deserialize(h) ⇒ TrackAppleMusic
Parses Apple Music metadata from a Hash that uses string keys.
138 139 140 141 142 143 144 |
# File 'lib/drum/model/track.rb', line 138 def self.deserialize(h) TrackAppleMusic.new( library_id: h['library_id'], catalog_id: h['catalog_id'], preview_url: h['preview_url'] ) end |