Commit 3947376e7de72018658659853c176594a829af50

Authored by Sam Clopton
Committed by GitHub
2 parents 58ed758f b1c0def6

Merge pull request #20 from wildland/test-and-rubocop-violation-fixes

Test and rubocop violation fixes
Showing 52 changed files with 892 additions and 605 deletions   Show diff stats
... ... @@ -5,3 +5,9 @@ source 'https://rubygems.org'
5 5 git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6 6  
7 7 gemspec
  8 +
  9 +group :development, :test do
  10 + gem 'rubocop', require: false
  11 + gem 'pry-byebug'
  12 + gem 'rb-readline'
  13 +end
... ...
Gemfile.lock
... ... @@ -11,6 +11,7 @@ GEM
11 11 addressable (2.5.2)
12 12 public_suffix (>= 2.0.2, < 4.0)
13 13 ast (2.4.0)
  14 + byebug (11.0.1)
14 15 coderay (1.1.2)
15 16 crack (0.4.3)
16 17 safe_yaml (~> 1.0.0)
... ... @@ -36,9 +37,13 @@ GEM
36 37 pry (0.11.3)
37 38 coderay (~> 1.1.0)
38 39 method_source (~> 0.9.0)
  40 + pry-byebug (3.7.0)
  41 + byebug (~> 11.0)
  42 + pry (~> 0.10)
39 43 public_suffix (3.0.2)
40 44 rainbow (3.0.0)
41 45 rake (10.5.0)
  46 + rb-readline (0.5.5)
42 47 rubocop (0.54.0)
43 48 parallel (~> 1.10)
44 49 parser (>= 2.5)
... ... @@ -63,8 +68,10 @@ DEPENDENCIES
63 68 minitest (~> 5.0)
64 69 minitest-vcr (~> 1.4.0)
65 70 pry (~> 0.11)
  71 + pry-byebug
66 72 rake (~> 10.0)
67   - rubocop (~> 0.54.0)
  73 + rb-readline
  74 + rubocop
68 75 syspro-ruby!
69 76 webmock (~> 3.3.0)
70 77  
... ...
lib/syspro.rb
... ... @@ -94,7 +94,7 @@ module Syspro
94 94 end
95 95  
96 96 def api_base=(url)
97   - warn "[DEPRECATION] `api_base=` is deprecated. Please use `configuration.server_url=` instead."
  97 + warn '[DEPRECATION] `api_base=` is deprecated. Please use `configuration.server_url=` instead.'
98 98 @api_base = url
99 99 end
100 100  
... ...
lib/syspro/api_operations/setup.rb
... ... @@ -33,11 +33,10 @@ module Syspro
33 33  
34 34 protected
35 35  
36   - def request(method, url, params = {}, opts ={})
  36 + def request(method, url, params = {}, opts = {})
37 37 opts = @opts.merge(Util.normalize_opts(opts))
38 38 Request.request(method, url, params, opts)
39 39 end
40 40 end
41 41 end
42 42 end
43   -
... ...
lib/syspro/api_operations/transaction.rb
... ... @@ -25,11 +25,10 @@ module Syspro
25 25  
26 26 protected
27 27  
28   - def request(method, url, params = {}, opts ={})
  28 + def request(method, url, params = {}, opts = {})
29 29 opts = @opts.merge(Util.normalize_opts(opts))
30 30 Request.request(method, url, params, opts)
31 31 end
32 32 end
33 33 end
34 34 end
35   -
... ...
lib/syspro/business_objects/combrw.rb
... ... @@ -16,10 +16,10 @@ module Syspro
16 16 xml_in = template.result(binding)
17 17 params = { 'UserId' => user_id, 'XmlIn' => xml_in }
18 18 resp = ComBrw.browse(params)
19   - unless raw
20   - parse_response(resp)
21   - else
  19 + if raw
22 20 resp
  21 + else
  22 + parse_response(resp)
23 23 end
24 24 end
25 25  
... ...
lib/syspro/business_objects/comsfm.rb
... ... @@ -17,9 +17,9 @@ module Syspro
17 17 xml_in = template.result(binding)
18 18 business_object = 'COMSFM'
19 19 params = { 'UserId' => user_id,
20   - 'BusinessObject' => business_object,
21   - 'XmlParameters' => xml_parameters,
22   - 'XmlIn' => xml_in }
  20 + 'BusinessObject' => business_object,
  21 + 'XmlParameters' => xml_parameters,
  22 + 'XmlIn' => xml_in }
23 23 resp = ComsFm.add(params)
24 24  
25 25 parse_response(resp)
... ... @@ -40,4 +40,4 @@ module Syspro
40 40 end
41 41 end
42 42 end
43   -end
44 43 \ No newline at end of file
  44 +end
... ...
lib/syspro/business_objects/invqry.rb
... ... @@ -32,7 +32,7 @@ module Syspro
32 32 parser.parse
33 33 end
34 34  
35   - def render_xml(inner_text, dflt_value = "")
  35 + def render_xml(inner_text, dflt_value = '')
36 36 inner_text ? inner_text.to_s : dflt_value
37 37 end
38 38 end
... ...
lib/syspro/business_objects/invsws.rb
... ... @@ -20,9 +20,9 @@ module Syspro
20 20 xml_in = template.result(binding)
21 21 business_object = 'INVSWS'
22 22 params = { 'UserId' => user_id,
23   - 'BusinessObject' => business_object,
24   - 'XmlParameters' => xml_parameters,
25   - 'XmlIn' => xml_in }
  23 + 'BusinessObject' => business_object,
  24 + 'XmlParameters' => xml_parameters,
  25 + 'XmlIn' => xml_in }
26 26 resp = InvSws.add(params)
27 27  
28 28 parse_response(resp)
... ... @@ -42,7 +42,7 @@ module Syspro
42 42 parser.parse
43 43 end
44 44  
45   - def render_xml(inner_text, dflt_value = "")
  45 + def render_xml(inner_text, dflt_value = '')
46 46 inner_text ? inner_text.to_s : dflt_value
47 47 end
48 48 end
... ...
lib/syspro/business_objects/models/comsfm_item.rb
... ... @@ -9,4 +9,4 @@ module Syspro
9 9 end
10 10 end
11 11 end
12   -end
13 12 \ No newline at end of file
  13 +end
... ...
lib/syspro/business_objects/models/inv.rb
... ... @@ -9,7 +9,7 @@ module Syspro
9 9  
10 10 def initialize
11 11 @warehouse_totals = WarehouseTotals.new
12   - @warehouse_items = []
  12 + @warehouse_items = []
13 13 @stock_item = StockItem.new
14 14 @system_information = SystemInformation.new
15 15 end
... ... @@ -19,7 +19,7 @@ module Syspro
19 19  
20 20 # copy hash items that match into new warehouse item
21 21 new_hash.keys.each do |k|
22   - w.send("#{k.to_s}=", new_hash[k]) if w.methods.include? k
  22 + w.send("#{k}=", new_hash[k]) if w.methods.include? k
23 23 end
24 24  
25 25 @warehouse_items.push(w)
... ... @@ -29,7 +29,7 @@ module Syspro
29 29 class WarehouseTotals
30 30 attr_accessor :qty_on_hand,
31 31 :available_qty
32   -
  32 +
33 33 # Not all xml parsed, see https://infozone.syspro.com/Support/businessobjectslibrary/INVQRYOUT.XML
34 34 end
35 35  
... ... @@ -80,4 +80,3 @@ module Syspro
80 80 end
81 81 end
82 82 end
83   -
... ...
lib/syspro/business_objects/models/inv_qry_options.rb
... ... @@ -25,11 +25,7 @@ module Syspro
25 25 :include_movement_dispatch_notes,
26 26 :include_ecc,
27 27 :xsl_stylesheet
28   -
29 28 end
30 29 end
31 30 end
32 31 end
33   -
34   -
35   -
... ...
lib/syspro/business_objects/models/inventory_inspection.rb
... ... @@ -12,4 +12,4 @@ module Syspro
12 12 end
13 13 end
14 14 end
15   -end
16 15 \ No newline at end of file
  16 +end
... ...
lib/syspro/business_objects/models/invsws_item.rb
... ... @@ -39,9 +39,9 @@ module Syspro
39 39 :e_signature
40 40 end
41 41  
42   - class InvSwsItemKey
43   - attr_accessor
44   - end
  42 + class InvSwsItemKey
  43 + attr_accessor
  44 + end
45 45 end
46 46 end
47   -end
48 47 \ No newline at end of file
  48 +end
... ...
lib/syspro/business_objects/models/por_detail.rb
... ... @@ -94,35 +94,33 @@ module Syspro
94 94 :edit_default_price,
95 95 :default_prum,
96 96 :costing_methods_available
97   -
98 97 end # end of class MerchandiseDetail
99 98  
100 99 class CostingMethodsAvailable
101 100 attr_accessor :manual_method_code,
102   - :manual_method_desc,
103   - :manual_method_price,
104   - :edit__manual_method_price,
105   - :manual_method_costing_prum,
106   - :total_cost_method_code,
107   - :total_cost_method_desc,
108   - :total_cost_method_price,
109   - :edit__total_cost_method_price,
110   - :total_cost_costing_prum,
111   - :purchase_price_method_code,
112   - :purchase_price_method_desc,
113   - :purchase_price_method_price,
114   - :edit__purchase_price_method_price,
115   - :purchase_price_costing_prum,
116   - :price_tax_method_code,
117   - :price_tax_method_desc,
118   - :price_tax_method_price,
119   - :edit__price_tax_method_price,
120   - :price_tax_costing_prum
  101 + :manual_method_desc,
  102 + :manual_method_price,
  103 + :edit__manual_method_price,
  104 + :manual_method_costing_prum,
  105 + :total_cost_method_code,
  106 + :total_cost_method_desc,
  107 + :total_cost_method_price,
  108 + :edit__total_cost_method_price,
  109 + :total_cost_costing_prum,
  110 + :purchase_price_method_code,
  111 + :purchase_price_method_desc,
  112 + :purchase_price_method_price,
  113 + :edit__purchase_price_method_price,
  114 + :purchase_price_costing_prum,
  115 + :price_tax_method_code,
  116 + :price_tax_method_desc,
  117 + :price_tax_method_price,
  118 + :edit__price_tax_method_price,
  119 + :price_tax_costing_prum
121 120 end # end of class CostingMethodsAvailable
122 121  
123 122 class PurchaseOrderTotals
124 123 attr_accessor :local_values, :current_values, :first_receipt_date, :order_complete_date
125   -
126 124 end
127 125  
128 126 class PurchaseOrderTotalsLocalValues
... ... @@ -136,7 +134,6 @@ module Syspro
136 134 :edited_current_order_value, :edited_current_received_to_date_value,
137 135 :edited_current_outstanding_value
138 136 end
139   -
140 137 end
141 138 end
142 139 end
... ...
lib/syspro/business_objects/models/purchase_order.rb
... ... @@ -10,4 +10,4 @@ module Syspro
10 10 end
11 11 end
12 12 end
13   -end
14 13 \ No newline at end of file
  14 +end
... ...
lib/syspro/business_objects/models/purchase_orders/comment_line.rb
... ... @@ -13,4 +13,4 @@ module Syspro
13 13 end
14 14 end
15 15 end
16   -end
17 16 \ No newline at end of file
  17 +end
... ...
lib/syspro/business_objects/models/purchase_orders/freight_line.rb
... ... @@ -8,9 +8,9 @@ module Syspro
8 8 :freight_value,
9 9 :freight_tax_code,
10 10 :freight_taxable
11   - :freight_f_loc
  11 + :freight_f_loc
12 12 end
13 13 end
14 14 end
15 15 end
16   -end
17 16 \ No newline at end of file
  17 +end
... ...
lib/syspro/business_objects/models/purchase_orders/header.rb
... ... @@ -39,6 +39,3 @@ module Syspro
39 39 end
40 40 end
41 41 end
42   -
43   -
44   -
... ...
lib/syspro/business_objects/models/purchase_orders/misc_charge_line.rb
... ... @@ -15,4 +15,4 @@ module Syspro
15 15 end
16 16 end
17 17 end
18   -end
19 18 \ No newline at end of file
  19 +end
... ...
lib/syspro/business_objects/models/purchase_orders/order_details.rb
... ... @@ -31,4 +31,4 @@ module Syspro
31 31 end
32 32 end
33 33 end
34   -end
35 34 \ No newline at end of file
  35 +end
... ...
lib/syspro/business_objects/models/purchase_orders/stock_line.rb
... ... @@ -4,45 +4,42 @@ module Syspro
4 4 module PurchaseOrders
5 5 class StockLine
6 6 attr_accessor :purchase_order_line,
7   - :line_action_type,
8   - :stock_code,
9   - :stock_description,
10   - :warehouse,
11   - :sup_catalogue,
12   - :order_qty,
13   - :order_uom,
14   - :units,
15   - :pieces,
16   - :price_method,
17   - :supplier_contract,
18   - :price,
19   - :price_uom,
20   - :line_disc_type,
21   - :line_disc_less_plus,
22   - :line_disc_percent1,
23   - :line_disc_percent2,
24   - :line_disc_percent3,
25   - :line_disc_value,
26   - :taxable,
27   - :tax_codev,
28   - :job,
29   - :version,
30   - :release,
31   - :latest_due_date,
32   - :original_due_date,
33   - :reschedule_due_date,
34   - :ledger_code,
35   - :password_for_ledger_code,
36   - :subcontract_op,
37   - :inspection_reqd,
38   - :product_class,
39   - :nons_unit_mass,
40   - :nons_unit_vol
  7 + :line_action_type,
  8 + :stock_code,
  9 + :stock_description,
  10 + :warehouse,
  11 + :sup_catalogue,
  12 + :order_qty,
  13 + :order_uom,
  14 + :units,
  15 + :pieces,
  16 + :price_method,
  17 + :supplier_contract,
  18 + :price,
  19 + :price_uom,
  20 + :line_disc_type,
  21 + :line_disc_less_plus,
  22 + :line_disc_percent1,
  23 + :line_disc_percent2,
  24 + :line_disc_percent3,
  25 + :line_disc_value,
  26 + :taxable,
  27 + :tax_codev,
  28 + :job,
  29 + :version,
  30 + :release,
  31 + :latest_due_date,
  32 + :original_due_date,
  33 + :reschedule_due_date,
  34 + :ledger_code,
  35 + :password_for_ledger_code,
  36 + :subcontract_op,
  37 + :inspection_reqd,
  38 + :product_class,
  39 + :nons_unit_mass,
  40 + :nons_unit_vol
41 41 end
42 42 end
43 43 end
44 44 end
45 45 end
46   -
47   -
48   -
... ...
lib/syspro/business_objects/models/receipt_interospection.rb
... ... @@ -29,4 +29,4 @@ module Syspro
29 29 end
30 30 end
31 31 end
32   -end
33 32 \ No newline at end of file
  33 +end
... ...
lib/syspro/business_objects/models/sor.rb
... ... @@ -13,4 +13,3 @@ module Syspro
13 13 end
14 14 end
15 15 end
16   -
... ...
lib/syspro/business_objects/parsers/comsfm_parser.rb
... ... @@ -11,10 +11,9 @@ module Syspro
11 11 end
12 12  
13 13 def parse
14   - error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text}
  14 + doc.xpath('//ErrorNumber').map(&:text)
15 15 end
16 16 end
17 17 end
18 18 end
19 19 end
20   -
... ...
lib/syspro/business_objects/parsers/invsws_parser.rb
... ... @@ -18,7 +18,23 @@ module Syspro
18 18 },
19 19 "reacords_read": doc.xpath("//StatusOfItems/RecordsRead").map{|e| e.text}.first,
20 20 "reacords_invalid": doc.xpath("//StatusOfItems/RecordsInvalid").map{|e| e.text}.first,
21   - "error_numbers": doc.xpath("//ErrorNumber").map{|e| e.text}
  21 + "error_numbers": doc.xpath("//ErrorNumber").map{|e| e.text},
  22 + "errors": map_errors
  23 + }
  24 + end
  25 +
  26 + def map_errors
  27 + doc.xpath('//ErrorNumber/..').map do |error_parent_node|
  28 + map_error_parent(error_parent_node)
  29 + end
  30 + end
  31 +
  32 + def map_error_parent(error_parent_node)
  33 + {
  34 + node_name: error_parent_node.name,
  35 + error_number: error_parent_node.xpath('//ErrorNumber').text,
  36 + error_desc: error_parent_node.xpath('//ErrorDescription').text,
  37 + value: error_parent_node.xpath('//Value').text
22 38 }
23 39 end
24 40 end
... ...
lib/syspro/business_objects/parsers/porqry_parser.rb
... ... @@ -11,7 +11,7 @@ module Syspro
11 11 end
12 12  
13 13 def parse
14   - por = Syspro::BusinessObjects::Models::PorDetail.new()
  14 + por = Syspro::BusinessObjects::Models::PorDetail.new
