Class: Adhearsion::Rayo::Component::Prompt

Inherits:
ComponentNode show all
Defined in:
lib/adhearsion/rayo/component/prompt.rb

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #connection, #original_component

Instance Method Summary collapse

Methods inherited from ComponentNode

#add_event, #complete_event, #complete_event=, #register_event_handler, #register_internal_handlers, #response=, #stop!, #stop_action, #trigger_event_handler, #write_action

Methods inherited from Adhearsion::Rayo::CommandNode

#response, #response=

Methods inherited from RayoNode

#==, class_from_registration, from_xml, #inspect, register, #source, #to_rayo, #to_xml

Constructor Details

#initialize(output = nil, input = nil, options = {}) ⇒ Component::Prompt

Create a prompt command

Parameters:

  • output (Output) (defaults to: nil)
  • input (Input) (defaults to: nil)
  • options (Hash) (defaults to: {})

Options Hash (options):

  • :barge_in (true, false, optional)

    Indicates wether or not the input should interrupt then output



23
24
25
26
27
# File 'lib/adhearsion/rayo/component/prompt.rb', line 23

def initialize(output = nil, input = nil, options = {})
  super options
  self.output = output
  self.input  = input
end

Instance Method Details

#inherit(xml_node) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/adhearsion/rayo/component/prompt.rb', line 29

def inherit(xml_node)
  input_node = xml_node.at_xpath('ns:input', ns: Input.registered_ns)
  self.input = Input.from_xml input_node if input_node

  output_node = xml_node.at_xpath('ns:output', ns: Output.registered_ns)
  self.output = Output.from_xml output_node if output_node

  super
end

#rayo_attributesObject



39
40
41
42
43
# File 'lib/adhearsion/rayo/component/prompt.rb', line 39

def rayo_attributes
  {
    'barge-in' => barge_in
  }
end

#rayo_children(root) ⇒ Object



45
46
47
48
49
# File 'lib/adhearsion/rayo/component/prompt.rb', line 45

def rayo_children(root)
  input.to_rayo(root) if input
  output.to_rayo(root) if output
  super
end