Module: BrInvoicesPdf::Nfce::Parser::Company

Extended by:
Util::MountParams, Util::XmlLocate
Defined in:
lib/br_invoices_pdf/nfce/parser/company.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

.emit_root_path(xml) ⇒ Object



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

def emit_root_path(xml)
  "#{root_path(xml)}/emit"
end

.execute(xml) ⇒ Object



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

def execute(xml)
  path = emit_root_path(xml)
  {
    name: locate_element(xml, "#{path}/xNome"),
    cnpj: locate_element(xml, "#{path}/CNPJ"),
    state_number: locate_element(xml, "#{path}/IE"),
    address: mount(xml, address_params(xml, path, 'Emit'))
  }
end