From b55e2b95d6bce3ba781b9b30e3ec743d3c41e0db Mon Sep 17 00:00:00 2001 From: Tim Krins Date: Thu, 9 Jun 2022 17:25:33 +0100 Subject: [PATCH 1/2] fix: use addressable gem to replace deprecated URI.encode --- lib/mparticle/api_client.rb | 4 ++-- mparticle.gemspec | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/mparticle/api_client.rb b/lib/mparticle/api_client.rb index d14657d..d068842 100644 --- a/lib/mparticle/api_client.rb +++ b/lib/mparticle/api_client.rb @@ -3,7 +3,7 @@ require 'logger' require 'tempfile' require 'typhoeus' -require 'uri' +require 'addressable/uri' module MParticle class ApiClient @@ -273,7 +273,7 @@ def sanitize_filename(filename) def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) + Addressable::URI.encode(@config.base_url + path) end # Builds the HTTP request body diff --git a/mparticle.gemspec b/mparticle.gemspec index 481de42..181f69a 100644 --- a/mparticle.gemspec +++ b/mparticle.gemspec @@ -12,6 +12,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' s.add_runtime_dependency 'json', '~> 2.0', '>= 2.3.0' + s.add_runtime_dependency 'addressable', '~> 2.3', '>= 2.3.0' s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? } s.executables = [] From 0fff76e0744bb108d29ee1a80e42022fda1dfe95 Mon Sep 17 00:00:00 2001 From: Tim Krins Date: Tue, 21 Jun 2022 11:55:49 +0100 Subject: [PATCH 2/2] fix: use addressable gem for encode in configuration --- lib/mparticle/configuration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mparticle/configuration.rb b/lib/mparticle/configuration.rb index 6e2d564..760af5e 100644 --- a/lib/mparticle/configuration.rb +++ b/lib/mparticle/configuration.rb @@ -1,4 +1,4 @@ -require 'uri' +require 'addressable/uri' module MParticle class Configuration @@ -136,7 +136,7 @@ def base_path=(base_path) def base_url url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - URI.encode(url) + Addressable::URI.encode(url) end # Gets Basic Auth token string