15 15  
16 16 por.purchase_order = doc.first_element_child.xpath('PurchaseOrder').text
17 17 por.supplier = doc.first_element_child.xpath('Supplier').text
... ... @@ -65,156 +65,152 @@ module Syspro
65 65 por.document_format = doc.first_element_child.xpath('DocumentFormat').text
66 66 por.include_in_mrp = doc.first_element_child.xpath('IncludeInMrp').text
67 67  
68   - por.customform_fields = doc.first_element_child.xpath("CustomForm").children.select{|item| item.name === "Field"}.map do |field_el|
69   - if field_el && field_el.children.count > 0
70   - Syspro::BusinessObjects::Models::PorDetail::CustomFormField.new.tap do |field_obj|
71   - field_obj.sequence = field_el.children.select{|el| el.name === "Sequence"}[0].children.text
72   - field_obj.name = field_el.children.select{|el| el.name === "Name"}[0].children.text
73   - field_obj.prompt = field_el.children.select{|el| el.name === "Prompt"}[0].children.text
74   - field_obj.column = field_el.children.select{|el| el.name === "Column"}[0].children.text
75   - field_obj.type = field_el.children.select{|el| el.name === "Type"}[0].children.text
76   - field_obj.length = field_el.children.select{|el| el.name === "Length"}[0].children.text
77   - field_obj.decimals = field_el.children.select{|el| el.name === "Decimals"}[0].children.text
78   - field_obj.default = field_el.children.select{|el| el.name === "Default"}[0].children.text
79   - field_obj.allow_null = field_el.children.select{|el| el.name === "AllowNull"}[0].children.text
80   - field_obj.validation_type = field_el.children.select{|el| el.name === "ValidationType"}[0].children.text
81   - field_obj.value_null = field_el.children.select{|el| el.name === "ValueNull"}[0].children.text
82   - end
  68 + por.customform_fields = doc.first_element_child.xpath('CustomForm').children.select { |item| item.name === 'Field' }.map do |field_el|
  69 + next unless field_el && field_el.children.count > 0
  70 + Syspro::BusinessObjects::Models::PorDetail::CustomFormField.new.tap do |field_obj|
  71 + field_obj.sequence = field_el.children.select { |el| el.name === 'Sequence' }[0].children.text
  72 + field_obj.name = field_el.children.select { |el| el.name === 'Name' }[0].children.text
  73 + field_obj.prompt = field_el.children.select { |el| el.name === 'Prompt' }[0].children.text
  74 + field_obj.column = field_el.children.select { |el| el.name === 'Column' }[0].children.text
  75 + field_obj.type = field_el.children.select { |el| el.name === 'Type' }[0].children.text
  76 + field_obj.length = field_el.children.select { |el| el.name === 'Length' }[0].children.text
  77 + field_obj.decimals = field_el.children.select { |el| el.name === 'Decimals' }[0].children.text
  78 + field_obj.default = field_el.children.select { |el| el.name === 'Default' }[0].children.text
  79 + field_obj.allow_null = field_el.children.select { |el| el.name === 'AllowNull' }[0].children.text
  80 + field_obj.validation_type = field_el.children.select { |el| el.name === 'ValidationType' }[0].children.text
  81 + field_obj.value_null = field_el.children.select { |el| el.name === 'ValueNull' }[0].children.text
83 82 end
84 83 end.compact
85 84  
86   - por.purchase_order_line_merchandise = doc.first_element_child.xpath("PurchaseOrderLine").children.select{|item| item.name === "Merchandise"}.map do |merch_el|
87   - if merch_el && merch_el.children.count > 0
88   - Syspro::BusinessObjects::Models::PorDetail::Merchandise.new.tap do |merch_obj|
89   - merch_obj.line = merch_el.children.select{|el| el.name === "Line"}[0].children.text
90   - merch_obj.line_type = merch_el.children.select{|el| el.name === "LineType"}[0].children.text
91   - merch_obj.line_Type_description = merch_el.children.select{|el| el.name === "LineTypeDescription"}[0].children.text
92   - merch_obj.m_stock_code = merch_el.children.select{|el| el.name === "MStockCode"}[0].children.text
93   - merch_obj.m_stock_des = merch_el.children.select{|el| el.name === "MStockDes"}[0].children.text
94   - merch_obj.long_desc = merch_el.children.select{|el| el.name === "LongDesc"}[0].children.text
95   - merch_obj.traceable_type = merch_el.children.select{|el| el.name === "TraceableType"}[0].children.text
96   - merch_obj.mass = merch_el.children.select{|el| el.name === "Mass"}[0].children.text
97   - merch_obj.volume = merch_el.children.select{|el| el.name === "Volume"}[0].children.text
98   - merch_obj.receipt_into_flag = merch_el.children.select{|el| el.name === "ReceiptIntoFlag"}[0].children.text
99   - merch_obj.m_warehouse = merch_el.children.select{|el| el.name === "MWarehouse"}[0].children.text
100   - merch_obj.m_warehouse_desc = merch_el.children.select{|el| el.name === "MWarehouseDesc"}[0].children.text
101   - merch_obj.m_outstanding_qty = merch_el.children.select{|el| el.name === "MOutstandingQty"}[0].children.text
102   - merch_obj.unedited__m_outstanding_qty = merch_el.children.select{|el| el.name === "Unedited_MOutstandingQty"}[0].children.text
103   - merch_obj.m_order_qty = merch_el.children.select{|el| el.name === "MOrderQty"}[0].children.text
104   - merch_obj.unedited__m_order_qty = merch_el.children.select{|el| el.name === "Unedited_MOrderQty"}[0].children.text
105   - merch_obj.m_received_qty = merch_el.children.select{|el| el.name === "MReceivedQty"}[0].children.text
106   - merch_obj.unedited__m_received_qty = merch_el.children.select{|el| el.name === "Unedited_MReceivedQty"}[0].children.text
107   - merch_obj.m_order_uom = merch_el.children.select{|el| el.name === "MOrderUom"}[0].children.text
108   - merch_obj.m_complete_flag = merch_el.children.select{|el| el.name === "MCompleteFlag"}[0].children.text
109   - merch_obj.m_job = merch_el.children.select{|el| el.name === "MJob"}[0].children.text
110   - merch_obj.include_in_mrp = merch_el.children.select{|el| el.name === "IncludeInMrp"}[0].children.text
111   - merch_obj.m_price = merch_el.children.select{|el| el.name === "MPrice"}[0].children.text
112   - merch_obj.edit_m_price = merch_el.children.select{|el| el.name === "Edit_MPrice"}[0].children.text
113   - merch_obj.order_value = merch_el.children.select{|el| el.name === "OrderValue"}[0].children.text
114   - merch_obj.m_disc_pct1 = merch_el.children.select{|el| el.name === "MDiscPct1"}[0].children.text
115   - merch_obj.m_disc_pct2 = merch_el.children.select{|el| el.name === "MDiscPct2"}[0].children.text
116   - merch_obj.m_disc_pct3 = merch_el.children.select{|el| el.name === "MDiscPct3"}[0].children.text
117   - merch_obj.m_disc_value = merch_el.children.select{|el| el.name === "MDiscValue"}[0].children.text
118   - merch_obj.m_disc_val_flag = merch_el.children.select{|el| el.name === "MDiscValFlag"}[0].children.text
119   - merch_obj.m_price_uom = merch_el.children.select{|el| el.name === "MPriceUom"}[0].children.text
120   - merch_obj.m_latest_due_date = merch_el.children.select{|el| el.name === "MLatestDueDate"}[0].children.text
121   - merch_obj.m_sup_catalogue = merch_el.children.select{|el| el.name === "MSupCatalogue"}[0].children.text
122   - merch_obj.m_product_class = merch_el.children.select{|el| el.name === "MProductClass"}[0].children.text
123   - merch_obj.m_product_class_description = merch_el.children.select{|el| el.name === "MProductClassDescription"}[0].children.text
124   - merch_obj.m_stocking_uom = merch_el.children.select{|el| el.name === "MStockingUom"}[0].children.text
125   - merch_obj.m_decimals_to_prt = merch_el.children.select{|el| el.name === "MDecimalsToPrt"}[0].children.text
126   - merch_obj.m_conv_fact_prc_um = merch_el.children.select{|el| el.name === "MConvFactPrcUm"}[0].children.text
127   - merch_obj.m_mul_div_prc = merch_el.children.select{|el| el.name === "MMulDivPrc"}[0].children.text
128   - merch_obj.m_tax_code = merch_el.children.select{|el| el.name === "MTaxCode"}[0].children.text
129   - merch_obj.m_tax_code_description = merch_el.children.select{|el| el.name === "MTaxCodeDescription"}[0].children.text
130   - merch_obj.m_conv_fact_ord_um = merch_el.children.select{|el| el.name === "MConvFactOrdUm"}[0].children.text
131   - merch_obj.m_mul_div_alloc = merch_el.children.select{|el| el.name === "MMulDivAlloc"}[0].children.text
132   - merch_obj.m_gl_code = merch_el.children.select{|el| el.name === "MGlCode"}[0].children.text
133   - merch_obj.m_gl_code_description = merch_el.children.select{|el| el.name === "MGlCodeDescription"}[0].children.text
134   - merch_obj.m_orig_due_date = merch_el.children.select{|el| el.name === "MOrigDueDate"}[0].children.text
135   - merch_obj.m_lct_confirmed = merch_el.children.select{|el| el.name === "MLctConfirmed"}[0].children.text
136   - merch_obj.m_subcontract_op = merch_el.children.select{|el| el.name === "MSubcontractOp"}[0].children.text
137   - merch_obj.m_version = merch_el.children.select{|el| el.name === "MVersion"}[0].children.text
138   - merch_obj.m_release = merch_el.children.select{|el| el.name === "MRelease"}[0].children.text
139   - merch_obj.asset_flag = merch_el.children.select{|el| el.name === "AssetFlag"}[0].children.text
140   - merch_obj.capex_code = merch_el.children.select{|el| el.name === "CapexCode"}[0].children.text
141   - merch_obj.asset_capex_line = merch_el.children.select{|el| el.name === "AssetCapexLine"}[0].children.text
142   - merch_obj.discount = merch_el.children.select{|el| el.name === "Discount"}[0].children.text
143   - merch_obj.last_receipt = merch_el.children.select{|el| el.name === "LastReceipt"}[0].children.text
144   - merch_obj.ledger = merch_el.children.select{|el| el.name === "Ledger"}[0].children.text
145   - merch_obj.requisition_line = merch_el.children.select{|el| el.name === "RequisitionLine"}[0].children.text
146   - merch_obj.requisition_no = merch_el.children.select{|el| el.name === "RequisitionNo"}[0].children.text
147   - merch_obj.requisition_user = merch_el.children.select{|el| el.name === "RequisitionUser"}[0].children.text
148   - merch_obj.reschedule = merch_el.children.select{|el| el.name === "Reschedule"}[0].children.text
149   - merch_obj.rev = merch_el.children.select{|el| el.name === "Rev"}[0].children.text
150   - merch_obj.release = merch_el.children.select{|el| el.name === "Release"}[0].children.text
151   - merch_obj.selection_code = merch_el.children.select{|el| el.name === "SelectionCode"}[0].children.text
152   - merch_obj.selection_type = merch_el.children.select{|el| el.name === "SelectionType"}[0].children.text
153   - merch_obj.currency = merch_el.children.select{|el| el.name === "Currency"}[0].children.text
154   - merch_obj.m_inspection_reqd = merch_el.children.select{|el| el.name === "MInspectionReqd"}[0].children.text
155   - merch_obj.inspected_received = merch_el.children.select{|el| el.name === "InspectedReceived"}[0].children.text
156   - merch_obj.stock_and_alt_um = merch_el.children.select{|el| el.name === "StockAndAltUm"}[0].children.text
157   - merch_obj.default_costing_method = merch_el.children.select{|el| el.name === "DefaultCostingMethod"}[0].children.text
158   - merch_obj.default_price = merch_el.children.select{|el| el.name === "DefaultPrice"}[0].children.text
159   - merch_obj.edit_default_price = merch_el.children.select{|el| el.name === "Edit_DefaultPrice"}[0].children.text
160   - merch_obj.default_prum = merch_el.children.select{|el| el.name === "DefaultPrum"}[0].children.text
161   - merch_obj.costing_methods_available = merch_el.children.select{|el| el.name === "CostingMethodsAvailable"}.map do |field_el_2|
162   - if field_el_2 && field_el_2.children.count > 0
163   - Syspro::BusinessObjects::Models::PorDetail::CostingMethodsAvailable.new.tap do |avail_obj|
164   - avail_obj.manual_method_code = field_el_2.children.select{|el_2| el_2.name === "ManualMethodCode"}[0].children.text
165   - avail_obj.manual_method_desc = field_el_2.children.select{|el_2| el_2.name === "ManualMethodDesc"}[0].children.text
166   - avail_obj.manual_method_price = field_el_2.children.select{|el_2| el_2.name === "ManualMethodPrice"}[0].children.text
167   - avail_obj.edit__manual_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_ManualMethodPrice"}[0].children.text
168   - avail_obj.manual_method_costing_prum = field_el_2.children.select{|el_2| el_2.name === "ManualMethodCostingPrum"}[0].children.text
169   - avail_obj.total_cost_method_code = field_el_2.children.select{|el_2| el_2.name === "TotalCostMethodCode"}[0].children.text
170   - avail_obj.total_cost_method_desc = field_el_2.children.select{|el_2| el_2.name === "TotalCostMethodDesc"}[0].children.text
171   - avail_obj.total_cost_method_price = field_el_2.children.select{|el_2| el_2.name === "TotalCostMethodPrice"}[0].children.text
172   - avail_obj.edit__total_cost_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_TotalCostMethodPrice"}[0].children.text
173   - avail_obj.total_cost_costing_prum = field_el_2.children.select{|el_2| el_2.name === "TotalCostCostingPrum"}[0].children.text
174   - avail_obj.purchase_price_method_code = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceMethodCode"}[0].children.text
175   - avail_obj.purchase_price_method_desc = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceMethodDesc"}[0].children.text
176   - avail_obj.purchase_price_method_price = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceMethodPrice"}[0].children.text
177   - avail_obj.edit__purchase_price_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_PurchasePriceMethodPrice"}[0].children.text
178   - avail_obj.purchase_price_costing_prum = field_el_2.children.select{|el_2| el_2.name === "PurchasePriceCostingPrum"}[0].children.text
179   - avail_obj.price_tax_method_code = field_el_2.children.select{|el_2| el_2.name === "PriceTaxMethodCode"}[0].children.text
180   - avail_obj.price_tax_method_desc = field_el_2.children.select{|el_2| el_2.name === "PriceTaxMethodDesc"}[0].children.text
181   - avail_obj.price_tax_method_price = field_el_2.children.select{|el_2| el_2.name === "PriceTaxMethodPrice"}[0].children.text
182   - avail_obj.edit__price_tax_method_price = field_el_2.children.select{|el_2| el_2.name === "Edit_PriceTaxMethodPrice"}[0].children.text
183   - avail_obj.price_tax_costing_prum = field_el_2.children.select{|el_2| el_2.name === "PriceTaxCostingPrum"}[0].children.text
184   - end
185   - end
186   - end.compact
187   - end
  85 + por.purchase_order_line_merchandise = doc.first_element_child.xpath('PurchaseOrderLine').children.select { |item| item.name === 'Merchandise' }.map do |merch_el|
  86 + next unless merch_el && merch_el.children.count > 0
  87 + Syspro::BusinessObjects::Models::PorDetail::Merchandise.new.tap do |merch_obj|
  88 + merch_obj.line = merch_el.children.select { |el| el.name === 'Line' }[0].children.text
  89 + merch_obj.line_type = merch_el.children.select { |el| el.name === 'LineType' }[0].children.text
  90 + merch_obj.line_Type_description = merch_el.children.select { |el| el.name === 'LineTypeDescription' }[0].children.text
  91 + merch_obj.m_stock_code = merch_el.children.select { |el| el.name === 'MStockCode' }[0].children.text
  92 + merch_obj.m_stock_des = merch_el.children.select { |el| el.name === 'MStockDes' }[0].children.text
  93 + merch_obj.long_desc = merch_el.children.select { |el| el.name === 'LongDesc' }[0].children.text
  94 + merch_obj.traceable_type = merch_el.children.select { |el| el.name === 'TraceableType' }[0].children.text
  95 + merch_obj.mass = merch_el.children.select { |el| el.name === 'Mass' }[0].children.text
  96 + merch_obj.volume = merch_el.children.select { |el| el.name === 'Volume' }[0].children.text
  97 + merch_obj.receipt_into_flag = merch_el.children.select { |el| el.name === 'ReceiptIntoFlag' }[0].children.text
  98 + merch_obj.m_warehouse = merch_el.children.select { |el| el.name === 'MWarehouse' }[0].children.text
  99 + merch_obj.m_warehouse_desc = merch_el.children.select { |el| el.name === 'MWarehouseDesc' }[0].children.text
  100 + merch_obj.m_outstanding_qty = merch_el.children.select { |el| el.name === 'MOutstandingQty' }[0].children.text
  101 + merch_obj.unedited__m_outstanding_qty = merch_el.children.select { |el| el.name === 'Unedited_MOutstandingQty' }[0].children.text
  102 + merch_obj.m_order_qty = merch_el.children.select { |el| el.name === 'MOrderQty' }[0].children.text
  103 + merch_obj.unedited__m_order_qty = merch_el.children.select { |el| el.name === 'Unedited_MOrderQty' }[0].children.text
  104 + merch_obj.m_received_qty = merch_el.children.select { |el| el.name === 'MReceivedQty' }[0].children.text
  105 + merch_obj.unedited__m_received_qty = merch_el.children.select { |el| el.name === 'Unedited_MReceivedQty' }[0].children.text
  106 + merch_obj.m_order_uom = merch_el.children.select { |el| el.name === 'MOrderUom' }[0].children.text
  107 + merch_obj.m_complete_flag = merch_el.children.select { |el| el.name === 'MCompleteFlag' }[0].children.text
  108 + merch_obj.m_job = merch_el.children.select { |el| el.name === 'MJob' }[0].children.text
  109 + merch_obj.include_in_mrp = merch_el.children.select { |el| el.name === 'IncludeInMrp' }[0].children.text
  110 + merch_obj.m_price = merch_el.children.select { |el| el.name === 'MPrice' }[0].children.text
  111 + merch_obj.edit_m_price = merch_el.children.select { |el| el.name === 'Edit_MPrice' }[0].children.text
  112 + merch_obj.order_value = merch_el.children.select { |el| el.name === 'OrderValue' }[0].children.text
  113 + merch_obj.m_disc_pct1 = merch_el.children.select { |el| el.name === 'MDiscPct1' }[0].children.text
  114 + merch_obj.m_disc_pct2 = merch_el.children.select { |el| el.name === 'MDiscPct2' }[0].children.text
  115 + merch_obj.m_disc_pct3 = merch_el.children.select { |el| el.name === 'MDiscPct3' }[0].children.text
  116 + merch_obj.m_disc_value = merch_el.children.select { |el| el.name === 'MDiscValue' }[0].children.text
  117 + merch_obj.m_disc_val_flag = merch_el.children.select { |el| el.name === 'MDiscValFlag' }[0].children.text
  118 + merch_obj.m_price_uom = merch_el.children.select { |el| el.name === 'MPriceUom' }[0].children.text
  119 + merch_obj.m_latest_due_date = merch_el.children.select { |el| el.name === 'MLatestDueDate' }[0].children.text
  120 + merch_obj.m_sup_catalogue = merch_el.children.select { |el| el.name === 'MSupCatalogue' }[0].children.text
  121 + merch_obj.m_product_class = merch_el.children.select { |el| el.name === 'MProductClass' }[0].children.text
  122 + merch_obj.m_product_class_description = merch_el.children.select { |el| el.name === 'MProductClassDescription' }[0].children.text
  123 + merch_obj.m_stocking_uom = merch_el.children.select { |el| el.name === 'MStockingUom' }[0].children.text
  124 + merch_obj.m_decimals_to_prt = merch_el.children.select { |el| el.name === 'MDecimalsToPrt' }[0].children.text
  125 + merch_obj.m_conv_fact_prc_um = merch_el.children.select { |el| el.name === 'MConvFactPrcUm' }[0].children.text
  126 + merch_obj.m_mul_div_prc = merch_el.children.select { |el| el.name === 'MMulDivPrc' }[0].children.text
  127 + merch_obj.m_tax_code = merch_el.children.select { |el| el.name === 'MTaxCode' }[0].children.text
  128 + merch_obj.m_tax_code_description = merch_el.children.select { |el| el.name === 'MTaxCodeDescription' }[0].children.text
  129 + merch_obj.m_conv_fact_ord_um = merch_el.children.select { |el| el.name === 'MConvFactOrdUm' }[0].children.text
  130 + merch_obj.m_mul_div_alloc = merch_el.children.select { |el| el.name === 'MMulDivAlloc' }[0].children.text
  131 + merch_obj.m_gl_code = merch_el.children.select { |el| el.name === 'MGlCode' }[0].children.text
  132 + merch_obj.m_gl_code_description = merch_el.children.select { |el| el.name === 'MGlCodeDescription' }[0].children.text
  133 + merch_obj.m_orig_due_date = merch_el.children.select { |el| el.name === 'MOrigDueDate' }[0].children.text
  134 + merch_obj.m_lct_confirmed = merch_el.children.select { |el| el.name === 'MLctConfirmed' }[0].children.text
  135 + merch_obj.m_subcontract_op = merch_el.children.select { |el| el.name === 'MSubcontractOp' }[0].children.text
  136 + merch_obj.m_version = merch_el.children.select { |el| el.name === 'MVersion' }[0].children.text
  137 + merch_obj.m_release = merch_el.children.select { |el| el.name === 'MRelease' }[0].children.text
  138 + merch_obj.asset_flag = merch_el.children.select { |el| el.name === 'AssetFlag' }[0].children.text
  139 + merch_obj.capex_code = merch_el.children.select { |el| el.name === 'CapexCode' }[0].children.text
  140 + merch_obj.asset_capex_line = merch_el.children.select { |el| el.name === 'AssetCapexLine' }[0].children.text
  141 + merch_obj.discount = merch_el.children.select { |el| el.name === 'Discount' }[0].children.text
  142 + merch_obj.last_receipt = merch_el.children.select { |el| el.name === 'LastReceipt' }[0].children.text
  143 + merch_obj.ledger = merch_el.children.select { |el| el.name === 'Ledger' }[0].children.text
  144 + merch_obj.requisition_line = merch_el.children.select { |el| el.name === 'RequisitionLine' }[0].children.text
  145 + merch_obj.requisition_no = merch_el.children.select { |el| el.name === 'RequisitionNo' }[0].children.text
  146 + merch_obj.requisition_user = merch_el.children.select { |el| el.name === 'RequisitionUser' }[0].children.text
  147 + merch_obj.reschedule = merch_el.children.select { |el| el.name === 'Reschedule' }[0].children.text
  148 + merch_obj.rev = merch_el.children.select { |el| el.name === 'Rev' }[0].children.text
  149 + merch_obj.release = merch_el.children.select { |el| el.name === 'Release' }[0].children.text
  150 + merch_obj.selection_code = merch_el.children.select { |el| el.name === 'SelectionCode' }[0].children.text
  151 + merch_obj.selection_type = merch_el.children.select { |el| el.name === 'SelectionType' }[0].children.text
  152 + merch_obj.currency = merch_el.children.select { |el| el.name === 'Currency' }[0].children.text
  153 + merch_obj.m_inspection_reqd = merch_el.children.select { |el| el.name === 'MInspectionReqd' }[0].children.text
  154 + merch_obj.inspected_received = merch_el.children.select { |el| el.name === 'InspectedReceived' }[0].children.text
  155 + merch_obj.stock_and_alt_um = merch_el.children.select { |el| el.name === 'StockAndAltUm' }[0].children.text
  156 + merch_obj.default_costing_method = merch_el.children.select { |el| el.name === 'DefaultCostingMethod' }[0].children.text
  157 + merch_obj.default_price = merch_el.children.select { |el| el.name === 'DefaultPrice' }[0].children.text
  158 + merch_obj.edit_default_price = merch_el.children.select { |el| el.name === 'Edit_DefaultPrice' }[0].children.text
  159 + merch_obj.default_prum = merch_el.children.select { |el| el.name === 'DefaultPrum' }[0].children.text
  160 + merch_obj.costing_methods_available = merch_el.children.select { |el| el.name === 'CostingMethodsAvailable' }.map do |field_el_2|
  161 + next unless field_el_2 && field_el_2.children.count > 0
  162 + Syspro::BusinessObjects::Models::PorDetail::CostingMethodsAvailable.new.tap do |avail_obj|
  163 + avail_obj.manual_method_code = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodCode' }[0].children.text
  164 + avail_obj.manual_method_desc = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodDesc' }[0].children.text
  165 + avail_obj.manual_method_price = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodPrice' }[0].children.text
  166 + avail_obj.edit__manual_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_ManualMethodPrice' }[0].children.text
  167 + avail_obj.manual_method_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'ManualMethodCostingPrum' }[0].children.text
  168 + avail_obj.total_cost_method_code = field_el_2.children.select { |el_2| el_2.name === 'TotalCostMethodCode' }[0].children.text
  169 + avail_obj.total_cost_method_desc = field_el_2.children.select { |el_2| el_2.name === 'TotalCostMethodDesc' }[0].children.text
  170 + avail_obj.total_cost_method_price = field_el_2.children.select { |el_2| el_2.name === 'TotalCostMethodPrice' }[0].children.text
  171 + avail_obj.edit__total_cost_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_TotalCostMethodPrice' }[0].children.text
  172 + avail_obj.total_cost_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'TotalCostCostingPrum' }[0].children.text
  173 + avail_obj.purchase_price_method_code = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceMethodCode' }[0].children.text
  174 + avail_obj.purchase_price_method_desc = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceMethodDesc' }[0].children.text
  175 + avail_obj.purchase_price_method_price = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceMethodPrice' }[0].children.text
  176 + avail_obj.edit__purchase_price_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_PurchasePriceMethodPrice' }[0].children.text
  177 + avail_obj.purchase_price_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'PurchasePriceCostingPrum' }[0].children.text
  178 + avail_obj.price_tax_method_code = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxMethodCode' }[0].children.text
  179 + avail_obj.price_tax_method_desc = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxMethodDesc' }[0].children.text
  180 + avail_obj.price_tax_method_price = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxMethodPrice' }[0].children.text
  181 + avail_obj.edit__price_tax_method_price = field_el_2.children.select { |el_2| el_2.name === 'Edit_PriceTaxMethodPrice' }[0].children.text
  182 + avail_obj.price_tax_costing_prum = field_el_2.children.select { |el_2| el_2.name === 'PriceTaxCostingPrum' }[0].children.text
  183 + end
  184 + end.compact
