Commit b0dddc7fb9aa1f149d5875243baf70ae39bd2178

Authored by Isaac Lewis
1 parent d9177f32

change from sorqbs to sorqry; add parser; tests passing

lib/syspro.rb
... ... @@ -25,12 +25,14 @@ require 'syspro/api_operations/query'
25 25 require 'syspro/business_objects/combrw'
26 26 require 'syspro/business_objects/comfch'
27 27 require 'syspro/business_objects/comfnd'
28   -require 'syspro/business_objects/sorqbs'
  28 +require 'syspro/business_objects/sorqry'
  29 +
  30 +require 'syspro/business_objects/models/sor_detail'
29 31  
30 32 require 'syspro/business_objects/parsers/combrw_parser'
31 33 require 'syspro/business_objects/parsers/comfch_parser'
32 34 require 'syspro/business_objects/parsers/comfnd_parser'
33   -require 'syspro/business_objects/parsers/sorqbs_parser'
  35 +require 'syspro/business_objects/parsers/sorqry_parser'
34 36  
35 37 # Main Module
36 38 module Syspro
... ...
lib/syspro/business_objects/models/sor_detail.rb 0 → 100644
  1 +module Syspro
  2 + module BusinessObjects
  3 + module Models
  4 + class SorDetail
  5 + attr_accessor :sales_order, :document_type, :document_type_desc, :inter_branch_transfer, :inter_wh_sale,
  6 + :source_warehouse, :target_warehouse, :gtr_reference, :customer, :customer_name, :tax_status_code,
  7 + :tax_status, :gst_tax_status_code, :gst_tax_status, :eu_flag, :eu_flag_desc, :sold_to_name,
  8 + :sold_addr_1, :sold_addr_2, :sold_addr_3, :sold_addr_3_locality, :sold_addr_4, :sold_addr_5,
  9 + :sold_postal_code, :sold_gps_lat, :sold_gps_long, :salesperson, :scheduled_ord_flag, :disc_pct_1,
  10 + :disc_pct_2, :disc_pct_3, :salsls_name, :order_status, :order_status_desc, :customer_po_number,
  11 + :order_date, :git_reference, :req_ship_date, :shipping_instrs, :shipping_instrs_cod, :special_instrs,
  12 + :inv_terms_override, :delivery_note, :last_del_note, :time_del_prted_hh, :time_del_prted_mm, :last_invoice,
  13 + :date_last_inv_prt, :time_inv_prt_hh, :time_inv_prt_mm, :tblart_description, :branch, :salbrn_description,
  14 + :ent_invoice, :order_type, :area, :salare_description, :tax_exempt_number, :gst_exempt_number, :currency,
  15 + :tblcur_description, :ship_address_1, :ship_address_2, :ship_address_3, :ship_address_3_locality,
  16 + :ship_address_4, :ship_address_5, :ship_postal_code, :ship_gps_lat, :ship_gps_long, :ship_complete,
  17 + :email, :fix_exchange_rate, :exchange_rate, :edited_exchange_rate, :mul_div, :consolidated_order,
  18 + :gst_deduction, :credited_inv_date, :job, :serialized_flag, :counter_sales_flag, :nationality,
  19 + :delivery_terms, :shipping_location, :transaction_nature, :transport_mode, :process_flag,
  20 + :jobs_exist_flag, :alternate_key, :hierarchy_flag, :deposit_flag, :edi_source, :mult_ship_code,
  21 + :company_tax_no, :last_operator, :operator, :state, :county_zip, :extended_tax_code, :web_created,
  22 + :quote, :dispatches_made, :live_disp_exist, :num_dispatches, :include_in_mrp, :header_text,
  23 + :header_notes, :commissions
  24 + end
  25 + end
  26 + end
  27 +end
  28 +
