Class: Adhearsion::Event::Complete

Inherits:
Adhearsion::Event show all
Defined in:
lib/adhearsion/event/complete.rb

Defined Under Namespace

Classes: Error, Hangup, Reason, Stop

Instance Attribute Summary

Attributes inherited from Rayo::RayoNode

#client, #connection, #original_component

Instance Method Summary collapse

Methods inherited from Rayo::RayoNode

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

Instance Method Details

#inherit(xml_node) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/adhearsion/event/complete.rb', line 17

def inherit(xml_node)
  if reason_node = xml_node.at_xpath('*')
    self.reason = Adhearsion::Rayo::RayoNode.from_xml(reason_node).tap do |reason|
      reason.target_call_id = target_call_id
      reason.component_id = component_id
    end
  end

  if recording_node = xml_node.at_xpath('//ns:recording', ns: Rayo::RAYO_NAMESPACES[:record_complete])
    self.recording = Adhearsion::Rayo::RayoNode.from_xml(recording_node).tap do |recording|
      recording.target_call_id = target_call_id
      recording.component_id = component_id
    end
  end

  if fax_node = xml_node.at_xpath('//ns:fax', ns: Rayo::RAYO_NAMESPACES[:fax_complete])
    self.fax = Adhearsion::Rayo::RayoNode.from_xml(fax_node).tap do |fax|
      fax.target_call_id = target_call_id
      fax.component_id = component_id
    end
  end

  xml_node.xpath('//ns:metadata', ns: Rayo::RAYO_NAMESPACES[:fax_complete]).each do |md|
    [md['name']] = md['value']
  end

  super
end