Module: BrInvoicesPdf::Nfce::Parser::Customer

Extended by:
Util::MountParams, Util::XmlLocate
Defined in:
lib/br_invoices_pdf/nfce/parser/customer.rb

Class Method Summary collapse

Methods included from Util::XmlLocate

locate_element, node_locate, root_path

Methods included from Util::MountParams

mount

Class Method Details

.dest_root_path(xml) ⇒ Object



12
13
14
# File 'lib/br_invoices_pdf/nfce/parser/customer.rb', line 12

def dest_root_path(xml)
  "#{root_path(xml)}/dest"
end

.execute(xml) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/br_invoices_pdf/nfce/parser/customer.rb', line 16

def execute(xml)
  identification_type = identification_type_by(xml)
  root_path = dest_root_path(xml)

  {
    identification_type: identification_type,
    identification: locate_element(xml, "#{root_path}/#{identification_type}"),
    address: mount(xml, address_params(xml, root_path, 'Dest'))
  }
end