Blame view

lib/syspro/business_objects/parsers/invsws_parser.rb 753 Bytes
762ae45f   chadzink   Added InvSws Busi...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  # frozen_string_literal: true
  
  module Syspro
    module BusinessObjects
      module Parsers
        class InvSwsParser
          attr_reader :doc
  
          def initialize(doc)
            @doc = doc
          end
  
          def parse
            {
              "key": {
                "stock_code": doc.xpath("//item/key/stockcode").map{|e| e.text}.first,
                "warehouse": doc.xpath("//item/key/stockcode").map{|e| e.text}.first
              },
              "reacords_read": doc.xpath("//StatusOfItems/RecordsRead").map{|e| e.text}.first,
              "reacords_invalid": doc.xpath("//StatusOfItems/RecordsInvalid").map{|e| e.text}.first,
              "error_numbers": doc.xpath("//ErrorNumber").map{|e| e.text}
            }
          end
        end
      end
    end
  end