Class: Punchblock::Component::Output
- Inherits:
-
ComponentNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Output
- Includes:
- MediaContainer
- Defined in:
- lib/punchblock/component/output.rb
Defined Under Namespace
Classes: Complete, Pause, Resume, Seek, SlowDown, SpeedUp, VolumeDown, VolumeUp
Instance Attribute Summary
Attributes inherited from RayoNode
#call_id, #client, #component_id, #connection, #domain, #mixer_name, #original_component
Class Method Summary collapse
-
.new(options = {}) ⇒ Command::Output
Creates an Rayo Output command.
Instance Method Summary collapse
- #inspect_attributes ⇒ Object
-
#interrupt_on ⇒ String
The TTS voice to use.
- #interrupt_on=(other) ⇒ Object
-
#max_time ⇒ String
The TTS voice to use.
- #max_time=(other) ⇒ Object
-
#pause! ⇒ Object
Sends an Rayo pause message for the current Output.
-
#pause_action ⇒ Command::Output::Pause
Pauses a running Output.
-
#repeat_interval ⇒ String
The TTS voice to use.
- #repeat_interval=(other) ⇒ Object
-
#repeat_times ⇒ String
The TTS voice to use.
- #repeat_times=(other) ⇒ Object
-
#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.
-
#start_offset ⇒ String
The TTS voice to use.
- #start_offset=(other) ⇒ Object
-
#start_paused ⇒ String
The TTS voice to use.
- #start_paused=(other) ⇒ Object
-
#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 MediaContainer
#ssml, #ssml=, #voice, #voice=
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 Punchblock::CommandNode
#initialize, #response, #response=, #write_attr
Methods inherited from RayoNode
class_from_registration, #eql?, import, #inspect, register, #source
Constructor Details
This class inherits a constructor from Punchblock::Component::ComponentNode
Class Method Details
.new(options = {}) ⇒ Command::Output
Creates an Rayo Output command
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/punchblock/component/output.rb', line 24 def self.new( = {}) super().tap do |new_node| case when Hash new_node.voice = .delete(:voice) if [:voice] new_node.ssml = .delete(:ssml) if [:ssml] new_node << .delete(:text) if [:text] .each_pair { |k,v| new_node.send :"#{k}=", v } when Nokogiri::XML::Element new_node.inherit end end end |
Instance Method Details
#inspect_attributes ⇒ Object
122 123 124 |
# File 'lib/punchblock/component/output.rb', line 122 def inspect_attributes super + [:interrupt_on, :start_offset, :start_paused, :repeat_interval, :repeat_times, :max_time] end |
#interrupt_on ⇒ String
Returns the TTS voice to use.
41 42 43 |
# File 'lib/punchblock/component/output.rb', line 41 def interrupt_on read_attr :'interrupt-on', :to_sym end |
#interrupt_on=(other) ⇒ Object
48 49 50 |
# File 'lib/punchblock/component/output.rb', line 48 def interrupt_on=(other) write_attr :'interrupt-on', other end |
#max_time ⇒ String
Returns the TTS voice to use.
111 112 113 |
# File 'lib/punchblock/component/output.rb', line 111 def max_time read_attr :'max-time', :to_i end |
#max_time=(other) ⇒ Object
118 119 120 |
# File 'lib/punchblock/component/output.rb', line 118 def max_time=(other) write_attr :'max-time', other end |
#pause! ⇒ Object
Sends an Rayo pause message for the current Output
152 153 154 155 156 157 158 |
# File 'lib/punchblock/component/output.rb', line 152 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
145 146 147 |
# File 'lib/punchblock/component/output.rb', line 145 def pause_action Pause.new :component_id => component_id, :call_id => call_id end |
#repeat_interval ⇒ String
Returns the TTS voice to use.
83 84 85 |
# File 'lib/punchblock/component/output.rb', line 83 def repeat_interval read_attr :'repeat-interval', :to_i end |
#repeat_interval=(other) ⇒ Object
90 91 92 |
# File 'lib/punchblock/component/output.rb', line 90 def repeat_interval=(other) write_attr :'repeat-interval', other end |
#repeat_times ⇒ String
Returns the TTS voice to use.
97 98 99 |
# File 'lib/punchblock/component/output.rb', line 97 def repeat_times read_attr :'repeat-times', :to_i end |
#repeat_times=(other) ⇒ Object
104 105 106 |
# File 'lib/punchblock/component/output.rb', line 104 def repeat_times=(other) write_attr :'repeat-times', other end |
#resume! ⇒ Object
Sends an Rayo resume message for the current Output
177 178 179 180 181 182 183 |
# File 'lib/punchblock/component/output.rb', line 177 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
170 171 172 |
# File 'lib/punchblock/component/output.rb', line 170 def resume_action Resume.new :component_id => component_id, :call_id => call_id end |
#seek!(options = {}) ⇒ Object
Sends a Rayo seek message for the current Output
212 213 214 215 216 217 |
# File 'lib/punchblock/component/output.rb', line 212 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
203 204 205 206 207 |
# File 'lib/punchblock/component/output.rb', line 203 def seek_action( = {}) Seek.new({ :component_id => component_id, :call_id => 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
303 304 305 306 307 308 |
# File 'lib/punchblock/component/output.rb', line 303 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
294 295 296 297 298 |
# File 'lib/punchblock/component/output.rb', line 294 def slow_down_action SlowDown.new(:component_id => component_id, :call_id => call_id).tap do |s| s.original_component = self end end |
#speed_up! ⇒ Object
Sends a Rayo speed up message for the current Output
277 278 279 280 281 282 |
# File 'lib/punchblock/component/output.rb', line 277 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
268 269 270 271 272 |
# File 'lib/punchblock/component/output.rb', line 268 def speed_up_action SpeedUp.new(:component_id => component_id, :call_id => call_id).tap do |s| s.original_component = self end end |
#start_offset ⇒ String
Returns the TTS voice to use.
55 56 57 |
# File 'lib/punchblock/component/output.rb', line 55 def start_offset read_attr :'start-offset', :to_i end |
#start_offset=(other) ⇒ Object
62 63 64 |
# File 'lib/punchblock/component/output.rb', line 62 def start_offset=(other) write_attr :'start-offset', other end |
#start_paused ⇒ String
Returns the TTS voice to use.
69 70 71 |
# File 'lib/punchblock/component/output.rb', line 69 def start_paused read_attr(:'start-paused') == 'true' end |
#start_paused=(other) ⇒ Object
76 77 78 |
# File 'lib/punchblock/component/output.rb', line 76 def start_paused=(other) write_attr :'start-paused', other.to_s end |
#volume_down! ⇒ Object
Sends a Rayo volume down message for the current Output
397 398 399 400 401 402 |
# File 'lib/punchblock/component/output.rb', line 397 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
388 389 390 391 392 |
# File 'lib/punchblock/component/output.rb', line 388 def volume_down_action VolumeDown.new(:component_id => component_id, :call_id => call_id).tap do |s| s.original_component = self end end |
#volume_up! ⇒ Object
Sends a Rayo volume up message for the current Output
371 372 373 374 375 376 |
# File 'lib/punchblock/component/output.rb', line 371 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
362 363 364 365 366 |
# File 'lib/punchblock/component/output.rb', line 362 def volume_up_action VolumeUp.new(:component_id => component_id, :call_id => call_id).tap do |s| s.original_component = self end end |