Class: Punchblock::Component::Tropo::Say
- Inherits:
-
ComponentNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Tropo::Say
- Includes:
- MediaContainer
- Defined in:
- lib/punchblock/component/tropo/say.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Complete, Pause, Resume
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::Say
Creates an Rayo Say command.
Instance Method Summary collapse
-
#pause! ⇒ Object
Sends an Rayo pause message for the current Say.
-
#pause_action ⇒ Command::Say::Pause
Pauses a running Say.
-
#resume! ⇒ Object
Sends an Rayo resume message for the current Say.
-
#resume_action ⇒ Command::Say::Resume
Create an Rayo resume message for the current Say.
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::Say
Creates an Rayo Say command
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/punchblock/component/tropo/say.rb', line 25 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] when Nokogiri::XML::Element new_node.inherit end end end |
Instance Method Details
#pause! ⇒ Object
Sends an Rayo pause message for the current Say
64 65 66 67 68 69 70 |
# File 'lib/punchblock/component/tropo/say.rb', line 64 def pause! raise InvalidActionError, "Cannot pause a Say that is not executing" unless executing? pause_action.tap do |action| result = write_action action paused! if result end end |
#pause_action ⇒ Command::Say::Pause
Pauses a running Say
57 58 59 |
# File 'lib/punchblock/component/tropo/say.rb', line 57 def pause_action Pause.new :component_id => component_id, :call_id => call_id end |
#resume! ⇒ Object
Sends an Rayo resume message for the current Say
89 90 91 92 93 94 95 |
# File 'lib/punchblock/component/tropo/say.rb', line 89 def resume! raise InvalidActionError, "Cannot resume a Say that is not paused." unless paused? resume_action.tap do |action| result = write_action action resumed! if result end end |