Class: Adhearsion::Rayo::Component::Output
- Inherits:
-
ComponentNode
- Object
- RayoNode
- Adhearsion::Rayo::CommandNode
- ComponentNode
- Adhearsion::Rayo::Component::Output
- Includes:
- HasHeaders
- Defined in:
- lib/adhearsion/rayo/component/output.rb
Defined Under Namespace
Classes: Complete, Document, Pause, Resume, Seek, SlowDown, SpeedUp, VolumeDown, VolumeUp
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #connection, #original_component
Instance Method Summary collapse
- #inherit(xml_node) ⇒ Object
-
#interrupt_on ⇒ Symbol
Input type on which to interrupt output.
-
#max_time ⇒ Integer
Indicates the maximum amount of time for which the output should be allowed to run before being terminated.
-
#pause! ⇒ Object
Sends an Rayo pause message for the current Output.
-
#pause_action ⇒ Command::Output::Pause
Pauses a running Output.
- #rayo_attributes ⇒ Object
- #rayo_children(root) ⇒ Object
- #render_document=(other) ⇒ Object
-
#render_documents ⇒ Document
The document to render.
-
#renderer ⇒ String
The rendering engine requested by the component.
-
#repeat_interval ⇒ Integer
Indicates the duration of silence that should space repeats of the rendered document.
-
#repeat_times ⇒ Integer
Indicates the number of times the output should be played.
-
#resume! ⇒ Object
Sends an Rayo resume message for the current Output.
-
#resume_action ⇒ Command::Output::Resume
Create an Rayo resume message for the current Output.
-
#seek!(options = {}) ⇒ Object
Sends a Rayo seek message for the current Output.
-
#seek_action(options = {}) ⇒ Command::Output::Seek
Creates an Rayo seek message for the current Output.
-
#slow_down! ⇒ Object
Sends a Rayo slow down message for the current Output.
-
#slow_down_action ⇒ Command::Output::SlowDown
Creates an Rayo slow down message for the current Output.
-
#speed_up! ⇒ Object
Sends a Rayo speed up message for the current Output.
-
#speed_up_action ⇒ Command::Output::SpeedUp
Creates an Rayo speed up message for the current Output.
- #ssml=(other) ⇒ Object
-
#start_offset ⇒ Integer
Indicates some offset through which the output should be skipped before rendering begins.
-
#start_paused ⇒ true, false
Indicates wether or not the component should be started in a paused state to be resumed at a later time.
-
#voice ⇒ String
The TTS voice to use.
-
#volume_down! ⇒ Object
Sends a Rayo volume down message for the current Output.
-
#volume_down_action ⇒ Command::Output::VolumeDown
Creates an Rayo volume down message for the current Output.
-
#volume_up! ⇒ Object
Sends a Rayo volume up message for the current Output.
-
#volume_up_action ⇒ Command::Output::VolumeUp
Creates an Rayo volume up message for the current Output.
Methods included from HasHeaders
Methods inherited from ComponentNode
#add_event, #complete_event, #complete_event=, #initialize, #register_event_handler, #register_internal_handlers, #response=, #stop!, #stop_action, #trigger_event_handler, #write_action
Methods inherited from Adhearsion::Rayo::CommandNode
#initialize, #response, #response=
Methods inherited from RayoNode
#==, class_from_registration, from_xml, #inspect, register, #source, #to_rayo, #to_xml
Constructor Details
This class inherits a constructor from Adhearsion::Rayo::Component::ComponentNode
Instance Method Details
#inherit(xml_node) ⇒ Object
80 81 82 83 84 |
# File 'lib/adhearsion/rayo/component/output.rb', line 80 def inherit(xml_node) document_nodes = xml_node.xpath 'ns:document', ns: self.class.registered_ns self.render_documents = document_nodes.to_a.map { |node| Document.from_xml node } super end |
#interrupt_on ⇒ Symbol
Returns input type on which to interrupt output.
90 |
# File 'lib/adhearsion/rayo/component/output.rb', line 90 attribute :interrupt_on, Symbol |
#max_time ⇒ Integer
Returns Indicates the maximum amount of time for which the output should be allowed to run before being terminated. Includes repeats.
105 |
# File 'lib/adhearsion/rayo/component/output.rb', line 105 attribute :max_time, Integer |
#pause! ⇒ Object
Sends an Rayo pause message for the current Output
173 174 175 176 177 178 179 |
# File 'lib/adhearsion/rayo/component/output.rb', line 173 def pause! raise InvalidActionError, "Cannot pause a Output that is not executing" unless executing? pause_action.tap do |action| result = write_action action paused! if result end end |
#pause_action ⇒ Command::Output::Pause
Pauses a running Output
166 167 168 |
# File 'lib/adhearsion/rayo/component/output.rb', line 166 def pause_action Pause.new :component_id => component_id, :target_call_id => target_call_id end |
#rayo_attributes ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/adhearsion/rayo/component/output.rb', line 110 def rayo_attributes { 'voice' => voice, 'interrupt-on' => interrupt_on, 'start-offset' => start_offset, 'start-paused' => start_paused, 'repeat-interval' => repeat_interval, 'repeat-times' => repeat_times, 'max-time' => max_time, 'renderer' => renderer } end |
#rayo_children(root) ⇒ Object
123 124 125 126 127 128 |
# File 'lib/adhearsion/rayo/component/output.rb', line 123 def rayo_children(root) render_documents.each do |render_document| render_document.to_rayo root.parent end super end |
#render_document=(other) ⇒ Object
139 140 141 |
# File 'lib/adhearsion/rayo/component/output.rb', line 139 def render_document=(other) self.render_documents = [other].compact end |
#render_documents ⇒ Document
Returns the document to render.
131 |
# File 'lib/adhearsion/rayo/component/output.rb', line 131 attribute :render_documents, Array[Document], default: [] |
#renderer ⇒ String
Returns the rendering engine requested by the component.
108 |
# File 'lib/adhearsion/rayo/component/output.rb', line 108 attribute :renderer, String |
#repeat_interval ⇒ Integer
Returns Indicates the duration of silence that should space repeats of the rendered document.
99 |
# File 'lib/adhearsion/rayo/component/output.rb', line 99 attribute :repeat_interval, Integer |
#repeat_times ⇒ Integer
Returns Indicates the number of times the output should be played.
102 |
# File 'lib/adhearsion/rayo/component/output.rb', line 102 attribute :repeat_times, Integer |
#resume! ⇒ Object
Sends an Rayo resume message for the current Output
198 199 200 201 202 203 204 |
# File 'lib/adhearsion/rayo/component/output.rb', line 198 def resume! raise InvalidActionError, "Cannot resume a Output that is not paused." unless paused? resume_action.tap do |action| result = write_action action resumed! if result end end |
#resume_action ⇒ Command::Output::Resume
Create an Rayo resume message for the current Output
191 192 193 |
# File 'lib/adhearsion/rayo/component/output.rb', line 191 def resume_action Resume.new :component_id => component_id, :target_call_id => target_call_id end |
#seek!(options = {}) ⇒ Object
Sends a Rayo seek message for the current Output
233 234 235 236 237 238 |
# File 'lib/adhearsion/rayo/component/output.rb', line 233 def seek!( = {}) raise InvalidActionError, "Cannot seek an Output that is already seeking." if seeking? seek_action().tap do |action| write_action action end end |
#seek_action(options = {}) ⇒ Command::Output::Seek
Creates an Rayo seek message for the current Output
224 225 226 227 228 |
# File 'lib/adhearsion/rayo/component/output.rb', line 224 def seek_action( = {}) Seek.new({ :component_id => component_id, :target_call_id => target_call_id }.merge()).tap do |s| s.original_component = self end end |
#slow_down! ⇒ Object
Sends a Rayo slow down message for the current Output
316 317 318 319 320 321 |
# File 'lib/adhearsion/rayo/component/output.rb', line 316 def slow_down! raise InvalidActionError, "Cannot slow down an Output that is already speeding." unless not_speeding? slow_down_action.tap do |action| write_action action end end |
#slow_down_action ⇒ Command::Output::SlowDown
Creates an Rayo slow down message for the current Output
307 308 309 310 311 |
# File 'lib/adhearsion/rayo/component/output.rb', line 307 def slow_down_action SlowDown.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s| s.original_component = self end end |
#speed_up! ⇒ Object
Sends a Rayo speed up message for the current Output
290 291 292 293 294 295 |
# File 'lib/adhearsion/rayo/component/output.rb', line 290 def speed_up! raise InvalidActionError, "Cannot speed up an Output that is already speeding." unless not_speeding? speed_up_action.tap do |action| write_action action end end |
#speed_up_action ⇒ Command::Output::SpeedUp
Creates an Rayo speed up message for the current Output
281 282 283 284 285 |
# File 'lib/adhearsion/rayo/component/output.rb', line 281 def speed_up_action SpeedUp.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s| s.original_component = self end end |
#ssml=(other) ⇒ Object
143 144 145 |
# File 'lib/adhearsion/rayo/component/output.rb', line 143 def ssml=(other) self.render_documents = [{:value => other}] end |
#start_offset ⇒ Integer
Returns Indicates some offset through which the output should be skipped before rendering begins.
93 |
# File 'lib/adhearsion/rayo/component/output.rb', line 93 attribute :start_offset, Integer |
#start_paused ⇒ true, false
Returns Indicates wether or not the component should be started in a paused state to be resumed at a later time.
96 |
# File 'lib/adhearsion/rayo/component/output.rb', line 96 attribute :start_paused, Boolean |
#voice ⇒ String
Returns the TTS voice to use.
87 |
# File 'lib/adhearsion/rayo/component/output.rb', line 87 attribute :voice, String |
#volume_down! ⇒ Object
Sends a Rayo volume down message for the current Output
410 411 412 413 414 415 |
# File 'lib/adhearsion/rayo/component/output.rb', line 410 def volume_down! raise InvalidActionError, "Cannot volume down an Output that is already voluming." unless not_voluming? volume_down_action.tap do |action| write_action action end end |
#volume_down_action ⇒ Command::Output::VolumeDown
Creates an Rayo volume down message for the current Output
401 402 403 404 405 |
# File 'lib/adhearsion/rayo/component/output.rb', line 401 def volume_down_action VolumeDown.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s| s.original_component = self end end |
#volume_up! ⇒ Object
Sends a Rayo volume up message for the current Output
384 385 386 387 388 389 |
# File 'lib/adhearsion/rayo/component/output.rb', line 384 def volume_up! raise InvalidActionError, "Cannot volume up an Output that is already voluming." unless not_voluming? volume_up_action.tap do |action| write_action action end end |
#volume_up_action ⇒ Command::Output::VolumeUp
Creates an Rayo volume up message for the current Output
375 376 377 378 379 |
# File 'lib/adhearsion/rayo/component/output.rb', line 375 def volume_up_action VolumeUp.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s| s.original_component = self end end |