... ...
lib/syspro/business_objects/parsers/sorqbs_parser.rb deleted
1   -# frozen_string_literal: true
2   -
3   -module Syspro
4   - module BusinessObjects
5   - module Parsers
6   - class SorQbs
7   - attr_reader :doc
8   -
9   - def initialize(doc)
10   - @doc = doc
11   - end
12   -
13   - def parse
14   - binding.pry
15   - sor = Syspro::BusinessObjects::Models::Sor.new()
16   - end
17   - end
18   - end
19   - end
20   -end
21   -
lib/syspro/business_objects/parsers/sorqry_parser.rb 0 → 100644
  1 +# frozen_string_literal: true
  2 +
  3 +module Syspro
  4 + module BusinessObjects
  5 + module Parsers
  6 + class SorQryParser
  7 + attr_reader :doc
  8 +
  9 + def initialize(doc)
  10 + @doc = doc
  11 + end
  12 +
  13 + def parse
  14 + sor = Syspro::BusinessObjects::Models::SorDetail.new()
  15 + sor.sales_order = doc.first_element_child.xpath("SalesOrder").text
  16 + sor.document_type = doc.first_element_child.xpath("DocumentType").text
  17 + sor.document_type_desc = doc.first_element_child.xpath("DocumentTypeDesc").text
  18 + sor.inter_branch_transfer = doc.first_element_child.xpath("InterBranchTransfer").text
  19 + sor.inter_wh_sale = doc.first_element_child.xpath("InterWhSale").text
  20 + sor.source_warehouse = doc.first_element_child.xpath("SourceWarehouse").text
  21 + sor.target_warehouse = doc.first_element_child.xpath("TargetWarehouse").text
  22 + sor.gtr_reference = doc.first_element_child.xpath("GtrReference").text
  23 + sor.customer = doc.first_element_child.xpath("Customer").text
  24 + sor.customer_name = doc.first_element_child.xpath("CustomerName").text
  25 + sor.tax_status_code = doc.first_element_child.xpath("TaxStatusCode").text
  26 + sor.tax_status = doc.first_element_child.xpath("TaxStatus").text
  27 + sor.gst_tax_status_code = doc.first_element_child.xpath("GstTaxStatusCode").text
  28 + sor.gst_tax_status = doc.first_element_child.xpath("GstTaxStatus").text
  29 + sor.eu_flag = doc.first_element_child.xpath("EuFlag").text
  30 + sor.eu_flag_desc = doc.first_element_child.xpath("EuFlagDesc").text
  31 + sor.sold_to_name = doc.first_element_child.xpath("SoldToName").text
  32 + sor.sold_addr_1 = doc.first_element_child.xpath("SoldAddr1").text
  33 + sor.sold_addr_2 = doc.first_element_child.xpath("SoldAddr2").text
  34 + sor.sold_addr_3 = doc.first_element_child.xpath("SoldAddr3").text
  35 + sor.sold_addr_3_locality = doc.first_element_child.xpath("SoldAddr3Locality").text
  36 + sor.sold_addr_4 = doc.first_element_child.xpath("SoldAddr4").text
  37 + sor.sold_addr_5 = doc.first_element_child.xpath("SoldAddr5").text
  38 + sor.sold_postal_code = doc.first_element_child.xpath("SoldPostalCode").text
  39 + sor.sold_gps_lat = doc.first_element_child.xpath("SoldGpsLat").text
  40 + sor.sold_gps_long = doc.first_element_child.xpath("SoldGpsLong").text
  41 + sor.salesperson = doc.first_element_child.xpath("Salesperson").text
  42 + sor.scheduled_ord_flag = doc.first_element_child.xpath("ScheduledOrdFlag").text
  43 + sor.disc_pct_1 = doc.first_element_child.xpath("DiscPct1").text
  44 + sor.disc_pct_2 = doc.first_element_child.xpath("DiscPct2").text
  45 + sor.disc_pct_3 = doc.first_element_child.xpath("DiscPct3").text
  46 + sor.salsls_name = doc.first_element_child.at_xpath('//SALSLS:Name').children.text
  47 + sor.order_status = doc.first_element_child.xpath("OrderStatus").text
  48 + sor.order_status_desc = doc.first_element_child.xpath("OrderStatusDesc").text
  49 + sor.customer_po_number = doc.first_element_child.xpath("CustomerPoNumber").text
  50 + sor.order_date = doc.first_element_child.xpath("OrderDate").text
  51 + sor.git_reference = doc.first_element_child.xpath("GITReference").text
  52 + sor.req_ship_date = doc.first_element_child.xpath("ReqShipDate").text
  53 + sor.shipping_instrs = doc.first_element_child.xpath("ShippingInstrs").text
  54 + sor.shipping_instrs_cod = doc.first_element_child.xpath("ShippingInstrsCod").text
  55 + sor.special_instrs = doc.first_element_child.xpath("SpecialInstrs").text
  56 + sor.inv_terms_override = doc.first_element_child.xpath("InvTermsOverride").text
  57 + sor.delivery_note = doc.first_element_child.xpath("DeliveryNote").text
  58 + sor.last_del_note = doc.first_element_child.xpath("LastDelNote").text
  59 + sor.time_del_prted_hh = doc.first_element_child.xpath("TimeDelPrtedHh").text
  60 + sor.time_del_prted_mm = doc.first_element_child.xpath("TimeDelPrtedMm").text
  61 + sor.last_invoice = doc.first_element_child.xpath("LastInvoice").text
  62 + sor.date_last_inv_prt = doc.first_element_child.xpath("DateLastInvPrt").text
  63 + sor.time_inv_prt_hh = doc.first_element_child.xpath("TimeInvPrtHh").text
  64 + sor.time_inv_prt_mm = doc.first_element_child.xpath("TimeInvPrtMm").text
  65 + sor.tblart_description = doc.first_element_child.xpath("//TBLART:Description").children.text
  66 + sor.branch = doc.first_element_child.xpath("Branch").text
  67 + sor.salbrn_description = doc.first_element_child.xpath("//SALBRN:Description").children.text
  68 + sor.ent_invoice = doc.first_element_child.xpath("EntInvoice").text
  69 + sor.order_type = doc.first_element_child.xpath("OrderType").text
  70 + sor.area = doc.first_element_child.xpath("Area").text
  71 + sor.salare_description = doc.first_element_child.xpath("//SALARE:Description").children.text
  72 + sor.tax_exempt_number = doc.first_element_child.xpath("TaxExemptNumber").text
  73 + sor.gst_exempt_number = doc.first_element_child.xpath("GstExemptNumber").text
  74 + sor.currency = doc.first_element_child.xpath("Currency").text
  75 + sor.tblcur_description = doc.first_element_child.xpath("//TBLCUR:Description").children.text
  76 + sor.ship_address_1 = doc.first_element_child.xpath("ShipAddress1").text
  77 + sor.ship_address_2 = doc.first_element_child.xpath("ShipAddress2").text
  78 + sor.ship_address_3 = doc.first_element_child.xpath("ShipAddress3").text
  79 + sor.ship_address_3_locality = doc.first_element_child.xpath("ShipAddress3Locality").text
  80 + sor.ship_address_4 = doc.first_element_child.xpath("ShipAddress4").text
  81 + sor.ship_address_5 = doc.first_element_child.xpath("ShipAddress5").text
  82 + sor.ship_postal_code = doc.first_element_child.xpath("ShipPostalCode").text
  83 + sor.ship_gps_lat = doc.first_element_child.xpath("ShipGpsLat").text
  84 + sor.ship_gps_long = doc.first_element_child.xpath("ShipGpsLong").text
  85 + sor.ship_complete = doc.first_element_child.xpath("ShipComplete").text
  86 + sor.email = doc.first_element_child.xpath("Email").text
  87 + sor.fix_exchange_rate = doc.first_element_child.xpath("FixExchangeRate").text
  88 + sor.exchange_rate = doc.first_element_child.xpath("ExchangeRate").text
  89 + sor.edited_exchange_rate = doc.first_element_child.xpath("EditedExchangeRate").text
  90 + sor.mul_div = doc.first_element_child.xpath("MulDiv").text
  91 + sor.consolidated_order = doc.first_element_child.xpath("ConsolidatedOrder").text
  92 + sor.gst_deduction = doc.first_element_child.xpath("GstDeduction").text
  93 + sor.credited_inv_date = doc.first_element_child.xpath("CreditedInvDate").text
  94 + sor.job = doc.first_element_child.xpath("Job").text
  95 + sor.serialized_flag = doc.first_element_child.xpath("SerializedFlag").text
  96 + sor.counter_sales_flag = doc.first_element_child.xpath("CounterSalesFlag").text
  97 + sor.nationality = doc.first_element_child.xpath("Nationality").text
  98 + sor.delivery_terms = doc.first_element_child.xpath("DeliveryTerms").text
  99 + sor.shipping_location = doc.first_element_child.xpath("ShippingLocation").text
  100 + sor.transaction_nature = doc.first_element_child.xpath("TransactionNature").text
  101 + sor.transport_mode = doc.first_element_child.xpath("TransportMode").text
  102 + sor.process_flag = doc.first_element_child.xpath("ProcessFlag").text
  103 + sor.jobs_exist_flag = doc.first_element_child.xpath("JobsExistFlag").text
  104 + sor.alternate_key = doc.first_element_child.xpath("AlternateKey").text
  105 + sor.hierarchy_flag = doc.first_element_child.xpath("HierarchyFlag").text
  106 + sor.deposit_flag = doc.first_element_child.xpath("DepositFlag").text
  107 + sor.edi_source = doc.first_element_child.xpath("EdiSource").text
  108 + sor.mult_ship_code = doc.first_element_child.xpath("MultShipCode").text
  109 + sor.company_tax_no = doc.first_element_child.xpath("CompanyTaxNo").text
  110 + sor.last_operator = doc.first_element_child.xpath("LastOperator").text
  111 + sor.operator = doc.first_element_child.xpath("Operator").text
  112 + sor.state = doc.first_element_child.xpath("State").text
  113 + sor.county_zip = doc.first_element_child.xpath("CountyZip").text
  114 + sor.extended_tax_code = doc.first_element_child.xpath("ExtendedTaxCode").text
  115 + sor.web_created = doc.first_element_child.xpath("WebCreated").text
  116 + sor.quote = doc.first_element_child.xpath("Quote").text
  117 + sor.dispatches_made = doc.first_element_child.xpath("DispatchesMade").text
  118 + sor.live_disp_exist = doc.first_element_child.xpath("LiveDispExist").text
  119 + sor.num_dispatches = doc.first_element_child.xpath("NumDispatches").text
  120 + sor.include_in_mrp = doc.first_element_child.xpath("IncludeInMrp").text
  121 + sor.header_text = doc.first_element_child.xpath("HeaderText").text
  122 + sor.header_notes = doc.first_element_child.xpath("HeaderNotes").text
  123 +
  124 + commissions = doc.first_element_child.xpath("Commissions")
  125 + commissions_obj = commissions.children.map do |el|
  126 + next if el.name == "text"
  127 + {
  128 + name: el.name,
  129 + text: el.text
  130 + }
  131 + end.compact
  132 + sor.commissions = commissions_obj
  133 +
  134 + sor
  135 + end
  136 + end
  137 + end
  138 + end
  139 +end
  140 +
