Sha256: 64fb49ce7efa694824a14a1f3422b190d107bc807f1c4dd2bbe884e058cd5dac

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module BrInvoicesPdf
  module Util
    module MountParams
      module_function

      def mount(xml, params)
        params.reduce({}) do |response, (param, path)|
          { **response, param => locate_element(xml, path) }
        end
      end

      def address_params(root_path, local)
        {
          streetname: "#{root_path}/ender#{local}/xLgr",
          number: "#{root_path}/ender#{local}/nro",
          district: "#{root_path}/ender#{local}/xBairro",
          city: "#{root_path}/ender#{local}/xMun",
          state: "#{root_path}/ender#{local}/UF"
        }.freeze
      end
      private_class_method :address_params
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.7 lib/br_invoices_pdf/util/mount_params.rb
br_invoices_pdf-0.2.6.alpha.19 lib/br_invoices_pdf/util/mount_params.rb