Sha256: 6cdbc60e26d9a3cd6a61e67eeb7ffb2dbb510888b81eb39b2a4a8802dd118606

Contents?: true

Size: 1.4 KB

Versions: 17

Compression:

Stored size: 1.4 KB

Contents

# frozen_string_literal: true

require 'stringio'

require 'ox'
require 'prawn'
require 'prawn/table'
require 'chunky_png'
require 'rqrcode'
require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/png_outputter'
require 'barby/outputter/prawn_outputter'

require 'br_invoices_pdf/version'
require 'br_invoices_pdf/generator'
require 'br_invoices_pdf/errors/invalid_document_type'

module BrInvoicesPdf
  @generators = {}

  module_function

  Ox.default_options = Ox.default_options.merge(encoding: 'windows-1252')

  def generate(type, xml, options = {})
    generator = @generators[type]
    raise(Errors::InvalidDocumentType, type) unless generator
    generator.generate(xml, options)
  end

  def register(type, renderer, parser)
    raise(ArgumentError, "Expected Symbol or String to type. Received #{type.class}") unless valid_type?(type)
    @generators[type.to_sym] = Generator.new(renderer, parser)
  end

  def supported_document_types
    @generators.keys
  end

  def valid_type?(type)
    type.is_a?(String) || type.is_a?(Symbol)
  end
end

require 'br_invoices_pdf/util/xml_locate'
require 'br_invoices_pdf/util/nfce_check_urls'
require 'br_invoices_pdf/util/mount_params'
require 'br_invoices_pdf/util/enum'
require 'br_invoices_pdf/util/base_renderer'
require 'br_invoices_pdf/util/pdf_renderer'
require 'br_invoices_pdf/util/product_table'
require 'br_invoices_pdf/cfe'
require 'br_invoices_pdf/nfce'

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.18 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.17 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.16 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.15 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.14 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.14.alpha.23 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.13 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.13.alpha.22 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.12.alpha.21 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.12.alpha.20 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.12 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.11 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.10 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.9 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.8 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.7 lib/br_invoices_pdf.rb
br_invoices_pdf-0.2.6.alpha.19 lib/br_invoices_pdf.rb