... ...
lib/syspro/business_objects/schemas/sorqbs.xml.erb deleted
1   -<?xml version="1.0" encoding="Windows-1252"?>
2   -<Query xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="SORQBS.XSD">
3   - <Option>
4   - <IncludeSalesOrderDetails><%= @include_sales_order_details %></IncludeSalesOrderDetails>
5   - <IncludeContractDetails><%= @include_contact_details %></IncludeContractDetails>
6   - <IncludeDeliveryHistory><%= @include_delivery_history %></IncludeDeliveryHistory>
7   - <IncludeUnconfirmedReleases><%= @include_unconfirmed_releases %></IncludeUnconfirmedReleases>
8   - <IncludeConfirmedReleases><%= @include_confirmed_releases %></IncludeConfirmedReleases>
9   - <IncludeReleaseDetails><%= @include_release_details %></IncludeReleaseDetails>
10   - <IncludeReleaseHistory><%= @include_release_history %></IncludeReleaseHistory>
11   - </Option>
12   - <% unless @filters.empty? %>
13   - <Filter>
14   - <% for filter in @filters %>
15   - <<%= filter[:name] %> FilterType="<% filter[:type] %>" FilterValue="<% filter[:value] %>"/>
16   - <% end %>
17   - </Filter>
18   - <% end %>
19   -</Query>
20   -
lib/syspro/business_objects/schemas/sorqry.xml.erb 0 → 100644
  1 +<?xml version="1.0" encoding="Windows-1252"?>
  2 +<Query xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="SORQRY.XSD">
  3 + <Key>
  4 + <SalesOrder><%= @sales_order %></SalesOrder>
  5 + <% unless @invoice.nil? %>
  6 + <Invoice><%= @invoice %></Invoice>
  7 + <% end %>
  8 + </Key>
  9 + <Option>
  10 + <IncludeStockedLines><%= @stocked_lines ? "N" : "Y" %></IncludeStockedLines>
  11 + <IncludeNonStockedLines><%= @non_stocked_lines ? "N" : "Y" %></IncludeNonStockedLines>
  12 + <IncludeFreightLines><%= @freight_lines ? "N" : "Y" %></IncludeFreightLines>
  13 + <IncludeMiscLines><%= @misc_lines ? "N" : "Y" %></IncludeMiscLines>
  14 + <IncludeCommentLines><%= @comment_lines ? "N" : "Y" %></IncludeCommentLines>
  15 + <IncludeCompletedLines><%= @completed_lines ? "N" : "Y" %></IncludeCompletedLines>
  16 + <IncludeSerials><%= @serials ? "N" : "Y" %></IncludeSerials>
  17 + <IncludeLots><%= @lots ? "N" : "Y" %></IncludeLots>
  18 + <IncludeBins><%= @bins ? "N" : "Y" %></IncludeBins>
  19 + <IncludeAttachedItems><%= @attached_items ? "N" : "Y" %></IncludeAttachedItems>
  20 + <IncludeCustomForms><%= @custom_forms ? "N" : "Y" %></IncludeCustomForms>
  21 + <IncludeDetailLineCustomForms><%= @detail_line_custom_forms ? "N" : "Y" %></IncludeDetailLineCustomForms>
  22 + <IncludeValues><%= @values ? "N" : "Y" %></IncludeValues>
  23 + <ReturnLineShipDate><%= @line_ship_date ? "N" : "Y" %></ReturnLineShipDate>
  24 + <XslStylesheet/>
  25 + </Option>
  26 +</Query>
  27 +
