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

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

Defined Under Namespace

Classes: ClearQueue, Play, Stop

Class Method Summary collapse

Class Method Details

.clear_queue(speech: nil, card: nil, behaviour: Ralyxa::ResponseEntities::Directives::AudioPlayer::ClearQueue::CLEAR_ALL, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::ClearQueue, response_builder: Ralyxa::ResponseBuilder) ⇒ Object



26
27
28
29
30
# File 'lib/ralyxa/response_entities/directives/audio_player.rb', line 26

def clear_queue(speech: nil, card: nil, behaviour: Ralyxa::ResponseEntities::Directives::AudioPlayer::ClearQueue::CLEAR_ALL, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::ClearQueue, response_builder: Ralyxa::ResponseBuilder)
  directive = audio_player_class.as_hash(behaviour)

  response_builder.build(build_options(directive, speech, card))
end

.play(url, token, speech: nil, card: nil, offset_in_milliseconds: 0, expected_previous_token: nil, behaviour: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play::REPLACE_ALL, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play, response_builder: Ralyxa::ResponseBuilder) ⇒ Object



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

def play(url, token, speech: nil, card: nil, offset_in_milliseconds: 0, expected_previous_token: nil, behaviour: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play::REPLACE_ALL, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play, response_builder: Ralyxa::ResponseBuilder)
  directive = audio_player_class.as_hash(Ralyxa::ResponseEntities::Directives::Audio::Stream.new(url, token, offset_in_milliseconds, expected_previous_token), behaviour)

  response_builder.build(build_options(directive, speech, card))
end

.play_later(url, token, speech: nil, card: nil, offset_in_milliseconds: 0, expected_previous_token: nil, behaviour: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play::REPLACE_ENQUEUED, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play, response_builder: Ralyxa::ResponseBuilder) ⇒ Object



16
17
18
# File 'lib/ralyxa/response_entities/directives/audio_player.rb', line 16

def play_later(url, token, speech: nil, card: nil, offset_in_milliseconds: 0, expected_previous_token: nil, behaviour: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play::REPLACE_ENQUEUED, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Play, response_builder: Ralyxa::ResponseBuilder)
  play(url, token, speech: speech, card: card, offset_in_milliseconds: offset_in_milliseconds, expected_previous_token: expected_previous_token, behaviour: behaviour, audio_player_class: audio_player_class, response_builder: response_builder)
end

.stop(speech: nil, card: nil, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Stop, response_builder: Ralyxa::ResponseBuilder) ⇒ Object



20
21
22
23
24
# File 'lib/ralyxa/response_entities/directives/audio_player.rb', line 20

def stop(speech: nil, card: nil, audio_player_class: Ralyxa::ResponseEntities::Directives::AudioPlayer::Stop, response_builder: Ralyxa::ResponseBuilder)
  directive = audio_player_class.as_hash

  response_builder.build(build_options(directive, speech, card))
end