Class: Punchblock::Component::Tropo::Ask
- Inherits:
-
ComponentNode
- Object
- Niceogiri::XML::Node
- RayoNode
- Punchblock::CommandNode
- ComponentNode
- Punchblock::Component::Tropo::Ask
- Defined in:
- lib/punchblock/component/tropo/ask.rb
Defined Under Namespace
Classes: Choices, Complete, Prompt
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::Ask
Create an ask message.
Instance Method Summary collapse
-
#bargein ⇒ Boolean
Wether or not to allow the caller to begin their response before the prompt finishes.
- #bargein=(bargein) ⇒ Object
-
#choices ⇒ Choices
The choices available.
- #choices=(choices) ⇒ Object
-
#inspect_attributes ⇒ Object
:nodoc:.
-
#min_confidence ⇒ Float
Confidence with which to consider a response acceptable.
- #min_confidence=(min_confidence) ⇒ Object
-
#mode ⇒ Symbol
Mode by which to accept input.
- #mode=(mode) ⇒ Object
-
#prompt ⇒ Prompt
The prompt by which to introduce the question.
- #prompt=(p) ⇒ Object
-
#recognizer ⇒ String
Recognizer to use for speech recognition.
- #recognizer=(recognizer) ⇒ Object
-
#terminator ⇒ String
Terminator by which to signal the end of input.
- #terminator=(terminator) ⇒ Object
-
#timeout ⇒ Integer
Timeout to wait for user input.
- #timeout=(timeout) ⇒ Object
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, register, #source
Constructor Details
This class inherits a constructor from Punchblock::Component::ComponentNode
Class Method Details
.new(options = {}) ⇒ Command::Ask
Create an ask message
34 35 36 37 38 |
# File 'lib/punchblock/component/tropo/ask.rb', line 34 def self.new( = {}) super().tap do |new_node| .each_pair { |k,v| new_node.send :"#{k}=", v } end end |
Instance Method Details
#bargein ⇒ Boolean
Returns wether or not to allow the caller to begin their response before the prompt finishes.
43 44 45 |
# File 'lib/punchblock/component/tropo/ask.rb', line 43 def read_attr(:bargein) == "true" end |
#bargein=(bargein) ⇒ Object
50 51 52 |
# File 'lib/punchblock/component/tropo/ask.rb', line 50 def () write_attr :bargein, .to_s end |
#choices ⇒ Choices
Returns the choices available.
149 150 151 |
# File 'lib/punchblock/component/tropo/ask.rb', line 149 def choices Choices.new find_first('ns:choices', :ns => self.class.registered_ns) end |
#choices=(choices) ⇒ Object
158 159 160 161 162 |
# File 'lib/punchblock/component/tropo/ask.rb', line 158 def choices=(choices) remove_children :choices choices = Choices.new(choices) unless choices.is_a?(Choices) self << choices end |
#inspect_attributes ⇒ Object
:nodoc:
164 165 166 |
# File 'lib/punchblock/component/tropo/ask.rb', line 164 def inspect_attributes # :nodoc: [:bargein, :min_confidence, :mode, :recognizer, :terminator, :timeout, :prompt, :choices] + super end |
#min_confidence ⇒ Float
Returns Confidence with which to consider a response acceptable.
57 58 59 |
# File 'lib/punchblock/component/tropo/ask.rb', line 57 def min_confidence read_attr 'min-confidence', :to_f end |
#min_confidence=(min_confidence) ⇒ Object
64 65 66 |
# File 'lib/punchblock/component/tropo/ask.rb', line 64 def min_confidence=(min_confidence) write_attr 'min-confidence', min_confidence end |
#mode ⇒ Symbol
Returns mode by which to accept input. Can be :speech, :dtmf or :any.
71 72 73 |
# File 'lib/punchblock/component/tropo/ask.rb', line 71 def mode read_attr :mode, :to_sym end |
#mode=(mode) ⇒ Object
78 79 80 |
# File 'lib/punchblock/component/tropo/ask.rb', line 78 def mode=(mode) write_attr :mode, mode end |
#prompt ⇒ Prompt
Returns the prompt by which to introduce the question.
127 128 129 |
# File 'lib/punchblock/component/tropo/ask.rb', line 127 def prompt Prompt.new find_first('//ns:prompt', :ns => self.registered_ns) end |
#prompt=(p) ⇒ Object
136 137 138 139 140 |
# File 'lib/punchblock/component/tropo/ask.rb', line 136 def prompt=(p) remove_children :prompt p = Prompt.new(p) unless p.is_a?(Prompt) self << p end |
#recognizer ⇒ String
Returns recognizer to use for speech recognition.
85 86 87 |
# File 'lib/punchblock/component/tropo/ask.rb', line 85 def recognizer read_attr :recognizer end |
#recognizer=(recognizer) ⇒ Object
92 93 94 |
# File 'lib/punchblock/component/tropo/ask.rb', line 92 def recognizer=(recognizer) write_attr :recognizer, recognizer end |
#terminator ⇒ String
Returns terminator by which to signal the end of input.
99 100 101 |
# File 'lib/punchblock/component/tropo/ask.rb', line 99 def terminator read_attr :terminator end |
#terminator=(terminator) ⇒ Object
106 107 108 |
# File 'lib/punchblock/component/tropo/ask.rb', line 106 def terminator=(terminator) write_attr :terminator, terminator end |
#timeout ⇒ Integer
Returns timeout to wait for user input.
113 114 115 |
# File 'lib/punchblock/component/tropo/ask.rb', line 113 def timeout read_attr :timeout, :to_i end |
#timeout=(timeout) ⇒ Object
120 121 122 |
# File 'lib/punchblock/component/tropo/ask.rb', line 120 def timeout=(timeout) write_attr :timeout, timeout end |