Module: Cpi::EventParser

Extended by:
EventParser
Included in:
EventParser
Defined in:
lib/cpi/event.rb

Instance Method Summary collapse

Instance Method Details

#parse(xml) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/cpi/event.rb', line 8

def parse(xml)
  xml_doc = parse_xml(xml)
  attrs = {
    event_type: xml_doc.xpath('//header/event_type').text,
    source_tenant_uid: xml_doc.xpath('//header/source_tenant_uid').text,
    event_uid: nil_if_blank(xml_doc.xpath('//header/event_uid').text)
  }
  Event.new(attrs)
end