188 185 end
189 186 end.compact
190 187  
191   - por.purchase_order_totals = doc.first_element_child.xpath("PurchaseOrderTotals").map do |total_el|
  188 + por.purchase_order_totals = doc.first_element_child.xpath('PurchaseOrderTotals').map do |total_el|
192 189 Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotals.new.tap do |total_obj|
193   -
194   - total_obj.local_values = total_el.children.select{|el| el.name === "LocalValues"}.map do |loc_val_el|
  190 + total_obj.local_values = total_el.children.select { |el| el.name === 'LocalValues' }.map do |loc_val_el|
195 191 Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotalsLocalValues.new.tap do |loc_obj|
196   - loc_obj.local_order_value = loc_val_el.children.select{|el_2| el_2.name === "LocalOrderValue"}[0].text
197   - loc_obj.local_received_to_date_value = loc_val_el.children.select{|el_2| el_2.name === "LocalReceivedToDateValue"}[0].text
198   - loc_obj.local_outstanding_value = loc_val_el.children.select{|el_2| el_2.name === "LocalOutstandingValue"}[0].text
199   - loc_obj.edited_local_order_value = loc_val_el.children.select{|el_2| el_2.name === "Edited_LocalOrderValue"}[0].text
200   - loc_obj.edited_local_received_to_date_value = loc_val_el.children.select{|el_2| el_2.name === "Edited_LocalReceivedToDateValue"}[0].text
201   - loc_obj.edited_local_outstanding_value = loc_val_el.children.select{|el_2| el_2.name === "Edited_LocalOutstandingValue"}[0].text
  192 + loc_obj.local_order_value = loc_val_el.children.select { |el_2| el_2.name === 'LocalOrderValue' }[0].text
  193 + loc_obj.local_received_to_date_value = loc_val_el.children.select { |el_2| el_2.name === 'LocalReceivedToDateValue' }[0].text
  194 + loc_obj.local_outstanding_value = loc_val_el.children.select { |el_2| el_2.name === 'LocalOutstandingValue' }[0].text
  195 + loc_obj.edited_local_order_value = loc_val_el.children.select { |el_2| el_2.name === 'Edited_LocalOrderValue' }[0].text
  196 + loc_obj.edited_local_received_to_date_value = loc_val_el.children.select { |el_2| el_2.name === 'Edited_LocalReceivedToDateValue' }[0].text
  197 + loc_obj.edited_local_outstanding_value = loc_val_el.children.select { |el_2| el_2.name === 'Edited_LocalOutstandingValue' }[0].text
202 198 end
203 199 end
204 200  
205   - total_obj.current_values = total_el.children.select{|el| el.name === "CurrentValues"}.map do |cur_val_el|
  201 + total_obj.current_values = total_el.children.select { |el| el.name === 'CurrentValues' }.map do |cur_val_el|
206 202 Syspro::BusinessObjects::Models::PorDetail::PurchaseOrderTotalsCurrentValues.new.tap do |cur_obj|
207   - cur_obj.current_order_value = cur_val_el.children.select{|el_2| el_2.name === "CurrentOrderValue"}[0].text
208   - cur_obj.current_received_to_date_value = cur_val_el.children.select{|el_2| el_2.name === "CurrentReceivedToDateValue"}[0].text
209   - cur_obj.current_outstanding_value = cur_val_el.children.select{|el_2| el_2.name === "CurrentOutstandingValue"}[0].text
210   - cur_obj.edited_current_order_value = cur_val_el.children.select{|el_2| el_2.name === "Edited_CurrentOrderValue"}[0].text
211   - cur_obj.edited_current_received_to_date_value = cur_val_el.children.select{|el_2| el_2.name === "Edited_CurrentReceivedToDateValue"}[0].text
212   - cur_obj.edited_current_outstanding_value = cur_val_el.children.select{|el_2| el_2.name === "Edited_CurrentOutstandingValue"}[0].text
  203 + cur_obj.current_order_value = cur_val_el.children.select { |el_2| el_2.name === 'CurrentOrderValue' }[0].text
  204 + cur_obj.current_received_to_date_value = cur_val_el.children.select { |el_2| el_2.name === 'CurrentReceivedToDateValue' }[0].text
  205 + cur_obj.current_outstanding_value = cur_val_el.children.select { |el_2| el_2.name === 'CurrentOutstandingValue' }[0].text
  206 + cur_obj.edited_current_order_value = cur_val_el.children.select { |el_2| el_2.name === 'Edited_CurrentOrderValue' }[0].text
  207 + cur_obj.edited_current_received_to_date_value = cur_val_el.children.select { |el_2| el_2.name === 'Edited_CurrentReceivedToDateValue' }[0].text
  208 + cur_obj.edited_current_outstanding_value = cur_val_el.children.select { |el_2| el_2.name === 'Edited_CurrentOutstandingValue' }[0].text
