From faa792a58de8c318d953070d4ff638599cd13bb9 Mon Sep 17 00:00:00 2001 From: Chris Gunther Date: Wed, 6 Mar 2024 15:08:59 -0500 Subject: [PATCH] Remove dependence on `Object#blank?` monkey patch Nori patched `Object` to implement a `blank?` method, however it was removed in v2.7 (February 2024), so uses within this gem were now breaking without the method being implemented. Nori commit: https://github.com/savonrb/nori/commit/780d01d6da13e69d205217f2418ddd67a20a5355 CI was passing for Ruby < 3, since Nori v2.7 requires Ruby 3, however Ruby >= 3 was failing once it started using Nori v2.7. --- HISTORY.md | 1 + lib/netsuite/actions/delete_list.rb | 4 ++-- lib/netsuite/configuration.rb | 2 +- spec/netsuite/actions/delete_list_spec.rb | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index e689e70de..f603896f4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ ### Fixed * Revert recent proxy changes which breaks proxy usage by @andrewdicken-stripe in https://github.com/NetSweet/netsuite/pull/579 +* Fix incompatibility with Nori v2.7+ after it removed `Object#blank?` monkey patch (#607) ### Breaking Changes diff --git a/lib/netsuite/actions/delete_list.rb b/lib/netsuite/actions/delete_list.rb index 2b42292be..1700966a6 100644 --- a/lib/netsuite/actions/delete_list.rb +++ b/lib/netsuite/actions/delete_list.rb @@ -53,7 +53,7 @@ def response_list end def success? - @success ||= response_errors.blank? + @success ||= (response_errors.nil? || response_errors.empty?) end def response_errors @@ -105,4 +105,4 @@ def delete_list(options = { }, credentials={}) end end end -end \ No newline at end of file +end diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index 011509bea..427ab1318 100644 --- a/lib/netsuite/configuration.rb +++ b/lib/netsuite/configuration.rb @@ -202,7 +202,7 @@ def soap_header(headers = nil) end def auth_header(credentials={}) - if !credentials[:consumer_key].blank? || !consumer_key.blank? + if !credentials[:consumer_key].to_s.empty? || !consumer_key.to_s.empty? token_auth(credentials) else user_auth(credentials) diff --git a/spec/netsuite/actions/delete_list_spec.rb b/spec/netsuite/actions/delete_list_spec.rb index 24a1d653a..7011b8f7e 100644 --- a/spec/netsuite/actions/delete_list_spec.rb +++ b/spec/netsuite/actions/delete_list_spec.rb @@ -76,6 +76,9 @@ it 'constructs error objects' do response = NetSuite::Actions::DeleteList.call([klass, :list => customer_list_with_error]) + + expect(response).to_not be_success + expect(response.errors.keys).to match_array(customer_with_error.internal_id) expect(response.errors[customer_with_error.internal_id].first.code).to eq('USER_EXCEPTION') expect(response.errors[customer_with_error.internal_id].first.message).to eq('Invalid record: type=event,id=100015,scompid=TSTDRV96')