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, diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index 8da303408..d062f661b 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 || :peer), + 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 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 diff --git a/lib/netsuite/support/search_result.rb b/lib/netsuite/support/search_result.rb index a96eb9f8e..f6ce84d14 100644 --- a/lib/netsuite/support/search_result.rb +++ b/lib/netsuite/support/search_result.rb @@ -23,15 +23,15 @@ 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) end - elsif response.body.has_key? :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 = [record_list] if @total_records == 1 + 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| # TODO because of customFieldList we need to either make this recursive @@ -90,4 +90,4 @@ def results_in_batches end end -end \ No newline at end of file +end 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