diff --git a/lib/syspro.rb b/lib/syspro.rb index 2228d96..3c1d79b 100644 --- a/lib/syspro.rb +++ b/lib/syspro.rb @@ -25,12 +25,14 @@ require 'syspro/api_operations/query' require 'syspro/business_objects/combrw' require 'syspro/business_objects/comfch' require 'syspro/business_objects/comfnd' -require 'syspro/business_objects/sorqbs' +require 'syspro/business_objects/sorqry' + +require 'syspro/business_objects/models/sor_detail' require 'syspro/business_objects/parsers/combrw_parser' require 'syspro/business_objects/parsers/comfch_parser' require 'syspro/business_objects/parsers/comfnd_parser' -require 'syspro/business_objects/parsers/sorqbs_parser' +require 'syspro/business_objects/parsers/sorqry_parser' # Main Module module Syspro diff --git a/lib/syspro/business_objects/models/sor_detail.rb b/lib/syspro/business_objects/models/sor_detail.rb new file mode 100644 index 0000000..d4d059f --- /dev/null +++ b/lib/syspro/business_objects/models/sor_detail.rb @@ -0,0 +1,28 @@ +module Syspro + module BusinessObjects + module Models + class SorDetail + attr_accessor :sales_order, :document_type, :document_type_desc, :inter_branch_transfer, :inter_wh_sale, + :source_warehouse, :target_warehouse, :gtr_reference, :customer, :customer_name, :tax_status_code, + :tax_status, :gst_tax_status_code, :gst_tax_status, :eu_flag, :eu_flag_desc, :sold_to_name, + :sold_addr_1, :sold_addr_2, :sold_addr_3, :sold_addr_3_locality, :sold_addr_4, :sold_addr_5, + :sold_postal_code, :sold_gps_lat, :sold_gps_long, :salesperson, :scheduled_ord_flag, :disc_pct_1, + :disc_pct_2, :disc_pct_3, :salsls_name, :order_status, :order_status_desc, :customer_po_number, + :order_date, :git_reference, :req_ship_date, :shipping_instrs, :shipping_instrs_cod, :special_instrs, + :inv_terms_override, :delivery_note, :last_del_note, :time_del_prted_hh, :time_del_prted_mm, :last_invoice, + :date_last_inv_prt, :time_inv_prt_hh, :time_inv_prt_mm, :tblart_description, :branch, :salbrn_description, + :ent_invoice, :order_type, :area, :salare_description, :tax_exempt_number, :gst_exempt_number, :currency, + :tblcur_description, :ship_address_1, :ship_address_2, :ship_address_3, :ship_address_3_locality, + :ship_address_4, :ship_address_5, :ship_postal_code, :ship_gps_lat, :ship_gps_long, :ship_complete, + :email, :fix_exchange_rate, :exchange_rate, :edited_exchange_rate, :mul_div, :consolidated_order, + :gst_deduction, :credited_inv_date, :job, :serialized_flag, :counter_sales_flag, :nationality, + :delivery_terms, :shipping_location, :transaction_nature, :transport_mode, :process_flag, + :jobs_exist_flag, :alternate_key, :hierarchy_flag, :deposit_flag, :edi_source, :mult_ship_code, + :company_tax_no, :last_operator, :operator, :state, :county_zip, :extended_tax_code, :web_created, + :quote, :dispatches_made, :live_disp_exist, :num_dispatches, :include_in_mrp, :header_text, + :header_notes, :commissions + end + end + end +end + diff --git a/lib/syspro/business_objects/parsers/sorqbs_parser.rb b/lib/syspro/business_objects/parsers/sorqbs_parser.rb deleted file mode 100644 index 6cbe183..0000000 --- a/lib/syspro/business_objects/parsers/sorqbs_parser.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: true - -module Syspro - module BusinessObjects - module Parsers - class SorQbs - attr_reader :doc - - def initialize(doc) - @doc = doc - end - - def parse - binding.pry - sor = Syspro::BusinessObjects::Models::Sor.new() - end - end - end - end -end - diff --git a/lib/syspro/business_objects/parsers/sorqry_parser.rb b/lib/syspro/business_objects/parsers/sorqry_parser.rb new file mode 100644 index 0000000..6ef6f0b --- /dev/null +++ b/lib/syspro/business_objects/parsers/sorqry_parser.rb @@ -0,0 +1,140 @@ +# frozen_string_literal: true + +module Syspro + module BusinessObjects + module Parsers + class SorQryParser + attr_reader :doc + + def initialize(doc) + @doc = doc + end + + def parse + sor = Syspro::BusinessObjects::Models::SorDetail.new() + sor.sales_order = doc.first_element_child.xpath("SalesOrder").text + sor.document_type = doc.first_element_child.xpath("DocumentType").text + sor.document_type_desc = doc.first_element_child.xpath("DocumentTypeDesc").text + sor.inter_branch_transfer = doc.first_element_child.xpath("InterBranchTransfer").text + sor.inter_wh_sale = doc.first_element_child.xpath("InterWhSale").text + sor.source_warehouse = doc.first_element_child.xpath("SourceWarehouse").text + sor.target_warehouse = doc.first_element_child.xpath("TargetWarehouse").text + sor.gtr_reference = doc.first_element_child.xpath("GtrReference").text + sor.customer = doc.first_element_child.xpath("Customer").text + sor.customer_name = doc.first_element_child.xpath("CustomerName").text + sor.tax_status_code = doc.first_element_child.xpath("TaxStatusCode").text + sor.tax_status = doc.first_element_child.xpath("TaxStatus").text + sor.gst_tax_status_code = doc.first_element_child.xpath("GstTaxStatusCode").text + sor.gst_tax_status = doc.first_element_child.xpath("GstTaxStatus").text + sor.eu_flag = doc.first_element_child.xpath("EuFlag").text + sor.eu_flag_desc = doc.first_element_child.xpath("EuFlagDesc").text + sor.sold_to_name = doc.first_element_child.xpath("SoldToName").text + sor.sold_addr_1 = doc.first_element_child.xpath("SoldAddr1").text + sor.sold_addr_2 = doc.first_element_child.xpath("SoldAddr2").text + sor.sold_addr_3 = doc.first_element_child.xpath("SoldAddr3").text + sor.sold_addr_3_locality = doc.first_element_child.xpath("SoldAddr3Locality").text + sor.sold_addr_4 = doc.first_element_child.xpath("SoldAddr4").text + sor.sold_addr_5 = doc.first_element_child.xpath("SoldAddr5").text + sor.sold_postal_code = doc.first_element_child.xpath("SoldPostalCode").text + sor.sold_gps_lat = doc.first_element_child.xpath("SoldGpsLat").text + sor.sold_gps_long = doc.first_element_child.xpath("SoldGpsLong").text + sor.salesperson = doc.first_element_child.xpath("Salesperson").text + sor.scheduled_ord_flag = doc.first_element_child.xpath("ScheduledOrdFlag").text + sor.disc_pct_1 = doc.first_element_child.xpath("DiscPct1").text + sor.disc_pct_2 = doc.first_element_child.xpath("DiscPct2").text + sor.disc_pct_3 = doc.first_element_child.xpath("DiscPct3").text + sor.salsls_name = doc.first_element_child.at_xpath('//SALSLS:Name').children.text + sor.order_status = doc.first_element_child.xpath("OrderStatus").text + sor.order_status_desc = doc.first_element_child.xpath("OrderStatusDesc").text + sor.customer_po_number = doc.first_element_child.xpath("CustomerPoNumber").text + sor.order_date = doc.first_element_child.xpath("OrderDate").text + sor.git_reference = doc.first_element_child.xpath("GITReference").text + sor.req_ship_date = doc.first_element_child.xpath("ReqShipDate").text + sor.shipping_instrs = doc.first_element_child.xpath("ShippingInstrs").text + sor.shipping_instrs_cod = doc.first_element_child.xpath("ShippingInstrsCod").text + sor.special_instrs = doc.first_element_child.xpath("SpecialInstrs").text + sor.inv_terms_override = doc.first_element_child.xpath("InvTermsOverride").text + sor.delivery_note = doc.first_element_child.xpath("DeliveryNote").text + sor.last_del_note = doc.first_element_child.xpath("LastDelNote").text + sor.time_del_prted_hh = doc.first_element_child.xpath("TimeDelPrtedHh").text + sor.time_del_prted_mm = doc.first_element_child.xpath("TimeDelPrtedMm").text + sor.last_invoice = doc.first_element_child.xpath("LastInvoice").text + sor.date_last_inv_prt = doc.first_element_child.xpath("DateLastInvPrt").text + sor.time_inv_prt_hh = doc.first_element_child.xpath("TimeInvPrtHh").text + sor.time_inv_prt_mm = doc.first_element_child.xpath("TimeInvPrtMm").text + sor.tblart_description = doc.first_element_child.xpath("//TBLART:Description").children.text + sor.branch = doc.first_element_child.xpath("Branch").text + sor.salbrn_description = doc.first_element_child.xpath("//SALBRN:Description").children.text + sor.ent_invoice = doc.first_element_child.xpath("EntInvoice").text + sor.order_type = doc.first_element_child.xpath("OrderType").text + sor.area = doc.first_element_child.xpath("Area").text + sor.salare_description = doc.first_element_child.xpath("//SALARE:Description").children.text + sor.tax_exempt_number = doc.first_element_child.xpath("TaxExemptNumber").text + sor.gst_exempt_number = doc.first_element_child.xpath("GstExemptNumber").text + sor.currency = doc.first_element_child.xpath("Currency").text + sor.tblcur_description = doc.first_element_child.xpath("//TBLCUR:Description").children.text + sor.ship_address_1 = doc.first_element_child.xpath("ShipAddress1").text + sor.ship_address_2 = doc.first_element_child.xpath("ShipAddress2").text + sor.ship_address_3 = doc.first_element_child.xpath("ShipAddress3").text + sor.ship_address_3_locality = doc.first_element_child.xpath("ShipAddress3Locality").text + sor.ship_address_4 = doc.first_element_child.xpath("ShipAddress4").text + sor.ship_address_5 = doc.first_element_child.xpath("ShipAddress5").text + sor.ship_postal_code = doc.first_element_child.xpath("ShipPostalCode").text + sor.ship_gps_lat = doc.first_element_child.xpath("ShipGpsLat").text + sor.ship_gps_long = doc.first_element_child.xpath("ShipGpsLong").text + sor.ship_complete = doc.first_element_child.xpath("ShipComplete").text + sor.email = doc.first_element_child.xpath("Email").text + sor.fix_exchange_rate = doc.first_element_child.xpath("FixExchangeRate").text + sor.exchange_rate = doc.first_element_child.xpath("ExchangeRate").text + sor.edited_exchange_rate = doc.first_element_child.xpath("EditedExchangeRate").text + sor.mul_div = doc.first_element_child.xpath("MulDiv").text + sor.consolidated_order = doc.first_element_child.xpath("ConsolidatedOrder").text + sor.gst_deduction = doc.first_element_child.xpath("GstDeduction").text + sor.credited_inv_date = doc.first_element_child.xpath("CreditedInvDate").text + sor.job = doc.first_element_child.xpath("Job").text + sor.serialized_flag = doc.first_element_child.xpath("SerializedFlag").text + sor.counter_sales_flag = doc.first_element_child.xpath("CounterSalesFlag").text + sor.nationality = doc.first_element_child.xpath("Nationality").text + sor.delivery_terms = doc.first_element_child.xpath("DeliveryTerms").text + sor.shipping_location = doc.first_element_child.xpath("ShippingLocation").text + sor.transaction_nature = doc.first_element_child.xpath("TransactionNature").text + sor.transport_mode = doc.first_element_child.xpath("TransportMode").text + sor.process_flag = doc.first_element_child.xpath("ProcessFlag").text + sor.jobs_exist_flag = doc.first_element_child.xpath("JobsExistFlag").text + sor.alternate_key = doc.first_element_child.xpath("AlternateKey").text + sor.hierarchy_flag = doc.first_element_child.xpath("HierarchyFlag").text + sor.deposit_flag = doc.first_element_child.xpath("DepositFlag").text + sor.edi_source = doc.first_element_child.xpath("EdiSource").text + sor.mult_ship_code = doc.first_element_child.xpath("MultShipCode").text + sor.company_tax_no = doc.first_element_child.xpath("CompanyTaxNo").text + sor.last_operator = doc.first_element_child.xpath("LastOperator").text + sor.operator = doc.first_element_child.xpath("Operator").text + sor.state = doc.first_element_child.xpath("State").text + sor.county_zip = doc.first_element_child.xpath("CountyZip").text + sor.extended_tax_code = doc.first_element_child.xpath("ExtendedTaxCode").text + sor.web_created = doc.first_element_child.xpath("WebCreated").text + sor.quote = doc.first_element_child.xpath("Quote").text + sor.dispatches_made = doc.first_element_child.xpath("DispatchesMade").text + sor.live_disp_exist = doc.first_element_child.xpath("LiveDispExist").text + sor.num_dispatches = doc.first_element_child.xpath("NumDispatches").text + sor.include_in_mrp = doc.first_element_child.xpath("IncludeInMrp").text + sor.header_text = doc.first_element_child.xpath("HeaderText").text + sor.header_notes = doc.first_element_child.xpath("HeaderNotes").text + + commissions = doc.first_element_child.xpath("Commissions") + commissions_obj = commissions.children.map do |el| + next if el.name == "text" + { + name: el.name, + text: el.text + } + end.compact + sor.commissions = commissions_obj + + sor + end + end + end + end +end + diff --git a/lib/syspro/business_objects/schemas/sorqbs.xml.erb b/lib/syspro/business_objects/schemas/sorqbs.xml.erb deleted file mode 100644 index 15e5ae7..0000000 --- a/lib/syspro/business_objects/schemas/sorqbs.xml.erb +++ /dev/null @@ -1,20 +0,0 @@ - - - - <% unless @filters.empty? %> - - <% for filter in @filters %> - <<%= filter[:name] %> FilterType="<% filter[:type] %>" FilterValue="<% filter[:value] %>"/> - <% end %> - - <% end %> - - diff --git a/lib/syspro/business_objects/schemas/sorqry.xml.erb b/lib/syspro/business_objects/schemas/sorqry.xml.erb new file mode 100644 index 0000000..b37d0cc --- /dev/null +++ b/lib/syspro/business_objects/schemas/sorqry.xml.erb @@ -0,0 +1,27 @@ + + + + <%= @sales_order %> + <% unless @invoice.nil? %> + <%= @invoice %> + <% end %> + + + + diff --git a/lib/syspro/business_objects/sorqbs.rb b/lib/syspro/business_objects/sorqbs.rb deleted file mode 100644 index fba668b..0000000 --- a/lib/syspro/business_objects/sorqbs.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'syspro/business_objects/parsers/sorqbs_parser' -require 'erb' - -module Syspro - module BusinessObjects - class SorQbs < ApiResource - include Syspro::ApiOperations::Query - include Syspro::BusinessObjects::Parsers - - attr_accessor :include_sales_order_details, :include_contact_details, :include_delivery_history, - :include_unconfirmed_releases, :include_confirmed_releases, :include_release_details, - :include_release_history, :filters - - def call(user_id) - xml_in = template.result(binding) - business_object = 'SORQBS' - params = { 'UserId' => user_id, 'BusinessObject' => business_object, 'XmlIn' => xml_in } - resp = SorQbs.query(params) - parse_response(resp) - end - - def template - ERB.new File.read(File.expand_path('schemas/sorqbs.xml.erb', File.dirname(__FILE__))), nil, '%' - end - - def parse_response(resp) - handle_errors(resp) - parser = SorQbsParser.new(respo[0].data) - parser.parse - end - - def handle_errors(resp) - body = resp[0].http_body - raise SysproError, body if body =~ /^(ERROR)/ - end - end - end -end - diff --git a/lib/syspro/business_objects/sorqry.rb b/lib/syspro/business_objects/sorqry.rb new file mode 100644 index 0000000..087e86c --- /dev/null +++ b/lib/syspro/business_objects/sorqry.rb @@ -0,0 +1,42 @@ +# frozen_string_literal: true + +require 'syspro/business_objects/parsers/sorqry_parser' +require 'erb' + +module Syspro + module BusinessObjects + class SorQry < ApiResource + include Syspro::ApiOperations::Query + include Syspro::BusinessObjects::Parsers + + attr_accessor :sales_order, :invoice, :stocked_lines, :non_stocked_lines, :freight_lines, + :misc_lines, :comment_lines, :completed_lines, :serials, :lots, :bins, + :attached_items, :custom_forms, :detail_line_custom_forms, :values, :line_ship_date + + def call(user_id) + xml_in = template.result(binding) + business_object = 'SORQRY' + params = { 'UserId' => user_id, 'BusinessObject' => business_object, 'XmlIn' => xml_in } + resp = SorQry.query(params) + + parse_response(resp) + end + + def template + ERB.new File.read(File.expand_path('schemas/sorqry.xml.erb', File.dirname(__FILE__))), nil, '%' + end + + def parse_response(resp) + handle_errors(resp) + parser = SorQryParser.new(resp[0].data) + parser.parse + end + + def handle_errors(resp) + body = resp[0].http_body + raise SysproError, body if body =~ /^(ERROR)/ + end + end + end +end + diff --git a/lib/syspro/get_logon_profile.rb b/lib/syspro/get_logon_profile.rb index fc53920..4de2e04 100644 --- a/lib/syspro/get_logon_profile.rb +++ b/lib/syspro/get_logon_profile.rb @@ -18,7 +18,7 @@ module Syspro OpenStruct.new( company_name: doc.xpath('//CompanyName').text, operator_code: doc.xpath('//OperatorCode').text, - operator_code: doc.xpath('//OperatorGroup').text, + operator_group: doc.xpath('//OperatorGroup').text, operator_email_address: doc.xpath('//OperatorEmailAddress').text, operator_location: doc.xpath('//OperatorLocation').text, operator_language_code: doc.xpath('//OperatorLanguageCode').text, diff --git a/test/cassettes/test_sor_query.yml b/test/cassettes/test_sor_query.yml index 969c0b8..3a2482f 100644 --- a/test/cassettes/test_sor_query.yml +++ b/test/cassettes/test_sor_query.yml @@ -27,15 +27,15 @@ http_interactions: Server: - Microsoft-HTTPAPI/2.0 Date: - - Wed, 11 Apr 2018 19:00:49 GMT + - Thu, 26 Apr 2018 19:08:08 GMT body: encoding: UTF-8 - string: 'E621DED6B5E98C4783D130230F6B29E700 ' + string: 'E3333B82C68A4F4893184E2DE8C42E4A00 ' http_version: - recorded_at: Wed, 11 Apr 2018 19:00:49 GMT + recorded_at: Thu, 26 Apr 2018 19:08:09 GMT - request: method: get - 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 + 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 body: encoding: US-ASCII string: '' @@ -54,17 +54,33 @@ http_interactions: message: OK headers: Content-Length: - - '102' + - '3812' Content-Type: - application/octet-stream Server: - Microsoft-HTTPAPI/2.0 Date: - - Wed, 11 Apr 2018 19:00:53 GMT + - Thu, 26 Apr 2018 19:08:15 GMT body: encoding: UTF-8 - string: 'ERROR: Access denied to Functional Area ''SorBlanketSo'' for operator - ''WLAND'' (Business Object ''SORQBS'')' + string: "\n\n16R069\nO\nOrder\n\n\n\n\n\nSYM000\nSYMRISE + GLOBAL\nE\nExempt + from tax\nE\nExempt + from tax\nN\nEU\nSYMRISE + GLOBAL\nFR KREDITOREN\nPOSTFACH + 1253\nD-37601 HOLZMINDEN\n\nGERMANY\n\n\n + \ 0.000000\n 0.000000\nDAL\n\n0.00\n0.00\n0.00\n\nDAL\n0.00\n0.00\n\n0.00\n0.00\n\n0.00\n0.00\n\n0.00\n0.00\n\nDAN + A LABBEE\n*\nCancelled + during entry\n\n2014-08-13\n\n2017-05-31\n\n\n\n3\n\n\n00\n00\n\n\n00\n00\nNET + 30 DAYS\nHQ\nHARRAH, + WASHINGTON RECEIVABLES\n\n\nFG\nFOREIGN\n\n\n$\nDOLLAR\nIMPORTANT\nTHIS + IS A GLOBAL ACCOUNT\nUSED TO HOLD\n\nSCHEDULED + ORDERS ON CONTRACTS\nDO NOT SHIP FROM GLOBAL\n\n + \ 0.000000\n 0.000000\nN\n\nN\n + \ 1.000000\n1.000000\nM\n\nI\n\n\n\n\n\n\n\n000\n00\n0\n\n\n\n\n\n\n\nMATTB\n\n\n\n\n\n\n\n\n0\nY\n\n\n\n\n\n " http_version: - recorded_at: Wed, 11 Apr 2018 19:00:53 GMT + recorded_at: Thu, 26 Apr 2018 19:08:15 GMT recorded_with: VCR 4.0.0 diff --git a/test/sor_test.rb b/test/sor_test.rb index 0c91657..4ffea8d 100644 --- a/test/sor_test.rb +++ b/test/sor_test.rb @@ -16,21 +16,27 @@ class SorTest < Minitest::Test end def test_sor_query - sorqbs = Syspro::BusinessObjects::SorQbs.new + sorqbs = Syspro::BusinessObjects::SorQry.new - sorqbs.include_sales_order_details = true - sorqbs.include_contact_details = true - sorqbs.include_delivery_history = true - sorqbs.include_unconfirmed_releases = true - sorqbs.include_confirmed_releases = true - sorqbs.include_release_details = true - sorqbs.include_release_history = true - sorqbs.filters = [ - { name: 'Customer', type: 'A', value: 'JJJ001' } - ] + sorqbs.sales_order = '16R069' + sorqbs.invoice = nil + sorqbs.stocked_lines = true + sorqbs.non_stocked_lines = true + sorqbs.freight_lines = true + sorqbs.misc_lines = true + sorqbs.comment_lines = true + sorqbs.completed_lines = true + sorqbs.serials = true + sorqbs.lots = true + sorqbs.bins = true + sorqbs.attached_items = true + sorqbs.custom_forms = true + sorqbs.detail_line_custom_forms = true + sorqbs.values = true + sorqbs.line_ship_date = true sor_result = sorqbs.call(user_id.guid) - refute_nil sor_result + assert_kind_of Syspro::BusinessObjects::Models::SorDetail, sor_result end end -- libgit2 0.21.4