Sha256: 4627254ef0b280b90e6ea96e2a9d5aeceff120765ab926ce62443a9d6448b674

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

module AppleMusic
  class Station < Resource
    # https://developer.apple.com/documentation/applemusicapi/station/attributes
    class Attributes
      attr_reader :artwork, :duration_in_millis, :editorial_notes,
                  :episode_number, :is_live, :name, :url

      def initialize(props = {})
        @artwork = Artwork.new(props['artwork']) # required
        @duration_in_millis = props['durationInMillis']
        @editorial_notes = EditorialNotes.new(props['editorialNotes']) if props['editorialNotes']
        @episode_number = props['episodeNumber']
        @is_live = props['isLive'] # required
        @name = props['name'] # required
        @url = props['url'] # required
      end

      def live?
        is_live
      end
    end

    self.attributes_model = self::Attributes
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apple_music-0.3.1 lib/apple_music/station/attributes.rb
apple_music-0.3.0 lib/apple_music/station/attributes.rb
apple_music-0.2.0 lib/apple_music/station/attributes.rb