Class: Punchblock::Component::Record
- Inherits:
-
ComponentNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Record
- Defined in:
- lib/punchblock/component/record.rb
Defined Under Namespace
Classes: Complete, Pause, Recording, Resume
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::Record
Creates an Rayo Record command.
Instance Method Summary collapse
-
#final_timeout ⇒ Integer
Controls the length of a period of silence after callers have spoken to conclude they finished.
- #final_timeout=(timeout) ⇒ Object
-
#format ⇒ String
The codec to use for recording.
- #format=(format) ⇒ Object
-
#initial_timeout ⇒ Integer
Controls how long the recognizer should wait after the end of the prompt for the caller to speak before sending a Recorder event.
- #initial_timeout=(timeout) ⇒ Object
-
#inspect_attributes ⇒ Object
:nodoc:.
-
#max_duration ⇒ Integer
Indicates the maximum duration for the recording.
- #max_duration=(other) ⇒ Object
-
#pause! ⇒ Object
Sends an Rayo pause message for the current Record.
-
#pause_action ⇒ Command::Record::Pause
Pauses a running Record.
-
#recording ⇒ Punchblock::Component::Record::Recording
Directly returns the recording for the component.
-
#recording_uri ⇒ String
Directly returns the recording URI for the component.
-
#resume! ⇒ Object
Sends an Rayo resume message for the current Record.
-
#resume_action ⇒ Command::Record::Resume
Create an Rayo resume message for the current Record.
-
#start_beep ⇒ true, false
Indicates whether subsequent record will be preceded with a beep.
- #start_beep=(sb) ⇒ Object
-
#start_paused ⇒ true, false
Whether subsequent record will start in PAUSE mode.
- #start_paused=(other) ⇒ Object
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::Record
Creates an Rayo Record command
27 28 29 30 31 |
# File 'lib/punchblock/component/record.rb', line 27 def self.new( = {}) super().tap do |new_node| .each_pair { |k,v| new_node.send :"#{k}=", v } end end |
Instance Method Details
#final_timeout ⇒ Integer
Returns Controls the length of a period of silence after callers have spoken to conclude they finished.
36 37 38 |
# File 'lib/punchblock/component/record.rb', line 36 def final_timeout read_attr :'final-timeout', :to_i end |
#final_timeout=(timeout) ⇒ Object
43 44 45 |
# File 'lib/punchblock/component/record.rb', line 43 def final_timeout=(timeout) write_attr :'final-timeout', timeout.to_i end |
#format ⇒ String
Returns the codec to use for recording.
50 51 52 |
# File 'lib/punchblock/component/record.rb', line 50 def format read_attr :format end |
#format=(format) ⇒ Object
57 58 59 |
# File 'lib/punchblock/component/record.rb', line 57 def format=(format) write_attr :format, format end |
#initial_timeout ⇒ Integer
Returns Controls how long the recognizer should wait after the end of the prompt for the caller to speak before sending a Recorder event.
64 65 66 |
# File 'lib/punchblock/component/record.rb', line 64 def initial_timeout read_attr :'initial-timeout', :to_i end |
#initial_timeout=(timeout) ⇒ Object
71 72 73 |
# File 'lib/punchblock/component/record.rb', line 71 def initial_timeout=(timeout) write_attr :'initial-timeout', timeout.to_i end |
#inspect_attributes ⇒ Object
:nodoc:
117 118 119 |
# File 'lib/punchblock/component/record.rb', line 117 def inspect_attributes # :nodoc: [:final_timeout, :format, :initial_timeout, :max_duration, :start_beep, :start_paused] + super end |
#max_duration ⇒ Integer
Returns Indicates the maximum duration for the recording.
78 79 80 |
# File 'lib/punchblock/component/record.rb', line 78 def max_duration read_attr :'max-duration', :to_i end |
#max_duration=(other) ⇒ Object
85 86 87 |
# File 'lib/punchblock/component/record.rb', line 85 def max_duration=(other) write_attr :'max-duration', other.to_i end |
#pause! ⇒ Object
Sends an Rayo pause message for the current Record
147 148 149 150 151 152 153 |
# File 'lib/punchblock/component/record.rb', line 147 def pause! raise InvalidActionError, "Cannot pause a Record that is not executing" unless executing? pause_action.tap do |action| result = write_action action paused! if result end end |
#pause_action ⇒ Command::Record::Pause
Pauses a running Record
140 141 142 |
# File 'lib/punchblock/component/record.rb', line 140 def pause_action Pause.new :component_id => component_id, :target_call_id => target_call_id end |
#recording ⇒ Punchblock::Component::Record::Recording
Directly returns the recording for the component
184 185 186 |
# File 'lib/punchblock/component/record.rb', line 184 def recording complete_event.recording end |
#recording_uri ⇒ String
Directly returns the recording URI for the component
192 193 194 |
# File 'lib/punchblock/component/record.rb', line 192 def recording_uri recording.uri end |
#resume! ⇒ Object
Sends an Rayo resume message for the current Record
172 173 174 175 176 177 178 |
# File 'lib/punchblock/component/record.rb', line 172 def resume! raise InvalidActionError, "Cannot resume a Record that is not paused." unless paused? resume_action.tap do |action| result = write_action action resumed! if result end end |
#resume_action ⇒ Command::Record::Resume
Create an Rayo resume message for the current Record
165 166 167 |
# File 'lib/punchblock/component/record.rb', line 165 def resume_action Resume.new :component_id => component_id, :target_call_id => target_call_id end |
#start_beep ⇒ true, false
Returns Indicates whether subsequent record will be preceded with a beep.
92 93 94 |
# File 'lib/punchblock/component/record.rb', line 92 def start_beep read_attr(:'start-beep') == 'true' end |
#start_beep=(sb) ⇒ Object
99 100 101 |
# File 'lib/punchblock/component/record.rb', line 99 def start_beep=(sb) write_attr :'start-beep', sb end |
#start_paused ⇒ true, false
Returns Whether subsequent record will start in PAUSE mode.
106 107 108 |
# File 'lib/punchblock/component/record.rb', line 106 def start_paused read_attr(:'start-paused') == 'true' end |
#start_paused=(other) ⇒ Object
113 114 115 |
# File 'lib/punchblock/component/record.rb', line 113 def start_paused=(other) write_attr :'start-paused', other end |