Sha256: 30aa1e13c30e0917e82146a8d5297b2e668c639298bbd59dab1d33b2158e67e5

Contents?: true

Size: 622 Bytes

Versions: 5

Compression:

Stored size: 622 Bytes

Contents

require 'poms/fields'

module Poms
  module Builderless
    # A single broadcast (episode) fetched from Poms
    class Broadcast
      def initialize(hash)
        @hash = hash
      end

      def title
        Fields.title(@hash)
      end

      def mid
        @hash['mid']
      end

      def schedule_events
        @hash['scheduleEvents'].map do |event|
          Event.new(event)
        end
      end
    end

    # A single event of a broadcast.
    class Event
      def initialize(hash)
        @hash = hash
      end

      def starts_at
        Timestamp.convert(@hash['start'])
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
poms-1.2.2 lib/poms/builderless/broadcast.rb
poms-1.2.1 lib/poms/builderless/broadcast.rb
poms-1.2.0 lib/poms/builderless/broadcast.rb
poms-1.1.0 lib/poms/builderless/broadcast.rb
poms-1.0.1 lib/poms/builderless/broadcast.rb