Class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play

Inherits:
Object
  • Object
show all
Defined in:
lib/ralyxa/response_entities/directives/audio_player/play.rb

Constant Summary collapse

CLEAR_ENQUEUE =
'CLEAR_ENQUEUE'.freeze
ENQUEUE =
'ENQUEUE'.freeze
REPLACE_ALL =
'REPLACE_ALL'.freeze
REPLACE_ENQUEUED =
'REPLACE_ENQUEUED'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream, behaviour = Ralyxa::ResponseEntities::Directives::AudioPlayer::Play::REPLACE_ALL) ⇒ Play

Returns a new instance of Play.



11
12
13
14
# File 'lib/ralyxa/response_entities/directives/audio_player/play.rb', line 11

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

Class Method Details

.as_hash(stream, behaviour = nil) ⇒ Object



25
26
27
# File 'lib/ralyxa/response_entities/directives/audio_player/play.rb', line 25

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

Instance Method Details

#to_hObject



16
17
18
19
20
21
22
23
# File 'lib/ralyxa/response_entities/directives/audio_player/play.rb', line 16

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