213 209 end
214 210 end
215 211  
216   - total_obj.first_receipt_date = total_el.children.select{|el| el.name === "FirstReceiptDate"}[0].text
217   - total_obj.order_complete_date = total_el.children.select{|el| el.name === "OrderCompleteDate"}[0].text
  212 + total_obj.first_receipt_date = total_el.children.select { |el| el.name === 'FirstReceiptDate' }[0].text
  213 + total_obj.order_complete_date = total_el.children.select { |el| el.name === 'OrderCompleteDate' }[0].text
218 214 end
219 215 end.compact
220 216  
... ...
lib/syspro/business_objects/parsers/portii_parser.rb
... ... @@ -12,10 +12,10 @@ module Syspro
12 12  
13 13 def parse
14 14 {
15   - error_numbers: doc.xpath("//ErrorNumber").map{|e| e.text},
16   - grn_numbers: doc.xpath("//Item/Key/GRNNumber").map{|e| e.text},
17   - items_processed: doc.xpath("//StatusOfItems/ItemsProcessed").first.text,
18   - items_invalid: doc.xpath("//StatusOfItems/ItemsInvalid").first.text
  15 + error_numbers: doc.xpath('//ErrorNumber').map(&:text),
  16 + grn_numbers: doc.xpath('//Item/Key/GRNNumber').map(&:text),
  17 + items_processed: doc.xpath('//StatusOfItems/ItemsProcessed').first.text,
  18 + items_invalid: doc.xpath('//StatusOfItems/ItemsInvalid').first.text
19 19 }
20 20 end
21 21  
... ... @@ -24,4 +24,3 @@ module Syspro
24 24 end
25 25 end
26 26 end
27   -
... ...
lib/syspro/business_objects/parsers/portoi_parser.rb
... ... @@ -11,15 +11,15 @@ module Syspro
11 11 end
12 12  
13 13 def parse
14   - po = Syspro::BusinessObjects::Models::PurchaseOrder.new()
15   -
16   - po.error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text}
  14 + po = Syspro::BusinessObjects::Models::PurchaseOrder.new
  15 +
  16 + po.error_numbers = doc.xpath('//ErrorNumber').map(&:text)
17 17  
18 18 po.purchase_order = doc.first_element_child.xpath('Order/Key/PurchaseOrder').text
19 19 po.item_number = doc.first_element_child.xpath('Order/ItemNumber').text
20 20 po.order_action_type = doc.first_element_child.xpath('Order/OrderActionType').text
21 21 po.supplier = doc.first_element_child.xpath('Order/Supplier').text
22   -
  22 +
23 23 po
24 24 end
25 25  
... ... @@ -28,4 +28,3 @@ module Syspro
28 28 end
29 29 end
30 30 end
31   -
... ...
lib/syspro/business_objects/parsers/portor_parser.rb
... ... @@ -11,8 +11,8 @@ module Syspro
11 11 end
12 12  
13 13 def parse
14   - error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text}
15   -
  14 + error_numbers = doc.xpath('//ErrorNumber').map(&:text)
  15 +
16 16 gl_journal = doc.first_element_child.xpath('GlJournal')
17 17 gl_journal_obj = gl_journal.children.map do |el|
18 18 next if el.name == 'text'
... ... @@ -29,12 +29,12 @@ module Syspro
29 29 key[:entry_number] = doc.first_element_child.xpath('EntryNumber')
30 30 key[:warehouse] = doc.first_element_child.xpath('Warehouse')
31 31 key[:gl_journal] = gl_journal_obj
32   -
  32 +
33 33 receipts = doc.first_element_child.xpath('Receipt')
34 34 receipts_obj = receipts.flat_map do |el|
35 35 el.elements.map do |inner|
36 36 [inner.name,
37   - inner.value]
  37 + inner.value]
38 38 end
39 39 end.compact.to_h
40 40  
... ... @@ -47,8 +47,8 @@ module Syspro
47 47 )
48 48 end
49 49  
50   - grns = doc.xpath("//Grn").map{|e| e.text}
51   -
  50 + grns = doc.xpath('//Grn').map(&:text)
  51 +
