Module: BrInvoicesPdf::Cfe::Parser

Defined in:
lib/br_invoices_pdf/cfe/parser.rb,
lib/br_invoices_pdf/cfe/parser/cpf.rb,
lib/br_invoices_pdf/cfe/parser/sat.rb,
lib/br_invoices_pdf/cfe/parser/cnpj.rb,
lib/br_invoices_pdf/cfe/parser/payment.rb,
lib/br_invoices_pdf/cfe/parser/payments.rb,
lib/br_invoices_pdf/cfe/parser/fisco_obs.rb,
lib/br_invoices_pdf/cfe/parser/access_key.rb,
lib/br_invoices_pdf/cfe/parser/products_data.rb,
lib/br_invoices_pdf/cfe/parser/document_number.rb,
lib/br_invoices_pdf/cfe/parser/company_attributes.rb

Defined Under Namespace

Modules: AccessKey, Cnpj, CompanyAttributes, Cpf, DocumentNumber, FiscoObs, Payment, Payments, ProductsData, Sat

Constant Summary collapse

PARSERS =
{
  sat_params: Sat,
  document_number: DocumentNumber,
  totals: Payment,
  payments: Payments,
  products: ProductsData,
  company_attributes: CompanyAttributes,
  fisco_obs: FiscoObs,
  access_key: AccessKey,
  cpf: Cpf,
  cnpj: Cnpj
}.freeze

Class Method Summary collapse

Class Method Details

.parse(xml) ⇒ Object



32
33
34
35
36
# File 'lib/br_invoices_pdf/cfe/parser.rb', line 32

def parse(xml)
  PARSERS.reduce({}) do |response, (param, parser)|
    { **response, param => parser.execute(xml) }
  end
end