Blame view

lib/syspro/business_objects/parsers/portoi_parser.rb 806 Bytes
d9a9cb5d   chadzink   Add portoi and co...
1
2
3
4
5
6
7
8
9
10
11
12
13
  # frozen_string_literal: true
  
  module Syspro
    module BusinessObjects
      module Parsers
        class PorToiParser
          attr_reader :doc
  
          def initialize(doc)
            @doc = doc
          end
  
          def parse
b1c0def6   Samuel J Clopton   rubocop violation...
14
15
16
            po = Syspro::BusinessObjects::Models::PurchaseOrder.new
  
            po.error_numbers = doc.xpath('//ErrorNumber').map(&:text)
d9a9cb5d   chadzink   Add portoi and co...
17
18
19
20
21
  
            po.purchase_order = doc.first_element_child.xpath('Order/Key/PurchaseOrder').text
            po.item_number = doc.first_element_child.xpath('Order/ItemNumber').text
            po.order_action_type = doc.first_element_child.xpath('Order/OrderActionType').text
            po.supplier = doc.first_element_child.xpath('Order/Supplier').text
b1c0def6   Samuel J Clopton   rubocop violation...
22
  
d9a9cb5d   chadzink   Add portoi and co...
23
24
25
26
27
28
29
30
            po
          end
  
          PorToiObject = Struct.new(:key, :receipts)
        end
      end
    end
  end