... ...
lib/syspro/business_objects/sorqbs.rb renamed to lib/syspro/business_objects/sorqry.rb
1 1 # frozen_string_literal: true
2 2  
3   -require 'syspro/business_objects/parsers/sorqbs_parser'
  3 +require 'syspro/business_objects/parsers/sorqry_parser'
4 4 require 'erb'
5 5  
6 6 module Syspro
7 7 module BusinessObjects
8   - class SorQbs < ApiResource
  8 + class SorQry < ApiResource
9 9 include Syspro::ApiOperations::Query
10 10 include Syspro::BusinessObjects::Parsers
11 11  
12   - attr_accessor :include_sales_order_details, :include_contact_details, :include_delivery_history,
13   - :include_unconfirmed_releases, :include_confirmed_releases, :include_release_details,
14   - :include_release_history, :filters
  12 + attr_accessor :sales_order, :invoice, :stocked_lines, :non_stocked_lines, :freight_lines,
  13 + :misc_lines, :comment_lines, :completed_lines, :serials, :lots, :bins,
  14 + :attached_items, :custom_forms, :detail_line_custom_forms, :values, :line_ship_date
15 15  
16 16 def call(user_id)
17 17 xml_in = template.result(binding)
18   - business_object = 'SORQBS'
  18 + business_object = 'SORQRY'
