module BrInvoicesPdf::Cfe::Parser::CompanyAttributes

Constants

SEFAZ_STATE_CODES

Public Instance Methods

company_address_params(xml) click to toggle source
# File lib/br_invoices_pdf/cfe/parser/company_attributes.rb, line 32
def company_address_params(xml)
  {
    public_place: locate_element(xml, 'infCFe/emit/enderEmit/xLgr'),
    number: locate_element(xml, 'infCFe/emit/enderEmit/nro'),
    complement: locate_element(xml, 'infCFe/emit/enderEmit/xCpl'),
    city: locate_element(xml, 'infCFe/emit/enderEmit/xMun'),
    neighborhood: locate_element(xml, 'infCFe/emit/enderEmit/xBairro'),
    cep: locate_element(xml, 'infCFe/emit/enderEmit/CEP'),
    state: SEFAZ_STATE_CODES[locate_element(xml, 'infCFe/ide/cUF')]
  }
end
execute(xml) click to toggle source
# File lib/br_invoices_pdf/cfe/parser/company_attributes.rb, line 20
def execute(xml)
  {
    company_name: locate_element(xml, 'infCFe/emit/xNome'),
    address: company_address_params(xml),
    trading_name: locate_element(xml, 'infCFe/emit/xFant'),
    zipcode: locate_element(xml, 'infCFe/emit/enderEmit/CEP'),
    cnpj: locate_element(xml, 'infCFe/ide/CNPJ'),
    ie: locate_element(xml, 'infCFe/emit/IE'),
    im: locate_element(xml, 'infCFe/emit/IM')
  }
end