lib/punchblock/event/complete.rb in punchblock-2.1.1 vs lib/punchblock/event/complete.rb in punchblock-2.2.0
- old
+ new
@@ -7,10 +7,13 @@
attribute :reason
attribute :recording
+ attribute :fax
+ attribute :fax_metadata, Hash, default: {}
+
def inherit(xml_node)
if reason_node = xml_node.at_xpath('*')
self.reason = RayoNode.from_xml(reason_node).tap do |reason|
reason.target_call_id = target_call_id
reason.component_id = component_id
@@ -22,14 +25,25 @@
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_NAMESPACES[:fax_complete])
+ self.fax = 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_NAMESPACES[:fax_complete]).each do |md|
+ fax_metadata[md['name']] = md['value']
+ end
+
super
end
class Reason < RayoNode
- attribute :name
+ attribute :name, Symbol, default: ->(node,_) { node.class.registered_name.to_sym }
def inherit(xml_node)
self.name = xml_node.name.to_sym
super
end