Sha256: 7ef00be156b8d40d747da76ed42b284ad6b2202cd0c0281df0b7b1e507de9f1f

Contents?: true

Size: 874 Bytes

Versions: 23

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

require 'br_invoices_pdf/nfce/parser/company'
require 'br_invoices_pdf/nfce/parser/products'
require 'br_invoices_pdf/nfce/parser/payments'
require 'br_invoices_pdf/nfce/parser/customer'
require 'br_invoices_pdf/nfce/parser/totals'
require 'br_invoices_pdf/nfce/parser/additional_info'
require 'br_invoices_pdf/nfce/parser/emission_details'

module BrInvoicesPdf
  module Nfce
    module Parser
      module_function

      PARSERS = {
        company: Company,
        products: Products,
        payments: Payments,
        customer: Customer,
        totals: Totals,
        additional_info: AdditionalInfo,
        emission_details: EmissionDetails
      }.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/nfce/parser.rb
br_invoices_pdf-0.2.23 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.22 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.21 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.20 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.19 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.18 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.17 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.16 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.15 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.14 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.14.alpha.23 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.13 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.13.alpha.22 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.12.alpha.21 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.12.alpha.20 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.12 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.11 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.10 lib/br_invoices_pdf/nfce/parser.rb
br_invoices_pdf-0.2.9 lib/br_invoices_pdf/nfce/parser.rb