Sha256: 63b36d4999c60fd47be1499fcd4d1cf31b382fa0a6fdada39e1c4738c8d24c13

Contents?: true

Size: 967 Bytes

Versions: 4

Compression:

Stored size: 967 Bytes

Contents

module Ralyxa
  module ResponseEntities
    module Directives
      class AudioPlayer
        class Play
          CLEAR_ENQUEUE    = 'CLEAR_ENQUEUE'.freeze
          ENQUEUE          = 'ENQUEUE'.freeze
          REPLACE_ALL      = 'REPLACE_ALL'.freeze
          REPLACE_ENQUEUED = 'REPLACE_ENQUEUED'.freeze

          def initialize(stream, behaviour = Ralyxa::ResponseEntities::Directives::AudioPlayer::Play::REPLACE_ALL)
            @stream    = stream
            @behaviour = behaviour
          end

          def to_h
            {}.tap do |audio_player|
              audio_player['type'] = 'AudioPlayer.Play'
              audio_player['playBehavior'] = @behaviour

              audio_player['audioItem'] = Ralyxa::ResponseEntities::Directives::Audio::AudioItem.new(@stream).to_h
            end
          end

          def self.as_hash(stream, behaviour = nil)
            new(stream, behaviour).to_h
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ralyxa-lambda-1.9.0 lib/ralyxa/response_entities/directives/audio_player/play.rb
ralyxa-lambda-1.8.0 lib/ralyxa/response_entities/directives/audio_player/play.rb
ralyxa-1.8.0 lib/ralyxa/response_entities/directives/audio_player/play.rb
ralyxa-1.7.0 lib/ralyxa/response_entities/directives/audio_player/play.rb