19 19 params = { 'UserId' => user_id, 'BusinessObject' => business_object, 'XmlIn' => xml_in }
20   - resp = SorQbs.query(params)
  20 + resp = SorQry.query(params)
  21 +
21 22 parse_response(resp)
22 23 end
23 24  
24 25 def template
25   - ERB.new File.read(File.expand_path('schemas/sorqbs.xml.erb', File.dirname(__FILE__))), nil, '%'
  26 + ERB.new File.read(File.expand_path('schemas/sorqry.xml.erb', File.dirname(__FILE__))), nil, '%'
26 27 end
27 28  
28 29 def parse_response(resp)
29 30 handle_errors(resp)
30   - parser = SorQbsParser.new(respo[0].data)
  31 + parser = SorQryParser.new(resp[0].data)
31 32 parser.parse
32 33 end
33 34  
... ...
lib/syspro/get_logon_profile.rb
... ... @@ -18,7 +18,7 @@ module Syspro
18 18 OpenStruct.new(
19 19 company_name: doc.xpath('//CompanyName').text,
20 20 operator_code: doc.xpath('//OperatorCode').text,
21   - operator_code: doc.xpath('//OperatorGroup').text,
  21 + operator_group: doc.xpath('//OperatorGroup').text,
22 22 operator_email_address: doc.xpath('//OperatorEmailAddress').text,
23 23 operator_location: doc.xpath('//OperatorLocation').text,
24 24 operator_language_code: doc.xpath('//OperatorLanguageCode').text,
... ...
test/cassettes/test_sor_query.yml
... ... @@ -27,15 +27,15 @@ http_interactions:
27 27 Server:
28 28 - Microsoft-HTTPAPI/2.0
29 29 Date:
30   - - Wed, 11 Apr 2018 19:00:49 GMT
  30 + - Thu, 26 Apr 2018 19:08:08 GMT
31 31 body:
32 32 encoding: UTF-8
33   - string: 'E621DED6B5E98C4783D130230F6B29E700 '
  33 + string: 'E3333B82C68A4F4893184E2DE8C42E4A00 '
34 34 http_version:
35   - recorded_at: Wed, 11 Apr 2018 19:00:49 GMT
  35 + recorded_at: Thu, 26 Apr 2018 19:08:09 GMT
36 36 - request:
37 37 method: get
38   - uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Query/Query?BusinessObject=SORQBS&UserId=E621DED6B5E98C4783D130230F6B29E700%20%20&XmlIn=%3C?xml%20version=%221.0%22%20encoding=%22Windows-1252%22?%3E%0A%3CQuery%20xmlns:xsd=%22http://www.w3.org/2001/XMLSchema-instance%22%20xsd:noNamespaceSchemaLocation=%22SORQBS.XSD%22%3E%0A%20%20%3COption%3E%0A%20%20%20%20%3CIncludeSalesOrderDetails%3Etrue%3C/IncludeSalesOrderDetails%3E%0A%20%20%20%20%3CIncludeContractDetails%3Etrue%3C/IncludeContractDetails%3E%0A%20%20%20%20%3CIncludeDeliveryHistory%3Etrue%3C/IncludeDeliveryHistory%3E%0A%20%20%20%20%3CIncludeUnconfirmedReleases%3Etrue%3C/IncludeUnconfirmedReleases%3E%0A%20%20%20%20%3CIncludeConfirmedReleases%3Etrue%3C/IncludeConfirmedReleases%3E%0A%20%20%20%20%3CIncludeReleaseDetails%3Etrue%3C/IncludeReleaseDetails%3E%0A%20%20%20%20%3CIncludeReleaseHistory%3Etrue%3C/IncludeReleaseHistory%3E%0A%20%20%3C/Option%3E%0A%20%20%20%0A%20%20%20%20%3CFilter%3E%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%3CCustomer%20FilterType=%22%22%20FilterValue=%22%22/%3E%0A%20%20%20%20%20%20%0A%20%20%20%20%3C/Filter%3E%0A%20%20%0A%3C/Query%3E%0A%0A
  38 + uri: http://syspro.wildlandlabs.com:90/SYSPROWCFService/Rest/Query/Query?BusinessObject=SORQRY&UserId=E3333B82C68A4F4893184E2DE8C42E4A00%20%20&XmlIn=%3C?xml%20version=%221.0%22%20encoding=%22Windows-1252%22?%3E%0A%3CQuery%20xmlns:xsd=%22http://www.w3.org/2001/XMLSchema-instance%22%20xsd:noNamespaceSchemaLocation=%22SORQRY.XSD%22%3E%0A%20%20%3CKey%3E%0A%20%20%20%20%3CSalesOrder%3E16R069%3C/SalesOrder%3E%0A%20%20%20%20%0A%20%20%3C/Key%3E%0A%20%20%3COption%3E%0A%20%20%20%20%3CIncludeStockedLines%3EN%3C/IncludeStockedLines%3E%0A%20%20%20%20%20%20%3CIncludeNonStockedLines%3EN%3C/IncludeNonStockedLines%3E%0A%20%20%20%20%20%20%3CIncludeFreightLines%3EN%3C/IncludeFreightLines%3E%0A%20%20%20%20%20%20%3CIncludeMiscLines%3EN%3C/IncludeMiscLines%3E%0A%20%20%20%20%20%20%3CIncludeCommentLines%3EN%3C/IncludeCommentLines%3E%0A%20%20%20%20%20%20%3CIncludeCompletedLines%3EN%3C/IncludeCompletedLines%3E%0A%20%20%20%20%20%20%3CIncludeSerials%3EN%3C/IncludeSerials%3E%0A%20%20%20%20%20%20%3CIncludeLots%3EN%3C/IncludeLots%3E%0A%20%20%20%20%20%20%3CIncludeBins%3EN%3C/IncludeBins%3E%0A%20%20%20%20%20%20%3CIncludeAttachedItems%3EN%3C/IncludeAttachedItems%3E%0A%20%20%20%20%20%20%3CIncludeCustomForms%3EN%3C/IncludeCustomForms%3E%0A%20%20%20%20%20%20%3CIncludeDetailLineCustomForms%3EN%3C/IncludeDetailLineCustomForms%3E%0A%20%20%20%20%20%20%3CIncludeValues%3EN%3C/IncludeValues%3E%0A%20%20%20%20%20%20%3CReturnLineShipDate%3EN%3C/ReturnLineShipDate%3E%0A%20%20%20%20%20%20%3CXslStylesheet/%3E%0A%20%20%3C/Option%3E%0A%3C/Query%3E%0A%0A
39 39 body:
40 40 encoding: US-ASCII
41 41 string: ''
... ... @@ -54,17 +54,33 @@ http_interactions:
54 54 message: OK
55 55 headers:
56 56 Content-Length:
57   - - '102'
  57 + - '3812'
58 58 Content-Type:
59 59 - application/octet-stream
60 60 Server:
61 61 - Microsoft-HTTPAPI/2.0
62 62 Date:
63   - - Wed, 11 Apr 2018 19:00:53 GMT
  63 + - Thu, 26 Apr 2018 19:08:15 GMT
64 64 body:
65 65 encoding: UTF-8
66   - string: 'ERROR: Access denied to Functional Area ''SorBlanketSo'' for operator
67   - ''WLAND'' (Business Object ''SORQBS'')'
  66 + string: "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n<SorDetail Language='05'
  67 + Language2='EN' CssStyle='' DecFormat='1' DateFormat='01' Role='01' Version='7.0.047'
  68 + OperatorPrimaryRole=' ' xmlns:SALARE=\"SALARE\" xmlns:SALSLS=\"SALSLS\"
  69 + xmlns:TBLART=\"TBLART\" xmlns:SALBRN=\"SALBRN\" xmlns:TBLCUR=\"TBLCUR\" >\n<SalesOrder>16R069</SalesOrder>\n<DocumentType>O</DocumentType>\n<DocumentTypeDesc>Order</DocumentTypeDesc>\n<InterBranchTransfer/>\n<InterWhSale/>\n<SourceWarehouse/>\n<TargetWarehouse/>\n<GtrReference/>\n<Customer>SYM000</Customer>\n<CustomerName>SYMRISE
  70 + GLOBAL</CustomerName>\n<TaxStatusCode>E</TaxStatusCode>\n<TaxStatus>Exempt
  71 + from tax</TaxStatus>\n<GSTTaxStatusCode>E</GSTTaxStatusCode>\n<GSTTaxStatus>Exempt
  72 + from tax</GSTTaxStatus>\n<EUFlag>N</EUFlag>\n<EUFlagDesc>EU</EUFlagDesc>\n<SoldToName>SYMRISE
  73 + GLOBAL</SoldToName>\n<SoldAddr1>FR KREDITOREN</SoldAddr1>\n<SoldAddr2>POSTFACH
  74 + 1253</SoldAddr2>\n<SoldAddr3>D-37601 HOLZMINDEN</SoldAddr3>\n<SoldAddr3Locality/>\n<SoldAddr4>GERMANY</SoldAddr4>\n<SoldAddr5/>\n<SoldPostalCode/>\n<SoldGpsLat>
  75 + \ 0.000000</SoldGpsLat>\n<SoldGpsLong> 0.000000</SoldGpsLong>\n<Salesperson>DAL</Salesperson>\n<ScheduledOrdFlag/>\n<DiscPct1>0.00</DiscPct1>\n<DiscPct2>0.00</DiscPct2>\n<DiscPct3>0.00</DiscPct3>\n<Commissions>\n<Salesperson>DAL</Salesperson>\n<CommissionSales1>0.00</CommissionSales1>\n<Edited_CommissionSales1>0.00</Edited_CommissionSales1>\n<Salesperson2/>\n<CommissionSales2>0.00</CommissionSales2>\n<Edited_CommissionSales2>0.00</Edited_CommissionSales2>\n<Salesperson3/>\n<CommissionSales3>0.00</CommissionSales3>\n<Edited_CommissionSales3>0.00</Edited_CommissionSales3>\n<Salesperson4/>\n<CommissionSales4>0.00</CommissionSales4>\n<Edited_CommissionSales4>0.00</Edited_CommissionSales4>\n</Commissions>\n<SALSLS:Name>DAN
  76 + A LABBEE</SALSLS:Name>\n<OrderStatus>*</OrderStatus>\n<OrderStatusDesc>Cancelled
  77 + during entry</OrderStatusDesc>\n<CustomerPoNumber/>\n<OrderDate>2014-08-13</OrderDate>\n<GITReference/>\n<ReqShipDate>2017-05-31</ReqShipDate>\n<ShippingInstrs/>\n<ShippingInstrsCod/>\n<SpecialInstrs/>\n<InvTermsOverride>3</InvTermsOverride>\n<DeliveryNote/>\n<LastDelNote/>\n<TimeDelPrtedHh>00</TimeDelPrtedHh>\n<TimeDelPrtedMm>00</TimeDelPrtedMm>\n<LastInvoice/>\n<DateLastInvPrt/>\n<TimeInvPrtedHh>00</TimeInvPrtedHh>\n<TimeInvPrtedMm>00</TimeInvPrtedMm>\n<TBLART:Description>NET
  78 + 30 DAYS</TBLART:Description>\n<Branch>HQ</Branch>\n<SALBRN:Description>HARRAH,
  79 + WASHINGTON RECEIVABLES</SALBRN:Description>\n<EntInvoice/>\n<OrderType/>\n<Area>FG</Area>\n<SALARE:Description>FOREIGN</SALARE:Description>\n<TaxExemptNumber/>\n<GstExemptNum/>\n<Currency>$</Currency>\n<TBLCUR:Description>DOLLAR</TBLCUR:Description>\n<ShipAddress1>IMPORTANT</ShipAddress1>\n<ShipAddress2>THIS
  80 + IS A GLOBAL ACCOUNT</ShipAddress2>\n<ShipAddress3>USED TO HOLD</ShipAddress3>\n<ShipAddress3Locality/>\n<ShipAddress4>SCHEDULED
  81 + ORDERS ON CONTRACTS</ShipAddress4>\n<ShipAddress5>DO NOT SHIP FROM GLOBAL</ShipAddress5>\n<ShipPostalCode/>\n<ShipGpsLat>
  82 + \ 0.000000</ShipGpsLat>\n<ShipGpsLong> 0.000000</ShipGpsLong>\n<ShipComplete>N</ShipComplete>\n<Email/>\n<FixExchangeRate>N</FixExchangeRate>\n<ExchangeRate>
  83 + \ 1.000000</ExchangeRate>\n<Edited_ExchangeRate>1.000000</Edited_ExchangeRate>\n<MulDiv>M</MulDiv>\n<ConsolidatedOrder/>\n<GstDeduction>I</GstDeduction>\n<CreditedInvDate/>\n<Job/>\n<SerialisedFlag/>\n<CounterSalesFlag/>\n<Nationality/>\n<DeliveryTerms/>\n<ShippingLocation/>\n<TransactionNature>000</TransactionNature>\n<TransportMode>00</TransportMode>\n<ProcessFlag>0</ProcessFlag>\n<JobsExistFlag/>\n<AlternateKey/>\n<HierarchyFlag/>\n<DepositFlag/>\n<EdiSource/>\n<MultShipCode/>\n<CompanyTaxNo/>\n<LastOperator>MATTB</LastOperator>\n<Operator/>\n<State/>\n<CountyZip/>\n<ExtendedTaxCode/>\n<WebCreated/>\n<Quote/>\n<DispatchesMade/>\n<LiveDispExist/>\n<NumDispatches>0</NumDispatches>\n<IncludeInMrp>Y</IncludeInMrp>\n<HeaderText>\n</HeaderText>\n<HeaderNotes>\n</HeaderNotes>\n</SorDetail>\n "
68 84 http_version:
69   - recorded_at: Wed, 11 Apr 2018 19:00:53 GMT
  85 + recorded_at: Thu, 26 Apr 2018 19:08:15 GMT
70 86 recorded_with: VCR 4.0.0
... ...
test/sor_test.rb
... ... @@ -16,21 +16,27 @@ class SorTest &lt; Minitest::Test
16 16 end
17 17  
18 18 def test_sor_query
19   - sorqbs = Syspro::BusinessObjects::SorQbs.new
  19 + sorqbs = Syspro::BusinessObjects::SorQry.new
20 20  
21   - sorqbs.include_sales_order_details = true
22   - sorqbs.include_contact_details = true
23   - sorqbs.include_delivery_history = true
24   - sorqbs.include_unconfirmed_releases = true
25   - sorqbs.include_confirmed_releases = true
26   - sorqbs.include_release_details = true
27   - sorqbs.include_release_history = true
28   - sorqbs.filters = [
29   - { name: 'Customer', type: 'A', value: 'JJJ001' }
30   - ]
  21 + sorqbs.sales_order = '16R069'
  22 + sorqbs.invoice = nil
  23 + sorqbs.stocked_lines = true
  24 + sorqbs.non_stocked_lines = true
  25 + sorqbs.freight_lines = true
  26 + sorqbs.misc_lines = true
  27 + sorqbs.comment_lines = true
  28 + sorqbs.completed_lines = true
  29 + sorqbs.serials = true
  30 + sorqbs.lots = true
  31 + sorqbs.bins = true
  32 + sorqbs.attached_items = true
  33 + sorqbs.custom_forms = true
  34 + sorqbs.detail_line_custom_forms = true
  35 + sorqbs.values = true
  36 + sorqbs.line_ship_date = true
31 37  
32 38 sor_result = sorqbs.call(user_id.guid)
33   - refute_nil sor_result
  39 + assert_kind_of Syspro::BusinessObjects::Models::SorDetail, sor_result
34 40 end
35 41 end
36 42  
... ...