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 ComponentNode
Attributes inherited from RayoNode
#call_id, #client, #component_id, #connection, #original_component
Class Method Summary collapse
-
.new(options = {}) ⇒ Command::Output
Creates an Rayo Output command.
Instance Method Summary collapse
-
#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
#inspect_attributes, #ssml, #ssml=, #voice, #voice=
Methods inherited from ComponentNode
#add_event, #initialize, #register_event_handler, #register_initial_handlers, #response=, #stop!, #stop_action, #write_action
Methods inherited from Punchblock::CommandNode
#initialize, #response, #response=, #write_attr
Methods inherited from RayoNode
class_from_registration, #eql?, import, #inspect, #inspect_attributes, 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
#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
148 149 150 151 152 153 154 |
# File 'lib/punchblock/component/output.rb', line 148 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
141 142 143 |
# File 'lib/punchblock/component/output.rb', line 141 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
173 174 175 176 177 178 179 |
# File 'lib/punchblock/component/output.rb', line 173 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
166 167 168 |
# File 'lib/punchblock/component/output.rb', line 166 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
208 209 210 211 212 213 |
# File 'lib/punchblock/component/output.rb', line 208 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
199 200 201 202 203 |
# File 'lib/punchblock/component/output.rb', line 199 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
299 300 301 302 303 304 |
# File 'lib/punchblock/component/output.rb', line 299 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
290 291 292 293 294 |
# File 'lib/punchblock/component/output.rb', line 290 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
273 274 275 276 277 278 |
# File 'lib/punchblock/component/output.rb', line 273 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
264 265 266 267 268 |
# File 'lib/punchblock/component/output.rb', line 264 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
393 394 395 396 397 398 |
# File 'lib/punchblock/component/output.rb', line 393 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
384 385 386 387 388 |
# File 'lib/punchblock/component/output.rb', line 384 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
367 368 369 370 371 372 |
# File 'lib/punchblock/component/output.rb', line 367 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
358 359 360 361 362 |
# File 'lib/punchblock/component/output.rb', line 358 def volume_up_action VolumeUp.new(:component_id => component_id, :call_id => call_id).tap do |s| s.original_component = self end end |