From 559b2c314c55c7237e90dbda2c59989393bb14b9 Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Tue, 17 Jun 2014 18:45:06 -0400 Subject: [PATCH 01/11] 2014_1 wsdl --- wsdl/2014_1.wsdl | 2415 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2415 insertions(+) create mode 100644 wsdl/2014_1.wsdl diff --git a/wsdl/2014_1.wsdl b/wsdl/2014_1.wsdl new file mode 100644 index 000000000..49c50f0b1 --- /dev/null +++ b/wsdl/2014_1.wsdl @@ -0,0 +1,2415 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 30eedc744dcdfa60897b615f9bc143eef4fdb73c Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Tue, 17 Jun 2014 18:45:46 -0400 Subject: [PATCH 02/11] make search result more robust when there is a single item in the result set (look for an array, and if it's not one make it one) --- lib/netsuite/support/search_result.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/netsuite/support/search_result.rb b/lib/netsuite/support/search_result.rb index a96eb9f8e..856845f3c 100644 --- a/lib/netsuite/support/search_result.rb +++ b/lib/netsuite/support/search_result.rb @@ -23,7 +23,7 @@ def initialize(response, result_class) if response.body.has_key?(:record_list) # basic search results record_list = response.body[:record_list][:record] - record_list = [record_list] if @total_records == 1 + record_list = [record_list] unless record_list.is_a?(Array) record_list.each do |record| results << result_class.new(record) @@ -31,7 +31,7 @@ def initialize(response, result_class) elsif response.body.has_key? :search_row_list # advanced search results record_list = response.body[:search_row_list][:search_row] - record_list = [record_list] if @total_records == 1 + record_list = [record_list] unless record_list.is_a?(Array) record_list.each do |record| # TODO because of customFieldList we need to either make this recursive From d2843ee59c0023929d1321a753a6cdc428bfd836 Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Fri, 20 Jun 2014 21:16:52 -0400 Subject: [PATCH 03/11] add additional attributes to sales_order per the netsuite API --- lib/netsuite/records/sales_order.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netsuite/records/sales_order.rb b/lib/netsuite/records/sales_order.rb index 55e10c047..8f50ce1bb 100644 --- a/lib/netsuite/records/sales_order.rb +++ b/lib/netsuite/records/sales_order.rb @@ -17,7 +17,7 @@ class SalesOrder :rev_rec_on_rev_commitment, :sales_effective_date, :shipping_cost, :shipping_tax1_rate, :shipping_tax2_rate, :source, :start_date, :status, :sync_partner_teams, :sync_sales_teams, :tax2_total, :tax_rate, :to_be_emailed, :to_be_faxed, :to_be_printed, :total_cost_estimate, :tran_date, :tran_id, :tran_is_vsoe_bundle, :vat_reg_num, - :vsoe_auto_calc + :vsoe_auto_calc, :quantity, :bill_city, :bill_state, :ship_city, :ship_state, :cost_estimate, :amount, :is_ship_address field :transaction_ship_address, ShipAddress field :transaction_bill_address, BillAddress From 63565ea3deacc9ff5305d627573cc1b490e65add Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Mon, 14 Jul 2014 16:07:27 -0400 Subject: [PATCH 04/11] protect against a null response Ensure that response.body has :search_row_list AND that the value is not itself null --- lib/netsuite/support/search_result.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/netsuite/support/search_result.rb b/lib/netsuite/support/search_result.rb index 856845f3c..c3af108de 100644 --- a/lib/netsuite/support/search_result.rb +++ b/lib/netsuite/support/search_result.rb @@ -28,7 +28,7 @@ def initialize(response, result_class) record_list.each do |record| results << result_class.new(record) end - elsif response.body.has_key? :search_row_list + elsif response.body[:search_row_list] # advanced search results record_list = response.body[:search_row_list][:search_row] record_list = [record_list] unless record_list.is_a?(Array) @@ -90,4 +90,4 @@ def results_in_batches end end -end \ No newline at end of file +end From db66c86695c04980031cd6baee9642e8d4e0c1d2 Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Mon, 14 Jul 2014 19:01:47 -0400 Subject: [PATCH 05/11] safer null protection --- lib/netsuite/support/search_result.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/netsuite/support/search_result.rb b/lib/netsuite/support/search_result.rb index c3af108de..f6ce84d14 100644 --- a/lib/netsuite/support/search_result.rb +++ b/lib/netsuite/support/search_result.rb @@ -28,9 +28,9 @@ def initialize(response, result_class) record_list.each do |record| results << result_class.new(record) end - elsif response.body[:search_row_list] + elsif response.body.has_key?(:search_row_list) # advanced search results - record_list = response.body[:search_row_list][:search_row] + record_list = response.body[:search_row_list].try(:[], :search_row) || [] record_list = [record_list] unless record_list.is_a?(Array) record_list.each do |record| From 90f970104c15ab3d4d76a15f553824ad582f2adc Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Tue, 22 Jul 2014 01:18:30 -0400 Subject: [PATCH 06/11] remove 2014_1 wsdl --- wsdl/2014_1.wsdl | 2415 ---------------------------------------------- 1 file changed, 2415 deletions(-) delete mode 100644 wsdl/2014_1.wsdl diff --git a/wsdl/2014_1.wsdl b/wsdl/2014_1.wsdl deleted file mode 100644 index 49c50f0b1..000000000 --- a/wsdl/2014_1.wsdl +++ /dev/null @@ -1,2415 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From b48a41f8a4e6ecfad97a7eccd73369ab67978c04 Mon Sep 17 00:00:00 2001 From: dkoslow Date: Thu, 24 Jul 2014 15:05:33 -0400 Subject: [PATCH 07/11] Change savon version to 2.2.0. --- netsuite.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netsuite.gemspec b/netsuite.gemspec index 679694765..544e13e40 100644 --- a/netsuite.gemspec +++ b/netsuite.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |gem| gem.require_paths = ['lib'] gem.version = Netsuite::VERSION - gem.add_dependency 'savon', '~> 2.3.0' + gem.add_dependency 'savon', '~> 2.2.0' gem.add_development_dependency 'rspec', '~> 2.99' end From 6f01428173df2f1c92f80543b0d8a1116a8b1007 Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Thu, 14 Aug 2014 01:09:57 -0400 Subject: [PATCH 08/11] Add support for between operator --- lib/netsuite/actions/search.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/netsuite/actions/search.rb b/lib/netsuite/actions/search.rb index d668961ef..1b674724e 100644 --- a/lib/netsuite/actions/search.rb +++ b/lib/netsuite/actions/search.rb @@ -142,6 +142,13 @@ def request_body elsif condition[:value].is_a?(Array) && condition[:type] == 'SearchDateField' # date ranges are handled via searchValue (start range) and searchValue2 (end range) + h[element_name] = { + '@operator' => condition[:operator], + "platformCore:searchValue" => condition[:value].first.to_s, + "platformCore:searchValue2" => condition[:value].last.to_s + } + elsif condition[:value].is_a?(Array) && condition[:operator] == 'between' + h[element_name] = { '@operator' => condition[:operator], "platformCore:searchValue" => condition[:value].first.to_s, From 1da9059000c681ed414adf9f132405aad5b3194b Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Mon, 10 Nov 2014 17:08:18 -0500 Subject: [PATCH 09/11] add a bunch of netsuite configuration options --- lib/netsuite/configuration.rb | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index 8da303408..c45d98e81 100644 --- a/lib/netsuite/configuration.rb +++ b/lib/netsuite/configuration.rb @@ -13,6 +13,9 @@ def attributes def connection(params={}, credentials={}) Savon.client({ wsdl: wsdl, + ssl_ca_cert_file: ssl_ca_cert_file, + ssl_verify_mode: ssl_verify_mode, + ssl_version: ssl_version read_timeout: read_timeout, namespaces: namespaces, soap_header: auth_header(credentials), @@ -22,6 +25,42 @@ def connection(params={}, credentials={}) }.update(params)) end + def ssl_version=(_ssl_version) + attributes[:ssl_version] = _ssl_version + end + + def ssl_version(_ssl_version = nil) + if _ssl_version + self.ssl_version = _ssl_version + else + attributes[:ssl_version] + end + end + + def ssl_verify_mode=(verify_mode) + attributes[:ssl_verify_mode] = verify_mode + end + + def ssl_verify_mode(verify_mode = nil) + if verify_mode + self.ssl_verify_mode = verify_mode + else + attributes[:verify_mode] + end + end + + def ssl_ca_cert_file=(path) + attributes[:ssl_ca_cert_file] = path + end + + def ssl_ca_cert_file(path = nil) + if path + self.ssl_ca_cert_file = path + else + attributes[:ssl_ca_cert_file] + end + end + def api_version(version = nil) if version self.api_version = version From cddb3a0bbeaf9c5f297e393d3c4f2da3b23cc790 Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Mon, 10 Nov 2014 17:15:37 -0500 Subject: [PATCH 10/11] missing comma --- lib/netsuite/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index c45d98e81..51071d67e 100644 --- a/lib/netsuite/configuration.rb +++ b/lib/netsuite/configuration.rb @@ -15,7 +15,7 @@ def connection(params={}, credentials={}) wsdl: wsdl, ssl_ca_cert_file: ssl_ca_cert_file, ssl_verify_mode: ssl_verify_mode, - ssl_version: ssl_version + ssl_version: ssl_version, read_timeout: read_timeout, namespaces: namespaces, soap_header: auth_header(credentials), From de6b09bbd15773997dedce76f53864478f219850 Mon Sep 17 00:00:00 2001 From: Jon Pospischil Date: Mon, 10 Nov 2014 17:31:17 -0500 Subject: [PATCH 11/11] default to peer --- lib/netsuite/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index 51071d67e..d062f661b 100644 --- a/lib/netsuite/configuration.rb +++ b/lib/netsuite/configuration.rb @@ -14,7 +14,7 @@ def connection(params={}, credentials={}) Savon.client({ wsdl: wsdl, ssl_ca_cert_file: ssl_ca_cert_file, - ssl_verify_mode: ssl_verify_mode, + ssl_verify_mode: (ssl_verify_mode || :peer), ssl_version: ssl_version, read_timeout: read_timeout, namespaces: namespaces,