Sha256: 9f8bda207f84d16eb1075cacf653c1f8aa568483d89dd972743fd143557b82d1

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

require 'br_invoices_pdf/cfe/parser/access_key'
require 'br_invoices_pdf/cfe/parser/company_attributes'
require 'br_invoices_pdf/cfe/parser/cpf'
require 'br_invoices_pdf/cfe/parser/cnpj'
require 'br_invoices_pdf/cfe/parser/document_number'
require 'br_invoices_pdf/cfe/parser/fisco_obs'
require 'br_invoices_pdf/cfe/parser/payment'
require 'br_invoices_pdf/cfe/parser/payments'
require 'br_invoices_pdf/cfe/parser/products_data'
require 'br_invoices_pdf/cfe/parser/sat'

module BrInvoicesPdf
  module Cfe
    module Parser
      module_function

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.6 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.6.alpha.18 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.5.alpha.17 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.5 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.5.alpha.16 lib/br_invoices_pdf/cfe/parser.rb