Module: BrInvoicesPdf::Cfe::Parser::CompanyAttributes

Extended by:
Util::XmlLocate
Defined in:
lib/br_invoices_pdf/cfe/parser/company_attributes.rb

Constant Summary collapse

SEFAZ_STATE_CODES =
{
   '11' => 'RO',  '12' => 'AC',  '13' => 'AM',  '14' => 'RR',  '15' => 'PA',
   '16' => 'AP',  '17' => 'TO',  '21' => 'MA',  '22' => 'PI',  '23' => 'CE',
   '24' => 'RN',  '25' => 'PB',  '26' => 'PE',  '27' => 'AL',  '28' => 'SE',
   '29' => 'BA',  '31' => 'MG',  '32' => 'ES',  '33' => 'RJ',  '35' => 'SP',
   '41' => 'PR',  '42' => 'SC',  '43' => 'RS',  '50' => 'MS',  '51' => 'MT',
   '52' => 'GO',  '53' => 'DF'
}.freeze

Class Method Summary collapse

Methods included from Util::XmlLocate

locate_element, node_locate, root_path

Class Method Details

.execute(xml) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# 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