Sha256: fd060ff888144e42adc1caf75aeb62e1d8f1caabd7b0206797abc9119888a5d6
Contents?: true
Size: 963 Bytes
Versions: 12
Compression:
Stored size: 963 Bytes
Contents
module BrInvoicesPdf module Cfe module Parser module ProductsData extend BaseParser module_function FIELDS = { code: 'cProd', description: 'xProd', cfop: 'CFOP', quantity: 'qCom', unit_label: 'uCom', total_value: 'vProd', unit_value: 'vUnCom', item_value: 'vItem' }.freeze def execute(xml) node_products = xml.locate('infCFe/det') products_params(node_products) if node_products end def products_params(node_products) node_products.map(&method(:product_by)) end private_class_method :products_params def product_by(element) FIELDS .map { |(key, field)| [key, node_locate(element, field)] } .to_h end private_class_method :product_by end end end end
Version data entries
12 entries across 12 versions & 1 rubygems