Sha256: a2ce90944a50f572a6128e2dee93dc186e10ded445947b9a42df6d4c6929c4e3

Contents?: true

Size: 1.05 KB

Versions: 23

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

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

      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

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.24 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.23 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.22 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.21 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.20 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.19 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.18 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.17 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.16 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.15 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.14 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.14.alpha.23 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.13 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.13.alpha.22 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.12.alpha.21 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.12.alpha.20 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.12 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.11 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.10 lib/br_invoices_pdf/cfe/parser.rb
br_invoices_pdf-0.2.9 lib/br_invoices_pdf/cfe/parser.rb