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
Constant Summary
Constants inherited from RayoNode
Instance Attribute Summary
Attributes inherited from RayoNode
#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name
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
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/punchblock/component/output.rb', line 26 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
124 125 126 |
# File 'lib/punchblock/component/output.rb', line 124 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.
43 44 45 |
# File 'lib/punchblock/component/output.rb', line 43 def interrupt_on read_attr :'interrupt-on', :to_sym end |
#interrupt_on=(other) ⇒ Object
50 51 52 |
# File 'lib/punchblock/component/output.rb', line 50 def interrupt_on=(other) write_attr :'interrupt-on', other end |
#max_time ⇒ String
Returns the TTS voice to use.
113 114 115 |
# File 'lib/punchblock/component/output.rb', line 113 def max_time read_attr :'max-time', :to_i end |
#max_time=(other) ⇒ Object
120 121 122 |
# File 'lib/punchblock/component/output.rb', line 120 def max_time=(other) write_attr :'max-time', other end |
#pause! ⇒ Object
Sends an Rayo pause message for the current Output
154 155 156 157 158 159 160 |
# File 'lib/punchblock/component/output.rb', line 154 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
147 148 149 |
# File 'lib/punchblock/component/output.rb', line 147 def pause_action Pause.new :component_id => component_id, :target_call_id => target_call_id end |
#repeat_interval ⇒ String
Returns the TTS voice to use.
85 86 87 |
# File 'lib/punchblock/component/output.rb', line 85 def repeat_interval read_attr :'repeat-interval', :to_i end |
#repeat_interval=(other) ⇒ Object
92 93 94 |
# File 'lib/punchblock/component/output.rb', line 92 def repeat_interval=(other) write_attr :'repeat-interval', other end |
#repeat_times ⇒ String
Returns the TTS voice to use.
99 100 101 |
# File 'lib/punchblock/component/output.rb', line 99 def repeat_times read_attr :'repeat-times', :to_i end |
#repeat_times=(other) ⇒ Object
106 107 108 |
# File 'lib/punchblock/component/output.rb', line 106 def repeat_times=(other) write_attr :'repeat-times', other end |
#resume! ⇒ Object
Sends an Rayo resume message for the current Output
179 180 181 182 183 184 185 |
# File 'lib/punchblock/component/output.rb', line 179 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
172 173 174 |
# File 'lib/punchblock/component/output.rb', line 172 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
214 215 216 217 218 219 |
# File 'lib/punchblock/component/output.rb', line 214 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
205 206 207 208 209 |
# File 'lib/punchblock/component/output.rb', line 205 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
305 306 307 308 309 310 |
# File 'lib/punchblock/component/output.rb', line 305 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
296 297 298 299 300 |
# File 'lib/punchblock/component/output.rb', line 296 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
279 280 281 282 283 284 |
# File 'lib/punchblock/component/output.rb', line 279 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
270 271 272 273 274 |
# File 'lib/punchblock/component/output.rb', line 270 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 |
#start_offset ⇒ String
Returns the TTS voice to use.
57 58 59 |
# File 'lib/punchblock/component/output.rb', line 57 def start_offset read_attr :'start-offset', :to_i end |
#start_offset=(other) ⇒ Object
64 65 66 |
# File 'lib/punchblock/component/output.rb', line 64 def start_offset=(other) write_attr :'start-offset', other end |
#start_paused ⇒ String
Returns the TTS voice to use.
71 72 73 |
# File 'lib/punchblock/component/output.rb', line 71 def start_paused read_attr(:'start-paused') == 'true' end |
#start_paused=(other) ⇒ Object
78 79 80 |
# File 'lib/punchblock/component/output.rb', line 78 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
399 400 401 402 403 404 |
# File 'lib/punchblock/component/output.rb', line 399 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
390 391 392 393 394 |
# File 'lib/punchblock/component/output.rb', line 390 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
373 374 375 376 377 378 |
# File 'lib/punchblock/component/output.rb', line 373 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
364 365 366 367 368 |
# File 'lib/punchblock/component/output.rb', line 364 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 |