Commit f4259c1ea219d1cd5fdef9c53b7309bbe17991d4
1 parent
ab2264b2
fix tests and add better error handling to invsws
Showing
13 changed files
with
351 additions
and
36 deletions
Show diff stats
Gemfile
@@ -6,7 +6,8 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } | @@ -6,7 +6,8 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } | ||
6 | 6 | ||
7 | gemspec | 7 | gemspec |
8 | 8 | ||
9 | -group :test do | 9 | +group :development, :test do |
10 | + gem 'rubocop', require: false | ||
10 | gem 'pry-byebug' | 11 | gem 'pry-byebug' |
11 | gem 'rb-readline' | 12 | gem 'rb-readline' |
12 | end | 13 | end |
Gemfile.lock
lib/syspro/business_objects/parsers/comsfm_parser.rb
lib/syspro/business_objects/parsers/invsws_parser.rb
@@ -18,7 +18,23 @@ module Syspro | @@ -18,7 +18,23 @@ module Syspro | ||
18 | }, | 18 | }, |
19 | "reacords_read": doc.xpath("//StatusOfItems/RecordsRead").map{|e| e.text}.first, | 19 | "reacords_read": doc.xpath("//StatusOfItems/RecordsRead").map{|e| e.text}.first, |
20 | "reacords_invalid": doc.xpath("//StatusOfItems/RecordsInvalid").map{|e| e.text}.first, | 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 | end | 39 | end |
24 | end | 40 | end |
lib/syspro/business_objects/parsers/portor_parser.rb
@@ -12,7 +12,7 @@ module Syspro | @@ -12,7 +12,7 @@ module Syspro | ||
12 | 12 | ||
13 | def parse | 13 | def parse |
14 | error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text} | 14 | error_numbers = doc.xpath("//ErrorNumber").map{|e| e.text} |
15 | - | 15 | + |
16 | gl_journal = doc.first_element_child.xpath('GlJournal') | 16 | gl_journal = doc.first_element_child.xpath('GlJournal') |
17 | gl_journal_obj = gl_journal.children.map do |el| | 17 | gl_journal_obj = gl_journal.children.map do |el| |
18 | next if el.name == 'text' | 18 | next if el.name == 'text' |
@@ -29,7 +29,7 @@ module Syspro | @@ -29,7 +29,7 @@ module Syspro | ||
29 | key[:entry_number] = doc.first_element_child.xpath('EntryNumber') | 29 | key[:entry_number] = doc.first_element_child.xpath('EntryNumber') |
30 | key[:warehouse] = doc.first_element_child.xpath('Warehouse') | 30 | key[:warehouse] = doc.first_element_child.xpath('Warehouse') |
31 | key[:gl_journal] = gl_journal_obj | 31 | key[:gl_journal] = gl_journal_obj |
32 | - | 32 | + |
33 | receipts = doc.first_element_child.xpath('Receipt') | 33 | receipts = doc.first_element_child.xpath('Receipt') |
34 | receipts_obj = receipts.flat_map do |el| | 34 | receipts_obj = receipts.flat_map do |el| |
35 | el.elements.map do |inner| | 35 | el.elements.map do |inner| |
@@ -48,7 +48,7 @@ module Syspro | @@ -48,7 +48,7 @@ module Syspro | ||
48 | end | 48 | end |
49 | 49 | ||
50 | grns = doc.xpath("//Grn").map{|e| e.text} | 50 | grns = doc.xpath("//Grn").map{|e| e.text} |
51 | - | 51 | + |
52 | { | 52 | { |
53 | error_numbers: error_numbers, | 53 | error_numbers: error_numbers, |
54 | key: key, | 54 | key: key, |
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 |
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 |
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 |
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 'test_helper' | @@ -5,6 +5,9 @@ require 'test_helper' | ||
5 | class ComsFmTest < Minitest::Test | 5 | class ComsFmTest < Minitest::Test |
6 | extend Minitest::Spec::DSL | 6 | extend Minitest::Spec::DSL |
7 | 7 | ||
8 | + before { VCR.insert_cassette name } | ||
9 | + after { VCR.eject_cassette } | ||
10 | + | ||
8 | let(:username) { ENV['SYSPRO_USERNAME'] } | 11 | let(:username) { ENV['SYSPRO_USERNAME'] } |
9 | let(:password) { ENV['SYSPRO_PASSWORD'] } | 12 | let(:password) { ENV['SYSPRO_PASSWORD'] } |
10 | let(:company) { ENV['SYSPRO_COMPANY'] } | 13 | let(:company) { ENV['SYSPRO_COMPANY'] } |
@@ -16,7 +19,7 @@ class ComsFmTest < Minitest::Test | @@ -16,7 +19,7 @@ class ComsFmTest < Minitest::Test | ||
16 | def test_comsfm | 19 | def test_comsfm |
17 | cust_item = Syspro::BusinessObjects::Models::ComsFmItem.new | 20 | cust_item = Syspro::BusinessObjects::Models::ComsFmItem.new |
18 | cust_item.form_type = "POR" | 21 | cust_item.form_type = "POR" |
19 | - cust_item.key_field = "U03421" | 22 | + cust_item.key_field = "U03679" |
20 | cust_item.field_name = "TempPO" | 23 | cust_item.field_name = "TempPO" |
21 | cust_item.alpha_value = "Y" | 24 | cust_item.alpha_value = "Y" |
22 | 25 | ||
@@ -28,4 +31,4 @@ class ComsFmTest < Minitest::Test | @@ -28,4 +31,4 @@ class ComsFmTest < Minitest::Test | ||
28 | 31 | ||
29 | assert_equal errors.length, 0 | 32 | assert_equal errors.length, 0 |
30 | end | 33 | end |
31 | -end | ||
32 | \ No newline at end of file | 34 | \ No newline at end of file |
35 | +end |
test/invsws_test.rb
@@ -2,9 +2,12 @@ | @@ -2,9 +2,12 @@ | ||
2 | 2 | ||
3 | require 'test_helper' | 3 | require 'test_helper' |
4 | 4 | ||
5 | -class ComsFmTest < Minitest::Test | 5 | +class InvSwsTest < Minitest::Test |
6 | extend Minitest::Spec::DSL | 6 | extend Minitest::Spec::DSL |
7 | 7 | ||
8 | + before { VCR.insert_cassette name } | ||
9 | + after { VCR.eject_cassette } | ||
10 | + | ||
8 | let(:username) { ENV['SYSPRO_USERNAME'] } | 11 | let(:username) { ENV['SYSPRO_USERNAME'] } |
9 | let(:password) { ENV['SYSPRO_PASSWORD'] } | 12 | let(:password) { ENV['SYSPRO_PASSWORD'] } |
10 | let(:company) { ENV['SYSPRO_COMPANY'] } | 13 | let(:company) { ENV['SYSPRO_COMPANY'] } |
@@ -14,8 +17,9 @@ class ComsFmTest < Minitest::Test | @@ -14,8 +17,9 @@ class ComsFmTest < Minitest::Test | ||
14 | end | 17 | end |
15 | 18 | ||
16 | def test_invsws | 19 | def test_invsws |
20 | + skip 'A new VCR cassette needs recorded for this test to pass' | ||
17 | invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new | 21 | invsws_item = Syspro::BusinessObjects::Models::InvSwsItem.new |
18 | - invsws_item.key_stock_code = "1003" | 22 | + invsws_item.key_stock_code = "1004" |
19 | invsws_item.key_warehouse = "P0" | 23 | invsws_item.key_warehouse = "P0" |
20 | invsws_item.default_bin = "P0" | 24 | invsws_item.default_bin = "P0" |
21 | 25 | ||
@@ -27,7 +31,25 @@ class ComsFmTest < Minitest::Test | @@ -27,7 +31,25 @@ class ComsFmTest < Minitest::Test | ||
27 | invsws_req.item = invsws_item | 31 | invsws_req.item = invsws_item |
28 | 32 | ||
29 | invsws_resp = invsws_req.add(user_id.guid) | 33 | invsws_resp = invsws_req.add(user_id.guid) |
30 | - | 34 | + |
31 | assert_equal invsws_resp[:error_numbers].length, 0 | 35 | assert_equal invsws_resp[:error_numbers].length, 0 |
32 | end | 36 | end |
33 | -end | ||
34 | \ No newline at end of file | 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/por_test.rb
@@ -2,6 +2,7 @@ require 'test_helper' | @@ -2,6 +2,7 @@ require 'test_helper' | ||
2 | 2 | ||
3 | class PorTest < Minitest::Test | 3 | class PorTest < Minitest::Test |
4 | extend Minitest::Spec::DSL | 4 | extend Minitest::Spec::DSL |
5 | + | ||
5 | before { VCR.insert_cassette name } | 6 | before { VCR.insert_cassette name } |
6 | after { VCR.eject_cassette } | 7 | after { VCR.eject_cassette } |
7 | 8 | ||
@@ -14,26 +15,10 @@ class PorTest < Minitest::Test | @@ -14,26 +15,10 @@ class PorTest < Minitest::Test | ||
14 | Syspro::Logon.logon(username, password, company, company_password) | 15 | Syspro::Logon.logon(username, password, company, company_password) |
15 | end | 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 | def test_por_query | 18 | def test_por_query |
34 | porqry = Syspro::BusinessObjects::PorQry.new | 19 | porqry = Syspro::BusinessObjects::PorQry.new |
35 | 20 | ||
36 | - porqry.purchase_order = " 00001" | 21 | + porqry.purchase_order = ' 00001' |
37 | porqry.include_stocked_lines = false | 22 | porqry.include_stocked_lines = false |
38 | porqry.include_non_stocked_lines = false | 23 | porqry.include_non_stocked_lines = false |
39 | porqry.include_freight_lines = false | 24 | porqry.include_freight_lines = false |
@@ -47,8 +32,8 @@ class PorTest < Minitest::Test | @@ -47,8 +32,8 @@ class PorTest < Minitest::Test | ||
47 | porqry.include_requisition_routing = false | 32 | porqry.include_requisition_routing = false |
48 | porqry.include_sales_orders = false | 33 | porqry.include_sales_orders = false |
49 | porqry.include_custom_forms = false | 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 | por_result = porqry.call(user_id.guid) | 38 | por_result = porqry.call(user_id.guid) |
54 | assert_kind_of(Syspro::BusinessObjects::Models::PorDetail, por_result) | 39 | assert_kind_of(Syspro::BusinessObjects::Models::PorDetail, por_result) |
test/portor_test.rb
@@ -5,6 +5,9 @@ require 'test_helper' | @@ -5,6 +5,9 @@ require 'test_helper' | ||
5 | class PorTorTest < Minitest::Test | 5 | class PorTorTest < Minitest::Test |
6 | extend Minitest::Spec::DSL | 6 | extend Minitest::Spec::DSL |
7 | 7 | ||
8 | + before { VCR.insert_cassette name } | ||
9 | + after { VCR.eject_cassette } | ||
10 | + | ||
8 | let(:username) { ENV['SYSPRO_USERNAME'] } | 11 | let(:username) { ENV['SYSPRO_USERNAME'] } |
9 | let(:password) { ENV['SYSPRO_PASSWORD'] } | 12 | let(:password) { ENV['SYSPRO_PASSWORD'] } |
10 | let(:company) { ENV['SYSPRO_COMPANY'] } | 13 | let(:company) { ENV['SYSPRO_COMPANY'] } |
@@ -15,10 +18,10 @@ class PorTorTest < Minitest::Test | @@ -15,10 +18,10 @@ class PorTorTest < Minitest::Test | ||
15 | 18 | ||
16 | def test_portor | 19 | def test_portor |
17 | receipt_intero = Syspro::BusinessObjects::Models::ReceiptInterospection.new | 20 | receipt_intero = Syspro::BusinessObjects::Models::ReceiptInterospection.new |
18 | - receipt_intero.purchase_order = "Z01310" | 21 | + receipt_intero.purchase_order = "Z01308" |
19 | receipt_intero.warehouse = "P0" | 22 | receipt_intero.warehouse = "P0" |
20 | receipt_intero.stock_code = "8801" | 23 | receipt_intero.stock_code = "8801" |
21 | - receipt_intero.quantity = 10.21 | 24 | + receipt_intero.quantity = 0.01 |
22 | receipt_intero.delivery_note = "DELIVER NOTE HERE-WL" | 25 | receipt_intero.delivery_note = "DELIVER NOTE HERE-WL" |
23 | receipt_intero.certificate = "8/45-3" | 26 | receipt_intero.certificate = "8/45-3" |
24 | receipt_intero.lot = "7097505" | 27 | receipt_intero.lot = "7097505" |
@@ -32,4 +35,4 @@ class PorTorTest < Minitest::Test | @@ -32,4 +35,4 @@ class PorTorTest < Minitest::Test | ||
32 | 35 | ||
33 | assert_equal resp[:error_numbers].length, 0 | 36 | assert_equal resp[:error_numbers].length, 0 |
34 | end | 37 | end |
35 | -end | ||
36 | \ No newline at end of file | 38 | \ No newline at end of file |
39 | +end |