From dcba7d21f5f2bea8441b129a96195db129bc0778 Mon Sep 17 00:00:00 2001 From: Matt Pelc Date: Sun, 28 Dec 2025 16:09:58 -0800 Subject: [PATCH] Fix deprecation warnings This change addresses two deprecation warnings that can be seen on `master` when running `bundle exec rspec`: 1. HTTParty warns that response#nil? will no longer be overridden in future versions. The code is currently using response.nil? in specs, which should be changed to response.body.nil? || response.body.empty? 2. The ostruct library is used in lib/currency_cloud/pagination.rb:1 and won't be part of default gems starting from Ruby 3.5.0. It was addedd as an explicit dependency to gemspec. --- currency_cloud.gemspec | 1 + spec/integration/errors_spec.rb | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/currency_cloud.gemspec b/currency_cloud.gemspec index ebbee1e..1a2a8d8 100644 --- a/currency_cloud.gemspec +++ b/currency_cloud.gemspec @@ -16,6 +16,7 @@ Gem::Specification.new do |s| s.add_dependency('httparty', '~> 0.23.1') s.add_dependency('json', '>= 2.12.2', '< 2.17.0') s.add_dependency('base64', '~> 0.3.0') + s.add_dependency('ostruct', '~> 0.6.0') s.add_development_dependency('rake', '~> 13.3.0') s.add_development_dependency('addressable', '<= 2.9.0') diff --git a/spec/integration/errors_spec.rb b/spec/integration/errors_spec.rb index 165a8a5..850f24f 100644 --- a/spec/integration/errors_spec.rb +++ b/spec/integration/errors_spec.rb @@ -53,7 +53,8 @@ expect(0).to eq 1, 'expected exception that was not raised' rescue CurrencyCloud::BadRequestError => error expect(error.code).to eq('auth_invalid_user_login_details') - expect(error.raw_response).to_not be_nil + expect(error.raw_response.body).to_not be_nil + expect(error.raw_response.body).to_not be_empty expect(error.status_code).to eq(400) expect(error.messages.length).to eq(1) @@ -74,7 +75,8 @@ expect(0).to eq 1, 'expected exception that was not raised' rescue CurrencyCloud::AuthenticationError => error expect(error.code).to eq('auth_failed') - expect(error.raw_response).to_not be_nil + expect(error.raw_response.body).to_not be_nil + expect(error.raw_response.body).to_not be_empty expect(error.status_code).to eq(401) expect(error.messages.length).to eq(1) @@ -119,7 +121,8 @@ expect(0).to eq 1, 'expected exception that was not raised' rescue CurrencyCloud::ForbiddenError => error expect(error.code).to eq('auth_failed') - expect(error.raw_response).to_not be_nil + expect(error.raw_response.body).to_not be_nil + expect(error.raw_response.body).to_not be_empty expect(error.status_code).to eq(403) expect(error.messages.length).to eq(1) @@ -138,7 +141,8 @@ expect(0).to eq 1, 'expected exception that was not raised' rescue CurrencyCloud::NotFoundError => error expect(error.code).to eq('beneficiary_not_found') - expect(error.raw_response).to_not be_nil + expect(error.raw_response.body).to_not be_nil + expect(error.raw_response.body).to_not be_empty expect(error.status_code).to eq(404) expect(error.messages.length).to eq(1) @@ -156,7 +160,8 @@ expect(0).to eq 1, 'expected exception that was not raised' rescue CurrencyCloud::InternalApplicationError => error expect(error.code).to eq('internal_application_error') - expect(error.raw_response).to_not be_nil + expect(error.raw_response.body).to_not be_nil + expect(error.raw_response.body).to_not be_empty expect(error.status_code).to eq(500) expect(error.messages.length).to eq(1) @@ -177,7 +182,8 @@ expect(0).to eq 1, 'expected exception that was not raised' rescue CurrencyCloud::TooManyRequestsError => error expect(error.code).to eq('too_many_requests') - expect(error.raw_response).to_not be_nil + expect(error.raw_response.body).to_not be_nil + expect(error.raw_response.body).to_not be_empty expect(error.status_code).to eq(429) expect(error.messages.length).to eq(1)