52 52 {
53 53 error_numbers: error_numbers,
54 54 key: key,
... ... @@ -60,4 +60,3 @@ module Syspro
60 60 end
61 61 end
62 62 end
63   -
... ...
lib/syspro/business_objects/parsers/sorqry_parser.rb
... ... @@ -12,115 +12,115 @@ module Syspro
12 12 end
13 13  
14 14 def parse
15   - sor = Syspro::BusinessObjects::Models::SorDetail.new()
16   - sor.sales_order = doc.first_element_child.xpath("SalesOrder").text
17   - sor.document_type = doc.first_element_child.xpath("DocumentType").text
18   - sor.document_type_desc = doc.first_element_child.xpath("DocumentTypeDesc").text
19   - sor.inter_branch_transfer = doc.first_element_child.xpath("InterBranchTransfer").text
20   - sor.inter_wh_sale = doc.first_element_child.xpath("InterWhSale").text
21   - sor.source_warehouse = doc.first_element_child.xpath("SourceWarehouse").text
22   - sor.target_warehouse = doc.first_element_child.xpath("TargetWarehouse").text
23   - sor.gtr_reference = doc.first_element_child.xpath("GtrReference").text
24   - sor.customer = doc.first_element_child.xpath("Customer").text
25   - sor.customer_name = doc.first_element_child.xpath("CustomerName").text
26   - sor.tax_status_code = doc.first_element_child.xpath("TaxStatusCode").text
27   - sor.tax_status = doc.first_element_child.xpath("TaxStatus").text
28   - sor.gst_tax_status_code = doc.first_element_child.xpath("GstTaxStatusCode").text
29   - sor.gst_tax_status = doc.first_element_child.xpath("GstTaxStatus").text
30   - sor.eu_flag = doc.first_element_child.xpath("EuFlag").text
31   - sor.eu_flag_desc = doc.first_element_child.xpath("EuFlagDesc").text
32   - sor.sold_to_name = doc.first_element_child.xpath("SoldToName").text
33   - sor.sold_addr_1 = doc.first_element_child.xpath("SoldAddr1").text
34   - sor.sold_addr_2 = doc.first_element_child.xpath("SoldAddr2").text
35   - sor.sold_addr_3 = doc.first_element_child.xpath("SoldAddr3").text
36   - sor.sold_addr_3_locality = doc.first_element_child.xpath("SoldAddr3Locality").text
37   - sor.sold_addr_4 = doc.first_element_child.xpath("SoldAddr4").text
38   - sor.sold_addr_5 = doc.first_element_child.xpath("SoldAddr5").text
39   - sor.sold_postal_code = doc.first_element_child.xpath("SoldPostalCode").text
40   - sor.sold_gps_lat = doc.first_element_child.xpath("SoldGpsLat").text
41   - sor.sold_gps_long = doc.first_element_child.xpath("SoldGpsLong").text
42   - sor.salesperson = doc.first_element_child.xpath("Salesperson").text
43   - sor.scheduled_ord_flag = doc.first_element_child.xpath("ScheduledOrdFlag").text
44   - sor.disc_pct_1 = doc.first_element_child.xpath("DiscPct1").text
45   - sor.disc_pct_2 = doc.first_element_child.xpath("DiscPct2").text
46   - sor.disc_pct_3 = doc.first_element_child.xpath("DiscPct3").text
  15 + sor = Syspro::BusinessObjects::Models::SorDetail.new
  16 + sor.sales_order = doc.first_element_child.xpath('SalesOrder').text
  17 + sor.document_type = doc.first_element_child.xpath('DocumentType').text
  18 + sor.document_type_desc = doc.first_element_child.xpath('DocumentTypeDesc').text
  19 + sor.inter_branch_transfer = doc.first_element_child.xpath('InterBranchTransfer').text
  20 + sor.inter_wh_sale = doc.first_element_child.xpath('InterWhSale').text
  21 + sor.source_warehouse = doc.first_element_child.xpath('SourceWarehouse').text
  22 + sor.target_warehouse = doc.first_element_child.xpath('TargetWarehouse').text
  23 + sor.gtr_reference = doc.first_element_child.xpath('GtrReference').text
  24 + sor.customer = doc.first_element_child.xpath('Customer').text
  25 + sor.customer_name = doc.first_element_child.xpath('CustomerName').text
  26 + sor.tax_status_code = doc.first_element_child.xpath('TaxStatusCode').text
  27 + sor.tax_status = doc.first_element_child.xpath('TaxStatus').text
  28 + sor.gst_tax_status_code = doc.first_element_child.xpath('GstTaxStatusCode').text
  29 + sor.gst_tax_status = doc.first_element_child.xpath('GstTaxStatus').text
  30 + sor.eu_flag = doc.first_element_child.xpath('EuFlag').text
  31 + sor.eu_flag_desc = doc.first_element_child.xpath('EuFlagDesc').text
  32 + sor.sold_to_name = doc.first_element_child.xpath('SoldToName').text
  33 + sor.sold_addr_1 = doc.first_element_child.xpath('SoldAddr1').text
  34 + sor.sold_addr_2 = doc.first_element_child.xpath('SoldAddr2').text
  35 + sor.sold_addr_3 = doc.first_element_child.xpath('SoldAddr3').text
  36 + sor.sold_addr_3_locality = doc.first_element_child.xpath('SoldAddr3Locality').text
  37 + sor.sold_addr_4 = doc.first_element_child.xpath('SoldAddr4').text
  38 + sor.sold_addr_5 = doc.first_element_child.xpath('SoldAddr5').text
  39 + sor.sold_postal_code = doc.first_element_child.xpath('SoldPostalCode').text
  40 + sor.sold_gps_lat = doc.first_element_child.xpath('SoldGpsLat').text
  41 + sor.sold_gps_long = doc.first_element_child.xpath('SoldGpsLong').text
  42 + sor.salesperson = doc.first_element_child.xpath('Salesperson').text
  43 + sor.scheduled_ord_flag = doc.first_element_child.xpath('ScheduledOrdFlag').text
  44 + sor.disc_pct_1 = doc.first_element_child.xpath('DiscPct1').text
  45 + sor.disc_pct_2 = doc.first_element_child.xpath('DiscPct2').text
  46 + sor.disc_pct_3 = doc.first_element_child.xpath('DiscPct3').text
47 47 sor.salsls_name = doc.first_element_child.at_xpath('//SALSLS:Name').children.text
48   - sor.order_status = doc.first_element_child.xpath("OrderStatus").text
49   - sor.order_status_desc = doc.first_element_child.xpath("OrderStatusDesc").text
50   - sor.customer_po_number = doc.first_element_child.xpath("CustomerPoNumber").text
51   - sor.order_date = doc.first_element_child.xpath("OrderDate").text
52   - sor.git_reference = doc.first_element_child.xpath("GITReference").text
53   - sor.req_ship_date = doc.first_element_child.xpath("ReqShipDate").text
54   - sor.shipping_instrs = doc.first_element_child.xpath("ShippingInstrs").text
55   - sor.shipping_instrs_cod = doc.first_element_child.xpath("ShippingInstrsCod").text
56   - sor.special_instrs = doc.first_element_child.xpath("SpecialInstrs").text
57   - sor.inv_terms_override = doc.first_element_child.xpath("InvTermsOverride").text
58   - sor.delivery_note = doc.first_element_child.xpath("DeliveryNote").text
59   - sor.last_del_note = doc.first_element_child.xpath("LastDelNote").text
60   - sor.time_del_prted_hh = doc.first_element_child.xpath("TimeDelPrtedHh").text
61   - sor.time_del_prted_mm = doc.first_element_child.xpath("TimeDelPrtedMm").text
62   - sor.last_invoice = doc.first_element_child.xpath("LastInvoice").text
63   - sor.date_last_inv_prt = doc.first_element_child.xpath("DateLastInvPrt").text
64   - sor.time_inv_prt_hh = doc.first_element_child.xpath("TimeInvPrtHh").text
65   - sor.time_inv_prt_mm = doc.first_element_child.xpath("TimeInvPrtMm").text
66   - sor.tblart_description = doc.first_element_child.xpath("//TBLART:Description").children.text
67   - sor.branch = doc.first_element_child.xpath("Branch").text
68   - sor.salbrn_description = doc.first_element_child.xpath("//SALBRN:Description").children.text
69   - sor.ent_invoice = doc.first_element_child.xpath("EntInvoice").text
70   - sor.order_type = doc.first_element_child.xpath("OrderType").text
71   - sor.area = doc.first_element_child.xpath("Area").text
72   - sor.salare_description = doc.first_element_child.xpath("//SALARE:Description").children.text
73   - sor.tax_exempt_number = doc.first_element_child.xpath("TaxExemptNumber").text
74   - sor.gst_exempt_number = doc.first_element_child.xpath("GstExemptNumber").text
75   - sor.currency = doc.first_element_child.xpath("Currency").text
76   - sor.tblcur_description = doc.first_element_child.xpath("//TBLCUR:Description").children.text
77   - sor.ship_address_1 = doc.first_element_child.xpath("ShipAddress1").text
78   - sor.ship_address_2 = doc.first_element_child.xpath("ShipAddress2").text
79   - sor.ship_address_3 = doc.first_element_child.xpath("ShipAddress3").text
80   - sor.ship_address_3_locality = doc.first_element_child.xpath("ShipAddress3Locality").text
81   - sor.ship_address_4 = doc.first_element_child.xpath("ShipAddress4").text
82   - sor.ship_address_5 = doc.first_element_child.xpath("ShipAddress5").text
83   - sor.ship_postal_code = doc.first_element_child.xpath("ShipPostalCode").text
84   - sor.ship_gps_lat = doc.first_element_child.xpath("ShipGpsLat").text
85   - sor.ship_gps_long = doc.first_element_child.xpath("ShipGpsLong").text
86   - sor.ship_complete = doc.first_element_child.xpath("ShipComplete").text
87   - sor.email = doc.first_element_child.xpath("Email").text
88   - sor.fix_exchange_rate = doc.first_element_child.xpath("FixExchangeRate").text
89   - sor.exchange_rate = doc.first_element_child.xpath("ExchangeRate").text
90   - sor.edited_exchange_rate = doc.first_element_child.xpath("EditedExchangeRate").text
91   - sor.mul_div = doc.first_element_child.xpath("MulDiv").text
92   - sor.consolidated_order = doc.first_element_child.xpath("ConsolidatedOrder").text
93   - sor.gst_deduction = doc.first_element_child.xpath("GstDeduction").text
94   - sor.credited_inv_date = doc.first_element_child.xpath("CreditedInvDate").text
95   - sor.job = doc.first_element_child.xpath("Job").text
96   - sor.serialized_flag = doc.first_element_child.xpath("SerializedFlag").text
97   - sor.counter_sales_flag = doc.first_element_child.xpath("CounterSalesFlag").text
98   - sor.nationality = doc.first_element_child.xpath("Nationality").text
99   - sor.delivery_terms = doc.first_element_child.xpath("DeliveryTerms").text
100   - sor.shipping_location = doc.first_element_child.xpath("ShippingLocation").text
101   - sor.transaction_nature = doc.first_element_child.xpath("TransactionNature").text
102   - sor.transport_mode = doc.first_element_child.xpath("TransportMode").text
103   - sor.process_flag = doc.first_element_child.xpath("ProcessFlag").text
104   - sor.jobs_exist_flag = doc.first_element_child.xpath("JobsExistFlag").text
105   - sor.alternate_key = doc.first_element_child.xpath("AlternateKey").text
106   - sor.hierarchy_flag = doc.first_element_child.xpath("HierarchyFlag").text
107   - sor.deposit_flag = doc.first_element_child.xpath("DepositFlag").text
108   - sor.edi_source = doc.first_element_child.xpath("EdiSource").text
109   - sor.mult_ship_code = doc.first_element_child.xpath("MultShipCode").text
110   - sor.company_tax_no = doc.first_element_child.xpath("CompanyTaxNo").text
111   - sor.last_operator = doc.first_element_child.xpath("LastOperator").text
112   - sor.operator = doc.first_element_child.xpath("Operator").text
113   - sor.state = doc.first_element_child.xpath("State").text
114   - sor.county_zip = doc.first_element_child.xpath("CountyZip").text
115   - sor.extended_tax_code = doc.first_element_child.xpath("ExtendedTaxCode").text
116   - sor.web_created = doc.first_element_child.xpath("WebCreated").text
117   - sor.quote = doc.first_element_child.xpath("Quote").text
118   - sor.dispatches_made = doc.first_element_child.xpath("DispatchesMade").text
119   - sor.live_disp_exist = doc.first_element_child.xpath("LiveDispExist").text
120   - sor.num_dispatches = doc.first_element_child.xpath("NumDispatches").text
121   - sor.include_in_mrp = doc.first_element_child.xpath("IncludeInMrp").text
122   - sor.header_text = doc.first_element_child.xpath("HeaderText").text
123   - sor.header_notes = doc.first_element_child.xpath("HeaderNotes").text
  48 + sor.order_status = doc.first_element_child.xpath('OrderStatus').text
  49 + sor.order_status_desc = doc.first_element_child.xpath('OrderStatusDesc').text
  50 + sor.customer_po_number = doc.first_element_child.xpath('CustomerPoNumber').text
  51 + sor.order_date = doc.first_element_child.xpath('OrderDate').text
  52 + sor.git_reference = doc.first_element_child.xpath('GITReference').text
  53 + sor.req_ship_date = doc.first_element_child.xpath('ReqShipDate').text
  54 + sor.shipping_instrs = doc.first_element_child.xpath('ShippingInstrs').text
  55 + sor.shipping_instrs_cod = doc.first_element_child.xpath('ShippingInstrsCod').text
  56 + sor.special_instrs = doc.first_element_child.xpath('SpecialInstrs').text
  57 + sor.inv_terms_override = doc.first_element_child.xpath('InvTermsOverride').text
  58 + sor.delivery_note = doc.first_element_child.xpath('DeliveryNote').text
  59 + sor.last_del_note = doc.first_element_child.xpath('LastDelNote').text
  60 + sor.time_del_prted_hh = doc.first_element_child.xpath('TimeDelPrtedHh').text
  61 + sor.time_del_prted_mm = doc.first_element_child.xpath('TimeDelPrtedMm').text
  62 + sor.last_invoice = doc.first_element_child.xpath('LastInvoice').text
  63 + sor.date_last_inv_prt = doc.first_element_child.xpath('DateLastInvPrt').text
  64 + sor.time_inv_prt_hh = doc.first_element_child.xpath('TimeInvPrtHh').text
  65 + sor.time_inv_prt_mm = doc.first_element_child.xpath('TimeInvPrtMm').text
  66 + sor.tblart_description = doc.first_element_child.xpath('//TBLART:Description').children.text
  67 + sor.branch = doc.first_element_child.xpath('Branch').text
  68 + sor.salbrn_description = doc.first_element_child.xpath('//SALBRN:Description').children.text
  69 + sor.ent_invoice = doc.first_element_child.xpath('EntInvoice').text
  70 + sor.order_type = doc.first_element_child.xpath('OrderType').text
  71 + sor.area = doc.first_element_child.xpath('Area').text
  72 + sor.salare_description = doc.first_element_child.xpath('//SALARE:Description').children.text
  73 + sor.tax_exempt_number = doc.first_element_child.xpath('TaxExemptNumber').text
  74 + sor.gst_exempt_number = doc.first_element_child.xpath('GstExemptNumber').text
  75 + sor.currency = doc.first_element_child.xpath('Currency').text
  76 + sor.tblcur_description = doc.first_element_child.xpath('//TBLCUR:Description').children.text
  77 + sor.ship_address_1 = doc.first_element_child.xpath('ShipAddress1').text
  78 + sor.ship_address_2 = doc.first_element_child.xpath('ShipAddress2').text
  79 + sor.ship_address_3 = doc.first_element_child.xpath('ShipAddress3').text
  80 + sor.ship_address_3_locality = doc.first_element_child.xpath('ShipAddress3Locality').text
  81 + sor.ship_address_4 = doc.first_element_child.xpath('ShipAddress4').text
  82 + sor.ship_address_5 = doc.first_element_child.xpath('ShipAddress5').text
  83 + sor.ship_postal_code = doc.first_element_child.xpath('ShipPostalCode').text
  84 + sor.ship_gps_lat = doc.first_element_child.xpath('ShipGpsLat').text
  85 + sor.ship_gps_long = doc.first_element_child.xpath('ShipGpsLong').text
  86 + sor.ship_complete = doc.first_element_child.xpath('ShipComplete').text
  87 + sor.email = doc.first_element_child.xpath('Email').text
  88 + sor.fix_exchange_rate = doc.first_element_child.xpath('FixExchangeRate').text
  89 + sor.exchange_rate = doc.first_element_child.xpath('ExchangeRate').text
  90 + sor.edited_exchange_rate = doc.first_element_child.xpath('EditedExchangeRate').text
  91 + sor.mul_div = doc.first_element_child.xpath('MulDiv').text
  92 + sor.consolidated_order = doc.first_element_child.xpath('ConsolidatedOrder').text
  93 + sor.gst_deduction = doc.first_element_child.xpath('GstDeduction').text
  94 + sor.credited_inv_date = doc.first_element_child.xpath('CreditedInvDate').text
  95 + sor.job = doc.first_element_child.xpath('Job').text
  96 + sor.serialized_flag = doc.first_element_child.xpath('SerializedFlag').text
  97 + sor.counter_sales_flag = doc.first_element_child.xpath('CounterSalesFlag').text
  98 + sor.nationality = doc.first_element_child.xpath('Nationality').text
  99 + sor.delivery_terms = doc.first_element_child.xpath('DeliveryTerms').text
  100 + sor.shipping_location = doc.first_element_child.xpath('ShippingLocation').text
  101 + sor.transaction_nature = doc.first_element_child.xpath('TransactionNature').text
  102 + sor.transport_mode = doc.first_element_child.xpath('TransportMode').text
  103 + sor.process_flag = doc.first_element_child.xpath('ProcessFlag').text
  104 + sor.jobs_exist_flag = doc.first_element_child.xpath('JobsExistFlag').text
  105 + sor.alternate_key = doc.first_element_child.xpath('AlternateKey').text
  106 + sor.hierarchy_flag = doc.first_element_child.xpath('HierarchyFlag').text
  107 + sor.deposit_flag = doc.first_element_child.xpath('DepositFlag').text
  108 + sor.edi_source = doc.first_element_child.xpath('EdiSource').text
  109 + sor.mult_ship_code = doc.first_element_child.xpath('MultShipCode').text
  110 + sor.company_tax_no = doc.first_element_child.xpath('CompanyTaxNo').text
  111 + sor.last_operator = doc.first_element_child.xpath('LastOperator').text
  112 + sor.operator = doc.first_element_child.xpath('Operator').text
  113 + sor.state = doc.first_element_child.xpath('State').text
  114 + sor.county_zip = doc.first_element_child.xpath('CountyZip').text
  115 + sor.extended_tax_code = doc.first_element_child.xpath('ExtendedTaxCode').text
  116 + sor.web_created = doc.first_element_child.xpath('WebCreated').text
  117 + sor.quote = doc.first_element_child.xpath('Quote').text
  118 + sor.dispatches_made = doc.first_element_child.xpath('DispatchesMade').text
  119 + sor.live_disp_exist = doc.first_element_child.xpath('LiveDispExist').text
  120 + sor.num_dispatches = doc.first_element_child.xpath('NumDispatches').text
  121 + sor.include_in_mrp = doc.first_element_child.xpath('IncludeInMrp').text
  122 + sor.header_text = doc.first_element_child.xpath('HeaderText').text
  123 + sor.header_notes = doc.first_element_child.xpath('HeaderNotes').text
124 124  
125 125 # Inner Nested Structure Parsing
126 126 sor.commissions = parse_commissions(doc)
... ... @@ -131,27 +131,25 @@ module Syspro
131 131 end
132 132  
133 133 def parse_commissions(doc)
134   - commissions = doc.first_element_child.xpath("Commissions")
  134 + commissions = doc.first_element_child.xpath('Commissions')
135 135 commissions_obj = parse_children_elements(commissions)
136 136  
137 137 commissions_obj
138 138 end
139 139  
140   -
141 140 def parse_sales_order_lines(doc)
142   - sales_order_lines = doc.first_element_child.xpath("SalesOrderLine")
  141 + sales_order_lines = doc.first_element_child.xpath('SalesOrderLine')
143 142 sales_order_lines_obj = {}
144 143  
145   -
146 144 sales_order_lines.children.each do |el|
147   - next if el.name == "text"
  145 + next if el.name == 'text'
148 146  
149 147 serial_obj = {}
150 148 bin_obj = {}
151 149 attached_items_obj = {}
152 150 lot_obj = {}
153 151  
154   - if el.name == "MiscCharge"
  152 + if el.name == 'MiscCharge'
155 153 unless sales_order_lines_obj[:misc_charge]
156 154 sales_order_lines_obj[:misc_charge] = []
157 155 end
... ... @@ -160,7 +158,7 @@ module Syspro
160 158 sales_order_lines_obj[:misc_charge].push(misc_charge_arr)
161 159 end
162 160  
163   - if el.name == "Freight"
  161 + if el.name == 'Freight'
164 162 unless sales_order_lines_obj[:freight]
165 163 sales_order_lines_obj[:freight] = []
166 164 end
... ... @@ -169,7 +167,7 @@ module Syspro
169 167 sales_order_lines_obj[:freight].push(freight_arr)
170 168 end
171 169  
172   - if el.name == "CommentLine"
  170 + if el.name == 'CommentLine'
173 171 unless sales_order_lines_obj[:comment_line]
174 172 sales_order_lines_obj[:comment_line] = []
175 173 end
... ... @@ -178,118 +176,109 @@ module Syspro
178 176 sales_order_lines_obj[:comment_line].push(comment_line_arr)
179 177 end
180 178  
181   - if el.name == "Merchandise"
182   - unless sales_order_lines_obj[:merchandise]
183   - sales_order_lines_obj[:merchandise] = []
  179 + next unless el.name == 'Merchandise'
  180 + unless sales_order_lines_obj[:merchandise]
  181 + sales_order_lines_obj[:merchandise] = []
  182 + end
  183 +
  184 + merchandise_arr = el.children.map do |el_child|
  185 + next if el_child.name == 'text'
  186 +
  187 + if el_child.name == 'MOrderQty'
  188 + @calculated_weight += el_child.text.split(' ')[0].split(',').join.to_f
  189 +
  190 + {
  191 + name: el_child.name,
  192 + text: el_child.text
  193 + }
184 194 end
185 195  
186   - merchandise_arr = el.children.map do |el_child|
187   - next if el_child.name == "text"
  196 + # NOTE: These first three in the following
  197 + # conditionals are "Merchandise" elements with
  198 + # thier own nested structure that need parsed
  199 + if el_child.name == 'Serial'
  200 + serial_obj[:serial] = [] unless serial_obj[:serial]
188 201  
189   - if el_child.name == "MOrderQty"
190   - @calculated_weight = @calculated_weight + el_child.text.split(' ')[0].split(',').join().to_f
  202 + serial_arr = parse_children_elements(el_child)
  203 + serial_obj[:serial].push(serial_arr)
  204 + serial_obj
191 205  
192   - {
193   - name: el_child.name,
194   - text: el_child.text
195   - }
196   - end
  206 + elsif el_child.name == 'Bin'
  207 + bin_obj[:bin] = [] unless bin_obj[:bin]
197 208  
198   - # NOTE: These first three in the following
199   - # conditionals are "Merchandise" elements with
200   - # thier own nested structure that need parsed
201   - if el_child.name == "Serial"
202   - unless serial_obj[:serial]
203   - serial_obj[:serial] = []
204   - end
  209 + bin_arr = parse_children_elements(el_child)
  210 + bin_obj[:bin].push(bin_arr)
  211 + bin_obj
205 212  
206   - serial_arr = parse_children_elements(el_child)
207   - serial_obj[:serial].push(serial_arr)
208   - serial_obj
  213 + elsif el_child.name == 'Lot'
  214 + lot_obj[:lot] = [] unless lot_obj[:lot]
209 215  
210   - elsif el_child.name == "Bin"
211   - unless bin_obj[:bin]
212   - bin_obj[:bin] = []
213   - end
  216 + lot_arr = parse_children_elements(el_child)
  217 + lot_obj[:lot].push(lot_arr)
  218 + lot_obj
214 219  
215   - bin_arr = parse_children_elements(el_child)
216   - bin_obj[:bin].push(bin_arr)
217   - bin_obj
  220 + elsif el_child.name == 'AttachedItems'
  221 + # NOTE: Like "Merchandise", "AttachedItems" is
  222 + # an element within "Merchandise" that contains
  223 + # elements with thier own nested structure that
  224 + # need parsed
218 225  
219   - elsif el_child.name == "Lot"
220   - unless lot_obj[:lot]
221   - lot_obj[:lot] = []
222   - end
  226 + sct_item_obj = {}
  227 + requisition_item_obj = {}
  228 + purchase_order_obj = {}
  229 +
  230 + unless attached_items_obj[:attached_items]
  231 + attached_items_obj[:attached_items] = []
  232 + end
223 233  
224   - lot_arr = parse_children_elements(el_child)
225   - lot_obj[:lot].push(lot_arr)
226   - lot_obj
  234 + attached_items_arr = el_child.children.map do |attached_items_child|
  235 + next if attached_items_child.name == 'text'
227 236  
228   - elsif el_child.name == "AttachedItems"
229   - # NOTE: Like "Merchandise", "AttachedItems" is
230   - # an element within "Merchandise" that contains
231   - # elements with thier own nested structure that
232   - # need parsed
  237 + if attached_items_child.name == 'SctItem'
  238 + sct_item_obj[:sct_item] = [] unless sct_item_obj[:sct_item]
233 239  
234   - sct_item_obj = {}
235   - requisition_item_obj = {}
236   - purchase_order_obj = {}
  240 + sct_item_arr = parse_children_elements(attached_items_child)
  241 + sct_item_obj[:sct_item].push(sct_item_arr)
  242 + sct_item_obj
237 243  
238   - unless attached_items_obj[:attached_items]
239   - attached_items_obj[:attached_items] = []
240   - end
  244 + elsif attached_items_child.name == 'RequisitionItem'
  245 + unless requisition_item_obj[:requisition_item]
  246 + requisition_item_obj[:requisition_item] = []
  247 + end
241 248  
242   - attached_items_arr = el_child.children.map do |attached_items_child|
243   - next if attached_items_child.name == "text"
244   -
245   - if attached_items_child.name == "SctItem"
246   - unless sct_item_obj[:sct_item]
247   - sct_item_obj[:sct_item] = []
248   - end
249   -
250   - sct_item_arr = parse_children_elements(attached_items_child)
251   - sct_item_obj[:sct_item].push(sct_item_arr)
252   - sct_item_obj
253   -
254   - elsif attached_items_child.name == "RequisitionItem"
255   - unless requisition_item_obj[:requisition_item]
256   - requisition_item_obj[:requisition_item] = []
257   - end
258   -
259   - requisition_item_arr = parse_children_elements(attached_items_child)
260   - requisition_item_obj[:requisition_item].push(requisition_item_arr)
261   - requisition_item_obj
262   -
263   - elsif attached_items_child.name == "PurchaseOrder"
264   - unless purchase_order_obj[:purchase_order]
265   - purchase_order_obj[:purchase_order] = []
266   - end
267   -
268   - purchase_order_arr = parse_children_elements(attached_items_child)
269   - purchase_order_obj[:purchase_order].push(purchase_order_arr)
270   - purchase_order_obj
271   -
272   - else
273   - {
274   - name: attached_items_child.name,
275   - text: attached_items_child.text
276   - }
  249 + requisition_item_arr = parse_children_elements(attached_items_child)
  250 + requisition_item_obj[:requisition_item].push(requisition_item_arr)
  251 + requisition_item_obj
  252 +
  253 + elsif attached_items_child.name == 'PurchaseOrder'
  254 + unless purchase_order_obj[:purchase_order]
  255 + purchase_order_obj[:purchase_order] = []
277 256 end
278   - end.compact
279 257  
280   - attached_items_obj[:attached_items].push(attached_items_arr)
281   - attached_items_obj
  258 + purchase_order_arr = parse_children_elements(attached_items_child)
  259 + purchase_order_obj[:purchase_order].push(purchase_order_arr)
  260 + purchase_order_obj
282 261  
283   - else
284   - {
285   - name: el_child.name,
286   - text: el_child.text
287   - }
288   - end
289   - end.compact
  262 + else
  263 + {
  264 + name: attached_items_child.name,
  265 + text: attached_items_child.text
  266 + }
  267 + end
  268 + end.compact
290 269  
291   - sales_order_lines_obj[:merchandise].push(merchandise_arr)
292   - end
  270 + attached_items_obj[:attached_items].push(attached_items_arr)
  271 + attached_items_obj
  272 +
  273 + else
  274 + {
  275 + name: el_child.name,
  276 + text: el_child.text
  277 + }
  278 + end
  279 + end.compact
  280 +
  281 + sales_order_lines_obj[:merchandise].push(merchandise_arr)
293 282 end
294 283  
295 284 sales_order_lines_obj
... ... @@ -297,7 +286,7 @@ module Syspro
297 286  
298 287 def parse_children_elements(el_child)
299 288 obj_array = el_child.children.map do |el|
300   - next if el.name == "text"
  289 + next if el.name == 'text'
301 290 {
302 291 name: el.name,
303 292 text: el.text
... ... @@ -306,7 +295,6 @@ module Syspro
306 295  
307 296 obj_array
308 297 end
309   -
310 298 end
311 299 end
312 300 end
... ...
lib/syspro/business_objects/porqry.rb
... ... @@ -10,10 +10,10 @@ module Syspro
10 10 include Syspro::BusinessObjects::Parsers
11 11  
12 12 attr_accessor :purchase_order, :include_stocked_lines, :include_non_stocked_lines,
13   - :include_freight_lines, :include_miscellaneous_lines, :include_comment_lines,
14   - :include_completed_lines, :include_grns, :include_history, :include_lct_details,
15   - :include_requisition_details, :include_requisition_routing, :include_sales_orders,
16   - :include_custom_forms, :filter_type, :filter_value
  13 + :include_freight_lines, :include_miscellaneous_lines, :include_comment_lines,
  14 + :include_completed_lines, :include_grns, :include_history, :include_lct_details,
  15 + :include_requisition_details, :include_requisition_routing, :include_sales_orders,
  16 + :include_custom_forms, :filter_type, :filter_value
17 17  
18 18 def call(user_id)
19 19 xml_in = template.result(binding)
... ...
lib/syspro/business_objects/portii.rb
... ... @@ -11,10 +11,10 @@ module Syspro
11 11  
12 12 # input params
13 13 attr_accessor :transaction_date,
14   - :ignore_warnings,
15   - :apply_if_entire_document_valid,
16   - :validate_only,
17   - :item_inspected
  14 + :ignore_warnings,
  15 + :apply_if_entire_document_valid,
  16 + :validate_only,
  17 + :item_inspected
18 18  
19 19 def call(user_id)
20 20 xml_parameters = params_template.result(binding)
... ... @@ -43,10 +43,9 @@ module Syspro
43 43 parser.parse
44 44 end
45 45  
46   - def render_xml(inner_text, dflt_value = "")
  46 + def render_xml(inner_text, dflt_value = '')
47 47 inner_text ? inner_text.to_s : dflt_value
48 48 end
49 49 end
50 50 end
51 51 end
52   -
... ...
lib/syspro/business_objects/portoi.rb
... ... @@ -11,22 +11,22 @@ module Syspro
11 11  
12 12 # input params
13 13 attr_accessor :purchase_order_header,
14   - :order_details,
15   - :validate_only,
16   - :ignore_warnings,
17   - :allow_non_stock_items,
18   - :allow_zero_price,
19   - :validate_working_days,
20   - :allow_po_when_blanket_po,
21   - :default_memo_code,
22   - :fixed_exchange_rate,
23   - :default_memo_days,
24   - :allow_blank_ledger_code,
25   - :calc_due_date,
26   - :default_delivery_address,
27   - :insert_dangerous_goods_text,
28   - :insert_additional_po_text,
29   - :status
  14 + :order_details,
  15 + :validate_only,
  16 + :ignore_warnings,
  17 + :allow_non_stock_items,
  18 + :allow_zero_price,
  19 + :validate_working_days,
  20 + :allow_po_when_blanket_po,
  21 + :default_memo_code,
  22 + :fixed_exchange_rate,
  23 + :default_memo_days,
  24 + :allow_blank_ledger_code,
  25 + :calc_due_date,
  26 + :default_delivery_address,
  27 + :insert_dangerous_goods_text,
  28 + :insert_additional_po_text,
  29 + :status
30 30  
31 31 def call(user_id)
32 32 xml_parameters = params_template.result(binding)
... ... @@ -61,4 +61,3 @@ module Syspro
61 61 end
62 62 end
63 63 end
64   -
... ...
lib/syspro/business_objects/portor.rb
... ... @@ -47,10 +47,9 @@ module Syspro
47 47 parser.parse
48 48 end
49 49  
50   - def render_xml(inner_text, dflt_value = "")
  50 + def render_xml(inner_text, dflt_value = '')
51 51 inner_text ? inner_text.to_s : dflt_value
52 52 end
53 53 end
54 54 end
55 55 end
56   -
... ...
lib/syspro/configuration.rb
... ... @@ -43,7 +43,7 @@ module Syspro
43 43 private
44 44  
45 45 def deprecated_default_server_url
46   - warn "[DEPRECATION] the default server url of `http://syspro.wildlandlabs.com:90` will be removed. Please update your application to configure this server url (see README for details)."
  46 + warn '[DEPRECATION] the default server url of `http://syspro.wildlandlabs.com:90` will be removed. Please update your application to configure this server url (see README for details).'
47 47 'http://syspro.wildlandlabs.com:90'
48 48 end
49 49  
... ...
lib/syspro/util.rb
... ... @@ -207,7 +207,6 @@ module Syspro
207 207 end
208 208 end
209 209  
210   -
211 210 def logger
212 211 Syspro.configuration.logger
213 212 end
... ...
lib/syspro/version.rb
1 1 # frozen_string_literal: true
2 2  
3 3 module Syspro
4   - VERSION = '1.0.0.alpha.2'
  4 + VERSION = '1.0.0.alpha.2'.freeze
5 5 end
... ...
syspro-ruby.gemspec
... ... @@ -7,8 +7,8 @@ require &#39;syspro/version&#39;
7 7 Gem::Specification.new do |spec|
8 8 spec.name = 'syspro-ruby'
9 9 spec.version = Syspro::VERSION
10   - spec.authors = ['Isaac Lewis']
11   - spec.email = ['isaac@ike.io']
  10 + spec.authors = ['Sam Clopton', 'Nathan Ockerman']
  11 + spec.email = ['sam@wild.land', 'nathan@wild.land']
12 12  
13 13 spec.summary = 'SYSPRO 7 Api Ruby adapter'
14 14 spec.license = 'MIT'
... ...
test/cassettes/test_comsfm.yml 0 โ†’ 100644
  1 +---
  2 +http_interactions:
  3 +- request:
  4 + method: get
  5 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/logon?CompanyId=<syspro_company>&CompanyPassword=&Operator=<syspro_username>&OperatorPassword=<syspro_password>
  6 + body:
  7 + encoding: US-ASCII
  8 + string: ''
  9 + headers:
  10 + User-Agent:
  11 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  12 + Content-Type:
  13 + - application/x-www-form-urlencoded
  14 + Accept-Encoding:
  15 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  16 + Accept:
  17 + - "*/*"
  18 + response:
  19 + status:
  20 + code: 200
  21 + message: OK
  22 + headers:
  23 + Content-Type:
  24 + - application/octet-stream
  25 + Server:
  26 + - Microsoft-HTTPAPI/2.0
  27 + Date:
  28 + - Thu, 23 May 2019 17:59:57 GMT
  29 + Content-<syspro_company>ength:
  30 + - '36'
  31 + body:
  32 + encoding: UTF-8
  33 + string: '12E6D0C3129AAC4D940E264688A7D31500 '
  34 + http_version:
  35 + recorded_at: Thu, 23 May 2019 17:59:55 GMT
  36 +- request:
  37 + method: get
  38 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Setup/Add?BusinessObject=COMSFM&UserId=12E6D0C3129AAC4D940E264688A7D31500%20%20&XmlIn=%3CSetupCustomForm%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22COMSFMDOC.XSD%22%3E%0A%0A%20%20%3CItem%3E%0A%20%20%20%20%3CKey%3E%0A%20%20%20%20%20%20%3CFormType%3EPOR%3C/FormType%3E%0A%20%20%20%20%20%20%3CKeyField%3EU03679%3C/KeyField%3E%0A%20%20%20%20%20%20%3CFieldName%3ETempPO%3C/FieldName%3E%0A%20%20%20%20%3C/Key%3E%0A%20%20%20%20%3CAlphaValue%3EY%3C/AlphaValue%3E%0A%20%20%3C/Item%3E%0A%0A%3C/SetupCustomForm%3E&XmlParameters=%3CSetupCustomForm%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22COMSFM.XSD%22%3E%0A%20%20%3CParameters%3E%0A%20%20%20%20%3CValidateOnly%3EY%3C/ValidateOnly%3E%0A%20%20%3C/Parameters%3E%0A%3C/SetupCustomForm%3E
  39 + body:
  40 + encoding: US-ASCII
  41 + string: ''
  42 + headers:
  43 + User-Agent:
  44 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  45 + Content-Type:
  46 + - application/x-www-form-urlencoded
  47 + Accept-Encoding:
  48 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  49 + Accept:
  50 + - "*/*"
  51 + response:
  52 + status:
  53 + code: 200
  54 + message: OK
  55 + headers:
  56 + Content-Type:
  57 + - application/octet-stream
  58 + Server:
  59 + - Microsoft-HTTPAPI/2.0
  60 + Date:
  61 + - Thu, 23 May 2019 17:59:58 GMT
  62 + Content-<syspro_company>ength:
  63 + - '417'
  64 + body:
  65 + encoding: UTF-8
  66 + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<setupcustomform
  67 + <syspro_company>anguage='05' <syspro_company>anguage2='EN' CssStyle='' DecFormat='1'
  68 + DateFormat='01' Role='01' Version='7.0.008' OperatorPrimaryRole=' '>\n<item>\n<key>\n<formtype>POR</formtype>\n<keyfield>U03679</keyfield>\n<fieldname>TempPO</fieldname>\n</key>\n</item>\n<StatusOfItems>\n<RecordsRead>1</RecordsRead>\n<RecordsInvalid>0</RecordsInvalid>\n</StatusOfItems>\n</setupcustomform>\n "
  69 + http_version:
  70 + recorded_at: Thu, 23 May 2019 17:59:55 GMT
  71 +recorded_with: VCR 4.0.0
... ...
test/cassettes/test_invsws.yml 0 โ†’ 100644
  1 +---
  2 +http_interactions:
  3 +- request:
  4 + method: get
  5 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/logon?CompanyId=<syspro_company>&CompanyPassword=&Operator=<syspro_username>&OperatorPassword=<syspro_password>
  6 + body:
  7 + encoding: US-ASCII
  8 + string: ''
  9 + headers:
  10 + User-Agent:
  11 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  12 + Content-Type:
  13 + - application/x-www-form-urlencoded
  14 + Accept-Encoding:
  15 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  16 + Accept:
  17 + - "*/*"
  18 + response:
  19 + status:
  20 + code: 200
  21 + message: OK
  22 + headers:
  23 + Content-Type:
  24 + - application/octet-stream
  25 + Server:
  26 + - Microsoft-HTTPAPI/2.0
  27 + Date:
  28 + - Thu, 23 May 2019 18:29:17 GMT
  29 + Content-<syspro_company>ength:
  30 + - '36'
  31 + body:
  32 + encoding: UTF-8
  33 + string: 'E913FB94AD039B419146258CFB1B0FFB00 '
  34 + http_version:
  35 + recorded_at: Thu, 23 May 2019 18:29:15 GMT
  36 +- request:
  37 + method: get
  38 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Setup/Add?BusinessObject=INVSWS&UserId=E913FB94AD039B419146258CFB1B0FFB00%20%20&XmlIn=%3CSetupInvWarehouse%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22INVSWSDOC.XSD%22%3E%0A%20%20%3CItem%3E%0A%20%20%20%20%3CKey%3E%0A%20%20%20%20%20%20%3CStockCode%3E1004%3C/StockCode%3E%0A%20%20%20%20%20%20%3CWarehouse%3EP0%3C/Warehouse%3E%0A%20%20%20%20%3C/Key%3E%0A%20%20%20%20%3CCostMultiplier%3E1.0%3C/CostMultiplier%3E%0A%20%20%20%20%3CMinimumQty%3E%3C/MinimumQty%3E%0A%20%20%20%20%3CMaximumQty%3E%3C/MaximumQty%3E%0A%20%20%20%20%3CUnitCost%3E%3C/UnitCost%3E%0A%20%20%20%20%3CDefaultBin%3EP0%3C/DefaultBin%3E%0A%20%20%20%20%3CSafetyStockQty%3E%3C/SafetyStockQty%3E%0A%20%20%20%20%3CReOrderQty%3E%3C/ReOrderQty%3E%0A%20%20%20%20%3CPalletQty%3E%3C/PalletQty%3E%0A%20%20%20%20%3CUserField1%3E%3C/UserField1%3E%0A%20%20%20%20%3CUserField2%3E%3C/UserField2%3E%0A%20%20%20%20%3CUserField3%3E%3C/UserField3%3E%0A%20%20%20%20%3COrderPolicy%3EC%3C/OrderPolicy%3E%0A%20%20%20%20%3CMajorOrderMult%3E%3C/MajorOrderMult%3E%0A%20%20%20%20%3CMinorOrderMult%3E%3C/MinorOrderMult%3E%0A%20%20%20%20%3COrderMinimum%3E%3C/OrderMinimum%3E%0A%20%20%20%20%3COrderMaximum%3E%3C/OrderMaximum%3E%0A%20%20%20%20%3COrderFixPeriod%3E01%3C/OrderFixPeriod%3E%0A%20%20%20%20%3CTrfSuppliedItem%3EN%3C/TrfSuppliedItem%3E%0A%20%20%20%20%3CDefaultSourceWh%3E%3C/DefaultSourceWh%3E%0A%20%20%20%20%3CTrf<syspro_company>eadTime%3E0%3C/Trf<syspro_company>eadTime%3E%0A%20%20%20%20%3CTrfCostGlCode%3E%3C/TrfCostGlCode%3E%0A%20%20%20%20%3CTrfCostMultiply%3E%3C/TrfCostMultiply%3E%0A%20%20%20%20%3CTrfReplenishWh%3E0%3C/TrfReplenishWh%3E%0A%20%20%20%20%3CTrfBuyingRule%3EA%3C/TrfBuyingRule%3E%0A%20%20%20%20%3CTrfDockToStock%3E%3C/TrfDockToStock%3E%0A%20%20%20%20%3CTrfFixTimePeriod%3E%3C/TrfFixTimePeriod%3E%0A%20%20%20%20%3C<syspro_company>abourCost%3E%3C/<syspro_company>abourCost%3E%0A%20%20%20%20%3CMaterialCost%3E%3C/MaterialCost%3E%0A%20%20%20%20%3CFixedOverhead%3E%3C/FixedOverhead%3E%0A%20%20%20%20%3CVariableOverhead%3E%3C/VariableOverhead%3E%0A%20%20%20%20%3CSubContractCost%3E%3C/SubContractCost%3E%0A%20%20%20%20%3CManualCostFlag%3EN%3C/ManualCostFlag%3E%0A%20%20%20%20%0A%20%20%3C/Item%3E%0A%3C/SetupInvWarehouse%3E&XmlParameters=%3CSetupInvWarehouse%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22INVSWS.XSD%22%3E%0A%20%20%3CParameters%3E%0A%20%20%20%20%3CApplyProductClassDefault%3EBA%3C/ApplyProductClassDefault%3E%0A%20%20%20%20%3CIgnoreWarnings%3EN%3C/IgnoreWarnings%3E%0A%20%20%20%20%3CApplyIfEntireDocumentValid%3EY%3C/ApplyIfEntireDocumentValid%3E%0A%20%20%20%20%3CValidateOnly%3EY%3C/ValidateOnly%3E%0A%20%20%3C/Parameters%3E%0A%3C/SetupInvWarehouse%3E%0A
  39 + body:
  40 + encoding: US-ASCII
  41 + string: ''
  42 + headers:
  43 + User-Agent:
  44 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  45 + Content-Type:
  46 + - application/x-www-form-urlencoded
  47 + Accept-Encoding:
  48 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  49 + Accept:
  50 + - "*/*"
  51 + response:
  52 + status:
  53 + code: 200
  54 + message: OK
  55 + headers:
  56 + Content-Type:
  57 + - application/octet-stream
  58 + Server:
  59 + - Microsoft-HTTPAPI/2.0
  60 + Date:
  61 + - Thu, 23 May 2019 18:29:18 GMT
  62 + Content-<syspro_company>ength:
  63 + - '536'
  64 + body:
  65 + encoding: UTF-8
  66 + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<setupinvwarehouse
  67 + <syspro_company>anguage='05' <syspro_company>anguage2='EN' CssStyle='' DecFormat='1'
  68 + DateFormat='01' Role='01' Version='7.0.026' OperatorPrimaryRole=' '>\n<item>\n<key>\n<stockcode>1004</stockcode>\n<warehouse>P0</warehouse>\n</key>\n<stockcode>\n<Value>1004</Value>\n<ErrorNumber>240004</ErrorNumber>\n<ErrorDescription>Stock
  69 + code '1004' not found</ErrorDescription>\n</stockcode>\n</item>\n<StatusOfItems>\n<RecordsRead>1</RecordsRead>\n<RecordsInvalid>1</RecordsInvalid>\n</StatusOfItems>\n</setupinvwarehouse>\n "
  70 + http_version:
  71 + recorded_at: Thu, 23 May 2019 18:29:15 GMT
  72 +recorded_with: VCR 4.0.0
... ...
test/cassettes/test_invsws_errors.yml 0 โ†’ 100644
  1 +---
  2 +http_interactions:
  3 +- request:
  4 + method: get
  5 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/logon?CompanyId=<syspro_company>&CompanyPassword=&Operator=<syspro_username>&OperatorPassword=<syspro_password>
  6 + body:
  7 + encoding: US-ASCII
  8 + string: ''
  9 + headers:
  10 + User-Agent:
  11 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  12 + Content-Type:
  13 + - application/x-www-form-urlencoded
  14 + Accept-Encoding:
  15 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  16 + Accept:
  17 + - "*/*"
  18 + response:
  19 + status:
  20 + code: 200
  21 + message: OK
  22 + headers:
  23 + Content-Type:
  24 + - application/octet-stream
  25 + Server:
  26 + - Microsoft-HTTPAPI/2.0
  27 + Date:
  28 + - Fri, 24 May 2019 17:23:24 GMT
  29 + Content-<syspro_company>ength:
  30 + - '36'
  31 + body:
  32 + encoding: UTF-8
  33 + string: '0EDDFCFC88E5674AA78DD1C24F3CEEBE00 '
  34 + http_version:
  35 + recorded_at: Fri, 24 May 2019 17:23:23 GMT
  36 +- request:
  37 + method: get
  38 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Setup/Add?BusinessObject=INVSWS&UserId=0EDDFCFC88E5674AA78DD1C24F3CEEBE00%20%20&XmlIn=%3CSetupInvWarehouse%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22INVSWSDOC.XSD%22%3E%0A%20%20%3CItem%3E%0A%20%20%20%20%3CKey%3E%0A%20%20%20%20%20%20%3CStockCode%3E1004%3C/StockCode%3E%0A%20%20%20%20%20%20%3CWarehouse%3EP0%3C/Warehouse%3E%0A%20%20%20%20%3C/Key%3E%0A%20%20%20%20%3CCostMultiplier%3E1.0%3C/CostMultiplier%3E%0A%20%20%20%20%3CMinimumQty%3E%3C/MinimumQty%3E%0A%20%20%20%20%3CMaximumQty%3E%3C/MaximumQty%3E%0A%20%20%20%20%3CUnitCost%3E%3C/UnitCost%3E%0A%20%20%20%20%3CDefaultBin%3EP0%3C/DefaultBin%3E%0A%20%20%20%20%3CSafetyStockQty%3E%3C/SafetyStockQty%3E%0A%20%20%20%20%3CReOrderQty%3E%3C/ReOrderQty%3E%0A%20%20%20%20%3CPalletQty%3E%3C/PalletQty%3E%0A%20%20%20%20%3CUserField1%3E%3C/UserField1%3E%0A%20%20%20%20%3CUserField2%3E%3C/UserField2%3E%0A%20%20%20%20%3CUserField3%3E%3C/UserField3%3E%0A%20%20%20%20%3COrderPolicy%3EC%3C/OrderPolicy%3E%0A%20%20%20%20%3CMajorOrderMult%3E%3C/MajorOrderMult%3E%0A%20%20%20%20%3CMinorOrderMult%3E%3C/MinorOrderMult%3E%0A%20%20%20%20%3COrderMinimum%3E%3C/OrderMinimum%3E%0A%20%20%20%20%3COrderMaximum%3E%3C/OrderMaximum%3E%0A%20%20%20%20%3COrderFixPeriod%3E01%3C/OrderFixPeriod%3E%0A%20%20%20%20%3CTrfSuppliedItem%3EN%3C/TrfSuppliedItem%3E%0A%20%20%20%20%3CDefaultSourceWh%3E%3C/DefaultSourceWh%3E%0A%20%20%20%20%3CTrf<syspro_company>eadTime%3E0%3C/Trf<syspro_company>eadTime%3E%0A%20%20%20%20%3CTrfCostGlCode%3E%3C/TrfCostGlCode%3E%0A%20%20%20%20%3CTrfCostMultiply%3E%3C/TrfCostMultiply%3E%0A%20%20%20%20%3CTrfReplenishWh%3E0%3C/TrfReplenishWh%3E%0A%20%20%20%20%3CTrfBuyingRule%3EA%3C/TrfBuyingRule%3E%0A%20%20%20%20%3CTrfDockToStock%3E%3C/TrfDockToStock%3E%0A%20%20%20%20%3CTrfFixTimePeriod%3E%3C/TrfFixTimePeriod%3E%0A%20%20%20%20%3C<syspro_company>abourCost%3E%3C/<syspro_company>abourCost%3E%0A%20%20%20%20%3CMaterialCost%3E%3C/MaterialCost%3E%0A%20%20%20%20%3CFixedOverhead%3E%3C/FixedOverhead%3E%0A%20%20%20%20%3CVariableOverhead%3E%3C/VariableOverhead%3E%0A%20%20%20%20%3CSubContractCost%3E%3C/SubContractCost%3E%0A%20%20%20%20%3CManualCostFlag%3EN%3C/ManualCostFlag%3E%0A%20%20%20%20%0A%20%20%3C/Item%3E%0A%3C/SetupInvWarehouse%3E&XmlParameters=%3CSetupInvWarehouse%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22INVSWS.XSD%22%3E%0A%20%20%3CParameters%3E%0A%20%20%20%20%3CApplyProductClassDefault%3EBA%3C/ApplyProductClassDefault%3E%0A%20%20%20%20%3CIgnoreWarnings%3EN%3C/IgnoreWarnings%3E%0A%20%20%20%20%3CApplyIfEntireDocumentValid%3EY%3C/ApplyIfEntireDocumentValid%3E%0A%20%20%20%20%3CValidateOnly%3EY%3C/ValidateOnly%3E%0A%20%20%3C/Parameters%3E%0A%3C/SetupInvWarehouse%3E%0A
  39 + body:
  40 + encoding: US-ASCII
  41 + string: ''
  42 + headers:
  43 + User-Agent:
  44 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  45 + Content-Type:
  46 + - application/x-www-form-urlencoded
  47 + Accept-Encoding:
  48 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  49 + Accept:
  50 + - "*/*"
  51 + response:
  52 + status:
  53 + code: 200
  54 + message: OK
  55 + headers:
  56 + Content-Type:
  57 + - application/octet-stream
  58 + Server:
  59 + - Microsoft-HTTPAPI/2.0
  60 + Date:
  61 + - Fri, 24 May 2019 17:23:24 GMT
  62 + Content-<syspro_company>ength:
  63 + - '536'
  64 + body:
  65 + encoding: UTF-8
  66 + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<setupinvwarehouse
  67 + <syspro_company>anguage='05' <syspro_company>anguage2='EN' CssStyle='' DecFormat='1'
  68 + DateFormat='01' Role='01' Version='7.0.026' OperatorPrimaryRole=' '>\n<item>\n<key>\n<stockcode>1004</stockcode>\n<warehouse>P0</warehouse>\n</key>\n<stockcode>\n<Value>1004</Value>\n<ErrorNumber>240004</ErrorNumber>\n<ErrorDescription>Stock
  69 + code '1004' not found</ErrorDescription>\n</stockcode>\n</item>\n<StatusOfItems>\n<RecordsRead>1</RecordsRead>\n<RecordsInvalid>1</RecordsInvalid>\n</StatusOfItems>\n</setupinvwarehouse>\n "
  70 + http_version:
  71 + recorded_at: Fri, 24 May 2019 17:23:24 GMT
  72 +recorded_with: VCR 4.0.0
... ...
test/cassettes/test_logon.yml
... ... @@ -25,12 +25,12 @@ http_interactions:
25 25 Server:
26 26 - Microsoft-HTTPAPI/2.0
27 27 Date:
28   - - Mon, 14 Jan 2019 22:56:14 GMT
  28 + - Wed, 22 May 2019 22:36:13 GMT
29 29 Content-<syspro_company>ength:
30   - - '32'
  30 + - '36'
31 31 body:
32 32 encoding: UTF-8
33   - string: 'ERROR: Invalid operator password'
  33 + string: '3EA613166FE4BF47925DF1CEA14E910100 '
34 34 http_version:
35   - recorded_at: Mon, 14 Jan 2019 22:56:14 GMT
  35 + recorded_at: Wed, 22 May 2019 22:36:12 GMT
36 36 recorded_with: VCR 4.0.0
... ...
test/cassettes/test_portor.yml 0 โ†’ 100644
  1 +---
  2 +http_interactions:
  3 +- request:
  4 + method: get
  5 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/logon?CompanyId=<syspro_company>&CompanyPassword=&Operator=<syspro_username>&OperatorPassword=<syspro_password>
  6 + body:
  7 + encoding: US-ASCII
  8 + string: ''
  9 + headers:
  10 + User-Agent:
  11 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  12 + Content-Type:
  13 + - application/x-www-form-urlencoded
  14 + Accept-Encoding:
  15 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  16 + Accept:
  17 + - "*/*"
  18 + response:
  19 + status:
  20 + code: 200
  21 + message: OK
  22 + headers:
  23 + Content-Type:
  24 + - application/octet-stream
  25 + Server:
  26 + - Microsoft-HTTPAPI/2.0
  27 + Date:
  28 + - Thu, 23 May 2019 16:43:21 GMT
  29 + Content-<syspro_company>ength:
  30 + - '36'
  31 + body:
  32 + encoding: UTF-8
  33 + string: '6D8139C868FDD74487FB2B80F8CC4EBD00 '
  34 + http_version:
  35 + recorded_at: Thu, 23 May 2019 16:43:18 GMT
  36 +- request:
  37 + method: get
  38 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Transaction/Post?BusinessObject=PORTOR&UserId=6D8139C868FDD74487FB2B80F8CC4EBD00%20%20&XmlIn=%3C?xml%20version=%221.0%22%20encoding=%22Windows-1252%22?%3E%0A%3CPostPurchaseOrderReceipts%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22portordoc.xsd%22%3E%0A%20%20%0A%20%20%3CItem%3E%0A%20%20%20%20%3CReceiptIntoInspection%3E%0A%20%20%20%20%20%20%3CPurchaseOrder%3EZ01308%3C/PurchaseOrder%3E%0A%20%20%20%20%20%20%3CWarehouse%3EP0%3C/Warehouse%3E%0A%20%20%20%20%20%20%3CStockCode%3E8801%3C/StockCode%3E%0A%20%20%20%20%20%20%3CQuantity%3E0.01%3C/Quantity%3E%0A%20%20%20%20%20%20%3CCountedQuantityComplete%3EY%3C/CountedQuantityComplete%3E%0A%20%20%20%20%20%20%3CDeliveryNote%3EDE<syspro_company>IVER%20NOTE%20HERE-W<syspro_company>%3C/DeliveryNote%3E%0A%20%20%20%20%20%20%3CCertificate%3E8/45-3%3C/Certificate%3E%0A%20%20%20%20%20%20%3CNarration%3E%3C/Narration%3E%0A%20%20%20%20%20%20%3C<syspro_company>ot%3E7097505%3C/<syspro_company>ot%3E%0A%20%20%20%20%20%20%3CGRNNumber%3E%3C/GRNNumber%3E%0A%20%20%20%20%20%20%3CConcession%3E%3C/Concession%3E%0A%20%20%20%20%20%20%3CCostBasis%3E%3C/CostBasis%3E%0A%20%20%20%20%20%20%3CNotation%3E%3C/Notation%3E%0A%20%20%20%20%20%20%3CReference%3E%3C/Reference%3E%0A%20%20%20%20%20%20%3CGRNSource%3E%3C/GRNSource%3E%0A%20%20%20%20%20%20%0A%20%20%20%20%3C/ReceiptIntoInspection%3E%0A%20%20%3C/Item%3E%0A%20%20%20%20%20%20%0A%3C/PostPurchaseOrderReceipts%3E&XmlParameters=%3C?xml%20version=%221.0%22%20encoding=%22Windows-1252%22?%3E%0A%3CPostPurchaseOrderReceipts%20xmlns:xsd=%22http://www.w3.org/2001/XM<syspro_company>Schema-instance%22%20xsd:noNamespaceSchema<syspro_company>ocation=%22portor.xsd%22%3E%0A%20%20%3CParameters%3E%0A%20%20%20%20%3CTransactionDate%3E2019-05-23%3C/TransactionDate%3E%0A%20%20%20%20%3CIgnoreWarnings%3EN%3C/IgnoreWarnings%3E%0A%20%20%20%20%3CNonStockedWhToUse%3E%3C/NonStockedWhToUse%3E%0A%20%20%20%20%3CGRNMatchingAction%3EA%3C/GRNMatchingAction%3E%0A%20%20%20%20%3CAllowBlankSupplier%3EN%3C/AllowBlankSupplier%3E%0A%20%20%20%20%3CApplyIfEntireDocumentValid%3EN%3C/ApplyIfEntireDocumentValid%3E%0A%20%20%20%20%3CValidateOnly%3EN%3C/ValidateOnly%3E%0A%20%20%20%20%3CManualSerialTransfersAllowed%3EN%3C/ManualSerialTransfersAllowed%3E%0A%20%20%20%20%3CIgnoreAnalysis%3EN%3C/IgnoreAnalysis%3E%0A%20%20%3C/Parameters%3E%0A%3C/PostPurchaseOrderReceipts%3E
  39 + body:
  40 + encoding: US-ASCII
  41 + string: ''
  42 + headers:
  43 + User-Agent:
  44 + - Syspro/7 RubyBindings/1.0.0.alpha.2
  45 + Content-Type:
  46 + - application/x-www-form-urlencoded
  47 + Accept-Encoding:
  48 + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
  49 + Accept:
  50 + - "*/*"
  51 + response:
  52 + status:
  53 + code: 200
  54 + message: OK
  55 + headers:
  56 + Content-Type:
  57 + - application/octet-stream
  58 + Server:
  59 + - Microsoft-HTTPAPI/2.0
  60 + Date:
  61 + - Thu, 23 May 2019 16:43:23 GMT
  62 + Content-<syspro_company>ength:
  63 + - '397'
  64 + body:
  65 + encoding: UTF-8
  66 + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<postpurchaseorderreceipts
  67 + <syspro_company>anguage='05' <syspro_company>anguage2='EN' CssStyle='' DecFormat='1'
  68 + DateFormat='01' Role='01' Version='7.0.111' OperatorPrimaryRole=' '>\n<Item>\n<Key>\n<PurchaseOrder>Z01308</PurchaseOrder>\n<<syspro_company>ine>0002</<syspro_company>ine>\n<Grn>P00013152</Grn>\n<<syspro_company>otNumber>7097505</<syspro_company>otNumber>\n</Key>\n<ItemNumber>000001</ItemNumber>\n</Item>\n</postpurchaseorderreceipts>\n "
  69 + http_version:
  70 + recorded_at: Thu, 23 May 2019 16:43:20 GMT
  71 +recorded_with: VCR 4.0.0
... ...
test/comsfm_test.rb
... ... @@ -5,6 +5,9 @@ require &#39;test_helper&#39;
5 5 class ComsFmTest < Minitest::Test
6 6 extend Minitest::Spec::DSL
7 7  
  8 + before { VCR.insert_cassette name }
  9 + after { VCR.eject_cassette }
  10 +
8 11 let(:username) { ENV['SYSPRO_USERNAME'] }
9 12 let(:password) { ENV['SYSPRO_PASSWORD'] }
10 13 let(:company) { ENV['SYSPRO_COMPANY'] }
... ... @@ -15,17 +18,17 @@ class ComsFmTest &lt; Minitest::Test
15 18  
16 19 def test_comsfm
17 20 cust_item = Syspro::BusinessObjects::Models::ComsFmItem.new
18   - cust_item.form_type = "POR"
19   - cust_item.key_field = "U03421"
20   - cust_item.field_name = "TempPO"
21   - cust_item.alpha_value = "Y"
  21 + cust_item.form_type = 'POR'
  22 + cust_item.key_field = 'U03679'
  23 + cust_item.field_name = 'TempPO'
  24 + cust_item.alpha_value = 'Y'
22 25  
23 26 cust_form = Syspro::BusinessObjects::ComsFm.new
24   - cust_form.validate_only = "Y"
  27 + cust_form.validate_only = 'Y'
25 28 cust_form.items = [cust_item]
26 29  
27 30 errors = cust_form.add(user_id.guid)
28 31  
29 32 assert_equal errors.length, 0
30 33 end
31   -end
32 34 \ No newline at end of file
  35 +end
... ...
test/invqry_test.rb
... ... @@ -22,10 +22,10 @@ class InvQryTest &lt; Minitest::Test
22 22 invqry_req.key_stock_code = '1003'
23 23 invqry_req.filter_warehouse_list = 'P0'
24 24 invqry_req.option = Syspro::BusinessObjects::Models::InvQryOptions.new
25   - invqry_req.option.include_lots = "Y"
26   -
  25 + invqry_req.option.include_lots = 'Y'
  26 +
27 27 invqry_rsp = invqry_req.call(user_id.guid)
28 28  
29 29 assert_kind_of Syspro::BusinessObjects::Models::Inv, invqry_rsp
30 30 end
31   -end
32 31 \ No newline at end of file
  32 +end
... ...
test/invsws_test.rb
... ... @@ -2,9 +2,12 @@
2 2  
3 3 require 'test_helper'
4 4  
5   -class ComsFmTest < Minitest::Test
  5 +class InvSwsTest < Minitest::Test
6 6 extend Minitest::Spec::DSL
7 7  
  8 + before { VCR.insert_cassette name }
  9 + after { VCR.eject_cassette }
  10 +
8 11 let(:username) { ENV['SYSPRO_USERNAME'] }
9 12 let(:password) { ENV['SYSPRO_PASSWORD'] }
10 13 let(:company) { ENV['SYSPRO_COMPANY'] }
... ... @@ -14,20 +17,39 @@ class ComsFmTest &lt; Minitest::Test
14 17 end
15 18  
16 19 def test_invsws
  20 + skip 'A new VCR cassette needs recorded for this test to pass'
17 21 invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new
18   - invsws_item.key_stock_code = "1003"
19   - invsws_item.key_warehouse = "P0"
20   - invsws_item.default_bin = "P0"
  22 + invsws_item.key_stock_code = '1004'
  23 + invsws_item.key_warehouse = 'P0'
  24 + invsws_item.default_bin = 'P0'
21 25  
22 26 invsws_req = Syspro::BusinessObjects::InvSws.new
23   - invsws_req.validate_only = "Y"
24   - invsws_req.apply_product_class_default = "BA"
25   - invsws_req.ignore_warnings = "N"
26   - invsws_req.apply_if_entire_document_valid = "Y"
  27 + invsws_req.validate_only = 'Y'
  28 + invsws_req.apply_product_class_default = 'BA'
  29 + invsws_req.ignore_warnings = 'N'
  30 + invsws_req.apply_if_entire_document_valid = 'Y'
27 31 invsws_req.item = invsws_item
28 32  
29 33 invsws_resp = invsws_req.add(user_id.guid)
30   -
  34 +
31 35 assert_equal invsws_resp[:error_numbers].length, 0
32 36 end
33   -end
34 37 \ No newline at end of file
  38 +
  39 + def test_invsws_errors
  40 + invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new
  41 + invsws_item.key_stock_code = '1004'
  42 + invsws_item.key_warehouse = 'P0'
  43 + invsws_item.default_bin = 'P0'
  44 +
  45 + invsws_req = Syspro::BusinessObjects::InvSws.new
  46 + invsws_req.validate_only = 'Y'
  47 + invsws_req.apply_product_class_default = 'BA'
  48 + invsws_req.ignore_warnings = 'N'
  49 + invsws_req.apply_if_entire_document_valid = 'Y'
  50 + invsws_req.item = invsws_item
  51 +
  52 + invsws_resp = invsws_req.add(user_id.guid)
  53 +
  54 + assert_equal invsws_resp[:errors].length, 1
  55 + end
  56 +end
... ...
test/logon_test.rb
... ... @@ -25,13 +25,13 @@ class LogonTest &lt; Minitest::Test
25 25 end
26 26  
27 27 def test_logon_error
28   - assert_raises(::Syspro::AuthenticationError) {
  28 + assert_raises(::Syspro::AuthenticationError) do
29 29 logon_result = ::Syspro::SysproClient.new.logon(
30 30 username,
31 31 'bad_password',
32 32 company,
33 33 company_password
34 34 )
35   - }
  35 + end
36 36 end
37 37 end
... ...
test/por_test.rb
... ... @@ -2,6 +2,7 @@ require &#39;test_helper&#39;
2 2  
3 3 class PorTest < Minitest::Test
4 4 extend Minitest::Spec::DSL
  5 +
5 6 before { VCR.insert_cassette name }
6 7 after { VCR.eject_cassette }
7 8  
... ... @@ -14,26 +15,10 @@ class PorTest &lt; Minitest::Test
14 15 Syspro::Logon.logon(username, password, company, company_password)
15 16 end
16 17  
17   - #def test_por_transaction
18   - #portor = Syspro::BusinessObjects::PorTor.new
19   -
20   - #portor.transaction_date = "2006-04-08"
21   - #portor.ignore_warnings = "N"
22   - #portor.grn_matching_action = "A"
23   - #portor.allow_blank_supplier = "N"
24   - #portor.apply_if_entire_document_valid = "Y"
25   - #portor.validate_only = "N"
26   - #portor.manual_serial_transfers_allowed = "N"
27   - #portor.ignore_analysis = "Y"
28   -
29   - #por_result = portor.call(user_id.guid)
30   - #assert_kind_of Syspro::BusinessObjects::Models::Por
31   - #end
32   -
33 18 def test_por_query
34 19 porqry = Syspro::BusinessObjects::PorQry.new
35 20  
36   - porqry.purchase_order = " 00001"
  21 + porqry.purchase_order = ' 00001'
37 22 porqry.include_stocked_lines = false
38 23 porqry.include_non_stocked_lines = false
39 24 porqry.include_freight_lines = false
... ... @@ -47,8 +32,8 @@ class PorTest &lt; Minitest::Test
47 32 porqry.include_requisition_routing = false
48 33 porqry.include_sales_orders = false
49 34 porqry.include_custom_forms = false
50   - porqry.filter_type = "A"
51   - porqry.filter_value = ""
  35 + porqry.filter_type = 'A'
  36 + porqry.filter_value = ''
52 37  
53 38 por_result = porqry.call(user_id.guid)
54 39 assert_kind_of(Syspro::BusinessObjects::Models::PorDetail, por_result)
... ...
test/portii_test.rb
... ... @@ -15,16 +15,16 @@ class PorTiiTest &lt; Minitest::Test
15 15  
16 16 def test_portii
17 17 req = Syspro::BusinessObjects::PorTii.new
18   -
  18 +
19 19 req.item_inspected = Syspro::BusinessObjects::Models::InventoryInspection.new
20   - req.item_inspected.grn_number = "P00012509"
  20 + req.item_inspected.grn_number = 'P00012509'
21 21 req.item_inspected.quantity = 12.312
22   - req.item_inspected.inspection_completed = "Y"
23   -
  22 + req.item_inspected.inspection_completed = 'Y'
  23 +
24 24 resp = req.call(user_id.guid)
25   -
26   - assert_equal resp.has_key?(:grn_numbers), true
27   - assert_equal resp.has_key?(:items_processed), true
28   - assert_equal resp.has_key?(:items_invalid), true
  25 +
  26 + assert_equal resp.key?(:grn_numbers), true
  27 + assert_equal resp.key?(:items_processed), true
  28 + assert_equal resp.key?(:items_invalid), true
29 29 end
30   -end
31 30 \ No newline at end of file
  31 +end
... ...
test/portoi_test.rb
... ... @@ -18,60 +18,60 @@ class PorToiTest &lt; Minitest::Test
18 18 po.purchase_order_header = Syspro::BusinessObjects::Models::PurchaseOrders::Header.new
19 19  
20 20 # Setup the PORTOI params
21   - po.validate_only = "N"
22   - po.ignore_warnings = "N"
23   - po.allow_non_stock_items = "N"
24   - po.allow_zero_price = "Y"
25   - po.validate_working_days = "N"
26   - po.allow_po_when_blanket_po = "N"
27   - po.default_memo_code = ""
28   - po.fixed_exchange_rate = "N"
  21 + po.validate_only = 'N'
  22 + po.ignore_warnings = 'N'
  23 + po.allow_non_stock_items = 'N'
  24 + po.allow_zero_price = 'Y'
  25 + po.validate_working_days = 'N'
  26 + po.allow_po_when_blanket_po = 'N'
  27 + po.default_memo_code = ''
  28 + po.fixed_exchange_rate = 'N'
29 29 po.default_memo_days = 0
30   - po.allow_blank_ledger_code = "Y"
31   - po.default_delivery_address = ""
32   - po.calc_due_date = "N"
33   - po.insert_dangerous_goods_text = "N"
34   - po.insert_additional_po_text = "N"
35   - po.status = "1"
  30 + po.allow_blank_ledger_code = 'Y'
  31 + po.default_delivery_address = ''
  32 + po.calc_due_date = 'N'
  33 + po.insert_dangerous_goods_text = 'N'
  34 + po.insert_additional_po_text = 'N'
  35 + po.status = '1'
36 36  
37 37 # Setup the purchase order header data attributes
38   - po.purchase_order_header.order_action_type = "A"
39   - po.purchase_order_header.order_type = "L"
40   - po.purchase_order_header.supplier = "WYC001"
41   - po.purchase_order_header.customer_po_number = "H01993-1"
42   - po.purchase_order_header.buyer = "PCD"
43   - po.purchase_order_header.warehouse = "P0"
44   - po.purchase_order_header.tax_status = "N"
45   - po.purchase_order_header.invoice_terms = "X"
46   - po.purchase_order_header.order_date = Time.now.strftime("%Y-%m-%d")
47   - po.purchase_order_header.apply_due_date_to_lines = "A"
  38 + po.purchase_order_header.order_action_type = 'A'
  39 + po.purchase_order_header.order_type = 'L'
  40 + po.purchase_order_header.supplier = 'WYC001'
  41 + po.purchase_order_header.customer_po_number = 'H01993-1'
  42 + po.purchase_order_header.buyer = 'PCD'
  43 + po.purchase_order_header.warehouse = 'P0'
  44 + po.purchase_order_header.tax_status = 'N'
  45 + po.purchase_order_header.invoice_terms = 'X'
  46 + po.purchase_order_header.order_date = Time.now.strftime('%Y-%m-%d')
  47 + po.purchase_order_header.apply_due_date_to_lines = 'A'
48 48 po.purchase_order_header.disc_percent1 = 0
49 49 po.purchase_order_header.disc_percent2 = 0
50 50 po.purchase_order_header.disc_percent3 = 0
51 51  
52 52 line1 = Syspro::BusinessObjects::Models::PurchaseOrders::StockLine.new
53 53 line1.purchase_order_line = 1
54   - line1.line_action_type = "A"
55   - line1.stock_code = "8801"
56   - line1.warehouse = "P0"
57   - line1.order_qty = "100"
58   - line1.order_uom = "KG"
59   - line1.pieces = "0"
60   - line1.price_method = "M"
  54 + line1.line_action_type = 'A'
  55 + line1.stock_code = '8801'
  56 + line1.warehouse = 'P0'
  57 + line1.order_qty = '100'
  58 + line1.order_uom = 'KG'
  59 + line1.pieces = '0'
  60 + line1.price_method = 'M'
61 61 line1.price = 0
62   - line1.line_disc_type = "P"
63   - line1.line_disc_less_plus = "L"
  62 + line1.line_disc_type = 'P'
  63 + line1.line_disc_less_plus = 'L'
64 64 line1.line_disc_percent1 = 0
65 65 line1.line_disc_percent2 = 0
66 66 line1.line_disc_percent3 = 0
67 67 line1.line_disc_value = 0
68   - line1.taxable = "N"
69   -
  68 + line1.taxable = 'N'
  69 +
70 70 po.order_details = Syspro::BusinessObjects::Models::PurchaseOrders::OrderDetails.new
71 71 po.order_details.stock_lines = [line1]
72   -
  72 +
73 73 syspro_po = po.call(user_id.guid)
74   -
  74 +
75 75 assert_equal syspro_po.error_numbers.length, 0
76 76 end
77   -end
78 77 \ No newline at end of file
  78 +end
... ...
test/portor_test.rb
... ... @@ -5,6 +5,9 @@ require &#39;test_helper&#39;
5 5 class PorTorTest < Minitest::Test
6 6 extend Minitest::Spec::DSL
7 7  
  8 + before { VCR.insert_cassette name }
  9 + after { VCR.eject_cassette }
  10 +
8 11 let(:username) { ENV['SYSPRO_USERNAME'] }
9 12 let(:password) { ENV['SYSPRO_PASSWORD'] }
10 13 let(:company) { ENV['SYSPRO_COMPANY'] }
... ... @@ -15,21 +18,21 @@ class PorTorTest &lt; Minitest::Test
15 18  
16 19 def test_portor
17 20 receipt_intero = Syspro::BusinessObjects::Models::ReceiptInterospection.new
18   - receipt_intero.purchase_order = "Z01310"
19   - receipt_intero.warehouse = "P0"
20   - receipt_intero.stock_code = "8801"
21   - receipt_intero.quantity = 10.21
22   - receipt_intero.delivery_note = "DELIVER NOTE HERE-WL"
23   - receipt_intero.certificate = "8/45-3"
24   - receipt_intero.lot = "7097505"
  21 + receipt_intero.purchase_order = 'Z01308'
  22 + receipt_intero.warehouse = 'P0'
  23 + receipt_intero.stock_code = '8801'
  24 + receipt_intero.quantity = 0.01
  25 + receipt_intero.delivery_note = 'DELIVER NOTE HERE-WL'
  26 + receipt_intero.certificate = '8/45-3'
  27 + receipt_intero.lot = '7097505'
25 28  
26 29 req = Syspro::BusinessObjects::PorTor.new
27   - req.transaction_date = Time.now.strftime("%Y-%m-%d")
28   - req.ignore_warnings = "N"
  30 + req.transaction_date = Time.now.strftime('%Y-%m-%d')
  31 + req.ignore_warnings = 'N'
29 32  
30 33 req.receipt_interospections = [receipt_intero]
31 34 resp = req.call(user_id.guid)
32 35  
33 36 assert_equal resp[:error_numbers].length, 0
34 37 end
35   -end
36 38 \ No newline at end of file
  39 +end
... ...