From 1126073cc12bf4bd317413abf325e5bb7aacdcfb Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 18:28:51 +0530 Subject: [PATCH 01/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index a52b0e812..708d9596a 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -4,8 +4,18 @@ class ClientBase # rubocop:disable Style/ClassVars @@default_region = 'us1' # rubocop:enable Style/ClassVars - - attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :edge, :logger, + @@region_mappings = { + "au1" => "sydney", + "br1" => "sao-paulo", + "de1" => "frankfurt", + "ie1" => "dublin", + "jp1" => "tokyo", + "jp2" => "osaka", + "sg1" => "singapore", + "us1" => "ashburn", + "us2" => "umatilla" + } + attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region , :logger, :user_agent_extensions, :credentials # rubocop:disable Metrics/ParameterLists @@ -14,7 +24,7 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @username = username || Twilio.account_sid @password = password || Twilio.auth_token @region = region || Twilio.region - @edge = Twilio.edge + @edge = !region.nil? ? @@region_mappings[region] : nil @account_sid = account_sid || @username @auth_token = @password @auth = [@username, @password] @@ -23,6 +33,16 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @user_agent_extensions = user_agent_extensions || [] end + def edge=(value) + warn "[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead." + @edge = value + end + + def edge + warn "[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead." + @edge + end + def credential_provider(credential_provider = nil) @credentials = credential_provider self From 48dac8e1b73f421a57d49bdf58fd33a7e2effe53 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 18:38:11 +0530 Subject: [PATCH 02/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 708d9596a..7dae65492 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -3,7 +3,7 @@ module REST class ClientBase # rubocop:disable Style/ClassVars @@default_region = 'us1' - # rubocop:enable Style/ClassVars + # rubocop:disable Style/ClassVars @@region_mappings = { "au1" => "sydney", "br1" => "sao-paulo", From 17f36ef2316846cc89560821783e9a03451c457d Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 18:53:10 +0530 Subject: [PATCH 03/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 7dae65492..8456d94fd 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -5,15 +5,15 @@ class ClientBase @@default_region = 'us1' # rubocop:disable Style/ClassVars @@region_mappings = { - "au1" => "sydney", - "br1" => "sao-paulo", - "de1" => "frankfurt", - "ie1" => "dublin", - "jp1" => "tokyo", - "jp2" => "osaka", - "sg1" => "singapore", - "us1" => "ashburn", - "us2" => "umatilla" + 'au1' => 'sydney', + 'br1' => 'sao-paulo', + 'de1' => 'frankfurt', + 'ie1' => 'dublin', + 'jp1' => 'tokyo', + 'jp2' => 'osaka', + 'sg1' => 'singapore', + 'us1' => 'ashburn', + 'us2' => 'umatilla' } attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region , :logger, :user_agent_extensions, :credentials From dd656f4729fd326acf1eeb65d9c3448cc0012e18 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 18:54:10 +0530 Subject: [PATCH 04/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 8456d94fd..5bfe4a8ac 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -34,12 +34,12 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, end def edge=(value) - warn "[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead." + warn '[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead.' @edge = value end def edge - warn "[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead." + warn '[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead.' @edge end From 4e4b1b850e42d04e1e5b8e8ace4ff91958052126 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 18:57:39 +0530 Subject: [PATCH 05/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 5bfe4a8ac..3cf1bc958 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -3,7 +3,6 @@ module REST class ClientBase # rubocop:disable Style/ClassVars @@default_region = 'us1' - # rubocop:disable Style/ClassVars @@region_mappings = { 'au1' => 'sydney', 'br1' => 'sao-paulo', @@ -15,7 +14,7 @@ class ClientBase 'us1' => 'ashburn', 'us2' => 'umatilla' } - attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region , :logger, + attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :logger, :user_agent_extensions, :credentials # rubocop:disable Metrics/ParameterLists From 86f84f4757ba548f38e06c349ac7388af5776156 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 18:59:45 +0530 Subject: [PATCH 06/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 3cf1bc958..7a82c8604 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -1,7 +1,6 @@ module Twilio module REST class ClientBase - # rubocop:disable Style/ClassVars @@default_region = 'us1' @@region_mappings = { 'au1' => 'sydney', From 9c592097ab196ba5e21671a2f26878eb4ae40321 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 19:03:48 +0530 Subject: [PATCH 07/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 7a82c8604..3cc6cdfec 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -1,6 +1,7 @@ module Twilio module REST class ClientBase + # rubocop:disable Style/ClassVars @@default_region = 'us1' @@region_mappings = { 'au1' => 'sydney', @@ -13,6 +14,8 @@ class ClientBase 'us1' => 'ashburn', 'us2' => 'umatilla' } + # rubocop:enable Style/ClassVars + attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :logger, :user_agent_extensions, :credentials From b5dbfe1f562671b3548e2d11fe1486597580f15d Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 19:07:12 +0530 Subject: [PATCH 08/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index fa2459ca5..a470246a9 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -26,7 +26,7 @@ expect(@client.auth_token).to eq('someToken') expect(@client.http_client).to eq('someClient') expect(@client.region).to eq('someRegion') - expect(@client.edge).to eq('someEdge') + expect(@client.edge).to eq(nil) expect(@client.logger).to eq('someLogger') end @@ -37,7 +37,7 @@ expect(@client.auth_token).to eq('myPassword') expect(@client.http_client).to eq('myClient') expect(@client.region).to eq('myRegion') - expect(@client.edge).to eq('myEdge') + expect(@client.edge).to eq("myEdge") expect(@client.logger).to eq('myLogger') end From f2e6ade21900252c6f490e2c82778a0fcbce110f Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 19:08:53 +0530 Subject: [PATCH 09/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index a470246a9..337ccdbbb 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -37,7 +37,7 @@ expect(@client.auth_token).to eq('myPassword') expect(@client.http_client).to eq('myClient') expect(@client.region).to eq('myRegion') - expect(@client.edge).to eq("myEdge") + expect(@client.edge).to eq('myEdge') expect(@client.logger).to eq('myLogger') end From ceb2582e3b80a18863163dd41bb5168d37aeadab Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 19:13:21 +0530 Subject: [PATCH 10/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 337ccdbbb..0d565d2df 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -41,6 +41,16 @@ expect(@client.logger).to eq('myLogger') end + it 'uses the region edge mapping' do + @client = Twilio::REST::Client.new + expect(@client.account_sid).to eq('someSid') + expect(@client.auth_token).to eq('someToken') + expect(@client.http_client).to eq('someClient') + expect(@client.region).to eq('ie1') + expect(@client.edge).to eq('dublin') + expect(@client.logger).to eq('someLogger') + end + class MyVersion < Twilio::REST::Version def initialize(domain) super From 19ef793bc6d0d4935f59e0ccbf2c9c9991eeae14 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 19:18:12 +0530 Subject: [PATCH 11/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 0d565d2df..1895ade4f 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -42,13 +42,30 @@ end it 'uses the region edge mapping' do - @client = Twilio::REST::Client.new + @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') expect(@client.account_sid).to eq('someSid') - expect(@client.auth_token).to eq('someToken') - expect(@client.http_client).to eq('someClient') + expect(@client.auth_token).to eq('myPassword') expect(@client.region).to eq('ie1') expect(@client.edge).to eq('dublin') - expect(@client.logger).to eq('someLogger') + expect(@client.logger).to eq('myLogger') + end + + it 'catches warning when setting edge' do + original_stderr = $stderr + $stderr = StringIO.new + begin + @client = Twilio::REST::Client.new + # Simulate a condition that would trigger a warning when setting edge + allow(@client).to receive(:edge=).and_wrap_original do |m, *args| + warn 'Edge is deprecated' + m.call(*args) + end + @client.edge = 'deprecatedEdge' + warnings = $stderr.string + expect(warnings).to include('Edge is deprecated') + ensure + $stderr = original_stderr + end end class MyVersion < Twilio::REST::Version From f438b4bc2472d96a618b51e09d5ed5982bfeca7e Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Wed, 26 Nov 2025 23:13:20 +0530 Subject: [PATCH 12/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 1895ade4f..353b5ecf5 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -55,14 +55,9 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new - # Simulate a condition that would trigger a warning when setting edge - allow(@client).to receive(:edge=).and_wrap_original do |m, *args| - warn 'Edge is deprecated' - m.call(*args) - end @client.edge = 'deprecatedEdge' warnings = $stderr.string - expect(warnings).to include('Edge is deprecated') + expect(warnings).to include('[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead.') ensure $stderr = original_stderr end From 0b186ad9a04f321cf052ffb1787bbe2f7ba45dca Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 13:23:10 +0530 Subject: [PATCH 13/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 22 +++++++++++----------- spec/rest/client_spec.rb | 7 +++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 3cc6cdfec..e1f823fc8 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -3,6 +3,8 @@ module REST class ClientBase # rubocop:disable Style/ClassVars @@default_region = 'us1' + # Maps region codes to their corresponding edge location names + # Used to automatically set edge based on region for backward compatibility @@region_mappings = { 'au1' => 'sydney', 'br1' => 'sao-paulo', @@ -25,7 +27,15 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @username = username || Twilio.account_sid @password = password || Twilio.auth_token @region = region || Twilio.region - @edge = !region.nil? ? @@region_mappings[region] : nil + if ( @region.nil? and !Twilio.edge.nil? ) or ( !@region.nil? and Twilio.edge.nil? ) + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.' + end + if Twilio.edge + @edge = Twilio.edge + else + warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.' + @edge = !region.nil? ? @@region_mappings[region] : nil + end @account_sid = account_sid || @username @auth_token = @password @auth = [@username, @password] @@ -34,16 +44,6 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @user_agent_extensions = user_agent_extensions || [] end - def edge=(value) - warn '[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead.' - @edge = value - end - - def edge - warn '[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead.' - @edge - end - def credential_provider(credential_provider = nil) @credentials = credential_provider self diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 353b5ecf5..f8117b8b4 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -50,14 +50,13 @@ expect(@client.logger).to eq('myLogger') end - it 'catches warning when setting edge' do + it 'catches warning when setting region' do original_stderr = $stderr $stderr = StringIO.new begin - @client = Twilio::REST::Client.new - @client.edge = 'deprecatedEdge' + @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') warnings = $stderr.string - expect(warnings).to include('[DEPRECATION] `edge` is deprecated and will be removed in a future version. Use `region` instead.') + expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.') ensure $stderr = original_stderr end From 4cddb05b03588987d315e23f8f30a47642aff668 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 13:28:54 +0530 Subject: [PATCH 14/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index e1f823fc8..ec4f98567 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -18,7 +18,7 @@ class ClientBase } # rubocop:enable Style/ClassVars - attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :logger, + attr_accessor :http_client, :username, :password, :account_sid, :auth_token, :region, :edge, :logger, :user_agent_extensions, :credentials # rubocop:disable Metrics/ParameterLists @@ -27,13 +27,15 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @username = username || Twilio.account_sid @password = password || Twilio.auth_token @region = region || Twilio.region - if ( @region.nil? and !Twilio.edge.nil? ) or ( !@region.nil? and Twilio.edge.nil? ) - warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.' + if (@region.nil? && !Twilio.edge.nil?) || (!@region.nil? && Twilio.edge.nil?) + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; + otherwise use product.twilio.com.' end if Twilio.edge @edge = Twilio.edge else - warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.' + warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing, + DNS is of format product...twilio.com; otherwise use product.twilio.com.' @edge = !region.nil? ? @@region_mappings[region] : nil end @account_sid = account_sid || @username From 8cb0b4f2e0cb7a1c60a8f42ff69cc88f37d73fbc Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 13:30:42 +0530 Subject: [PATCH 15/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index ec4f98567..e1280a9ac 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -28,14 +28,14 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @password = password || Twilio.auth_token @region = region || Twilio.region if (@region.nil? && !Twilio.edge.nil?) || (!@region.nil? && Twilio.edge.nil?) - warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; - otherwise use product.twilio.com.' + # rubocop:disable Layout/LineLength + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com;otherwise use product.twilio.com.' end if Twilio.edge @edge = Twilio.edge else - warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing, - DNS is of format product...twilio.com; otherwise use product.twilio.com.' + # rubocop:disable Layout/LineLength + warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' @edge = !region.nil? ? @@region_mappings[region] : nil end @account_sid = account_sid || @username From bdf1b9311bbd7adaad0b7b6a1b2fe0a25e598984 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 13:35:05 +0530 Subject: [PATCH 16/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index e1280a9ac..cbf3cad58 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -27,15 +27,15 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, @username = username || Twilio.account_sid @password = password || Twilio.auth_token @region = region || Twilio.region - if (@region.nil? && !Twilio.edge.nil?) || (!@region.nil? && Twilio.edge.nil?) + if (region.nil? && !Twilio.edge.nil?) || (!region.nil? && Twilio.edge.nil?) # rubocop:disable Layout/LineLength warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com;otherwise use product.twilio.com.' end if Twilio.edge @edge = Twilio.edge else - # rubocop:disable Layout/LineLength warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + # rubocop:enable Layout/LineLength @edge = !region.nil? ? @@region_mappings[region] : nil end @account_sid = account_sid || @username From 7a53506e6ee82eee50b7599a185459078abf4ecb Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 13:51:58 +0530 Subject: [PATCH 17/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index f8117b8b4..82ee81da4 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -26,7 +26,7 @@ expect(@client.auth_token).to eq('someToken') expect(@client.http_client).to eq('someClient') expect(@client.region).to eq('someRegion') - expect(@client.edge).to eq(nil) + expect(@client.edge).to eq('someEdge') expect(@client.logger).to eq('someLogger') end @@ -42,7 +42,9 @@ end it 'uses the region edge mapping' do + config.edge = nil @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') + config.edge = 'someEdge' expect(@client.account_sid).to eq('someSid') expect(@client.auth_token).to eq('myPassword') expect(@client.region).to eq('ie1') From b8142a9fc0fdeaafedf94eacafa0e633a6914dfa Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 13:58:21 +0530 Subject: [PATCH 18/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 82ee81da4..a8220baad 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -41,10 +41,8 @@ expect(@client.logger).to eq('myLogger') end - it 'uses the region edge mapping' do - config.edge = nil + it 'uses the region edge mapping', :skip_before do @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') - config.edge = 'someEdge' expect(@client.account_sid).to eq('someSid') expect(@client.auth_token).to eq('myPassword') expect(@client.region).to eq('ie1') @@ -52,7 +50,7 @@ expect(@client.logger).to eq('myLogger') end - it 'catches warning when setting region' do + it 'catches warning when setting region', :skip_before do original_stderr = $stderr $stderr = StringIO.new begin From 1787d5d4fb55ab976f91be9e681ae03981f7829b Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:12:31 +0530 Subject: [PATCH 19/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 50 +++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index a8220baad..8a70800dc 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -8,6 +8,35 @@ end describe Twilio::REST::Client do + + context 'configuration of edge' do + it 'catches warning when setting region', :skip_before do + original_stderr = $stderr + $stderr = StringIO.new + begin + @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; + warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + warnings = $stderr.string + expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); + expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.'); + ensure + $stderr = original_stderr + end + end + + it 'uses the arguments over global configuration' do + @client = Twilio::REST::Client.new('myUser', 'myPassword', nil, 'myRegion', 'myClient', 'myLogger') + @client.edge = 'myEdge' + expect(@client.account_sid).to eq('myUser') + expect(@client.auth_token).to eq('myPassword') + expect(@client.http_client).to eq('myClient') + expect(@client.region).to eq('myRegion') + expect(@client.edge).to eq('myEdge') + expect(@client.logger).to eq('myLogger') + end + end + context 'configuration' do before do Twilio.configure do |config| @@ -41,27 +70,6 @@ expect(@client.logger).to eq('myLogger') end - it 'uses the region edge mapping', :skip_before do - @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') - expect(@client.account_sid).to eq('someSid') - expect(@client.auth_token).to eq('myPassword') - expect(@client.region).to eq('ie1') - expect(@client.edge).to eq('dublin') - expect(@client.logger).to eq('myLogger') - end - - it 'catches warning when setting region', :skip_before do - original_stderr = $stderr - $stderr = StringIO.new - begin - @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') - warnings = $stderr.string - expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.') - ensure - $stderr = original_stderr - end - end - class MyVersion < Twilio::REST::Version def initialize(domain) super From 874ac8816092349696141f8a929b53c8c5e8d6da Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:16:43 +0530 Subject: [PATCH 20/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 8a70800dc..53608ae62 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -10,7 +10,18 @@ describe Twilio::REST::Client do context 'configuration of edge' do - it 'catches warning when setting region', :skip_before do + + it 'uses the edge value from region map' do + @client = Twilio::REST::Client.new('myUser', 'myPassword', nil, 'us1', 'myClient', 'myLogger') + expect(@client.account_sid).to eq('myUser') + expect(@client.auth_token).to eq('myPassword') + expect(@client.http_client).to eq('myClient') + expect(@client.region).to eq('us1') + expect(@client.edge).to eq('ashburn') + expect(@client.logger).to eq('myLogger') + end + + it 'catches warning when setting region' do original_stderr = $stderr $stderr = StringIO.new begin @@ -25,15 +36,24 @@ end end - it 'uses the arguments over global configuration' do - @client = Twilio::REST::Client.new('myUser', 'myPassword', nil, 'myRegion', 'myClient', 'myLogger') - @client.edge = 'myEdge' - expect(@client.account_sid).to eq('myUser') - expect(@client.auth_token).to eq('myPassword') - expect(@client.http_client).to eq('myClient') - expect(@client.region).to eq('myRegion') - expect(@client.edge).to eq('myEdge') - expect(@client.logger).to eq('myLogger') + it 'catches warning when setting edge' do + Twilio.configure do |config| + config.account_sid = 'someSid' + config.auth_token = 'someToken' + config.http_client = 'someClient' + config.edge = 'someEdge' + config.logger = 'someLogger' + end + original_stderr = $stderr + $stderr = StringIO.new + begin + @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid') + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; + warnings = $stderr.string + expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); + ensure + $stderr = original_stderr + end end end From 3e085214be51ffe0f99828c146bba4f9761ac3a6 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:17:26 +0530 Subject: [PATCH 21/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 53608ae62..a72cba0dd 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -26,6 +26,7 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') + # rubocop:disable Layout/LineLength warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' warnings = $stderr.string @@ -51,6 +52,7 @@ warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; warnings = $stderr.string expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); + # rubocop:enable Layout/LineLength ensure $stderr = original_stderr end From a4630a6cb726f4a3188373b443dc02c08d37a667 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:21:15 +0530 Subject: [PATCH 22/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index a72cba0dd..19e2964fc 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -27,11 +27,14 @@ begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') # rubocop:disable Layout/LineLength - warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.' warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + # rubocop:enable Layout/LineLength warnings = $stderr.string - expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); - expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.'); + # rubocop:disable Layout/LineLength + expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.') + expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.') + # rubocop:enable Layout/LineLength ensure $stderr = original_stderr end @@ -49,6 +52,7 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid') + # rubocop:disable Layout/LineLength warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; warnings = $stderr.string expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); From b22181c066f3a38d906dbd47c34a346416cd9ee4 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:24:01 +0530 Subject: [PATCH 23/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 19e2964fc..3d0b1984f 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -26,15 +26,11 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') - # rubocop:disable Layout/LineLength warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.' warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' - # rubocop:enable Layout/LineLength warnings = $stderr.string - # rubocop:disable Layout/LineLength expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.') expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.') - # rubocop:enable Layout/LineLength ensure $stderr = original_stderr end @@ -52,11 +48,9 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid') - # rubocop:disable Layout/LineLength warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; warnings = $stderr.string expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); - # rubocop:enable Layout/LineLength ensure $stderr = original_stderr end From 1ebcbdb1f61d6d8314202f308adf31be158fc7c6 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:25:18 +0530 Subject: [PATCH 24/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 3d0b1984f..376e05726 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -48,9 +48,9 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid') - warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'; + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.' warnings = $stderr.string - expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.'); + expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.') ensure $stderr = original_stderr end From da128d9ffb5283ebacceeb8920fbe598f5bdeaa4 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 14:26:53 +0530 Subject: [PATCH 25/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 376e05726..0b90b9429 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -8,9 +8,7 @@ end describe Twilio::REST::Client do - context 'configuration of edge' do - it 'uses the edge value from region map' do @client = Twilio::REST::Client.new('myUser', 'myPassword', nil, 'us1', 'myClient', 'myLogger') expect(@client.account_sid).to eq('myUser') From 596c002b48b83ae71c064a28cf7819229339742b Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 15:15:08 +0530 Subject: [PATCH 26/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index cbf3cad58..f02437b97 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -33,7 +33,7 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, end if Twilio.edge @edge = Twilio.edge - else + elsif @region && @@region_mappings[region] warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' # rubocop:enable Layout/LineLength @edge = !region.nil? ? @@region_mappings[region] : nil @@ -101,6 +101,10 @@ def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth ## # Build the final request uri def build_uri(uri) + if @edge.nil? && @region && @@region_mappings[@region] + warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + @edge = @@region_mappings[@region] + end return uri if @region.nil? && @edge.nil? parsed_url = URI(uri) From 51300b5ec54e7bbddd2fa9c374b46350a651391f Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 15:22:10 +0530 Subject: [PATCH 27/31] fix: Regional API domain processing --- spec/rest/client_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index 0b90b9429..e3b4db5a6 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -19,6 +19,18 @@ expect(@client.logger).to eq('myLogger') end + it 'uses the edge value from region map using setter' do + @client = Twilio::REST::Client.new('myUser', 'myPassword', nil) + @client.region = 'us1' + @client.http_client = Twilio::HTTP::Client.new + @connection = Faraday::Connection.new + expect(Faraday).to receive(:new).and_yield(@connection).and_return(@connection) + allow_any_instance_of(Faraday::Connection).to receive(:send).and_return(double('response', status: 301, body: {}, headers: {})) + @client.request('host', 'port', 'GET', 'https://api.twilio.com') + expect(@client.region).to eq('us1') + expect(@client.edge).to eq('ashburn') + end + it 'catches warning when setting region' do original_stderr = $stderr $stderr = StringIO.new From 87a98e697a8ad7544460446010b04e6c1e390b34 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 15:23:44 +0530 Subject: [PATCH 28/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index f02437b97..fce84e286 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -102,7 +102,9 @@ def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth # Build the final request uri def build_uri(uri) if @edge.nil? && @region && @@region_mappings[@region] + ## rubocop:disable Layout/LineLength warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + # rubocop:enable Layout/LineLength @edge = @@region_mappings[@region] end return uri if @region.nil? && @edge.nil? From d77d0a30eb52ff09c77141452b8ce4a207c42aea Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 15:23:56 +0530 Subject: [PATCH 29/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index fce84e286..3574c62cb 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -102,7 +102,7 @@ def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth # Build the final request uri def build_uri(uri) if @edge.nil? && @region && @@region_mappings[@region] - ## rubocop:disable Layout/LineLength + # rubocop:disable Layout/LineLength warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' # rubocop:enable Layout/LineLength @edge = @@region_mappings[@region] From 8f52d3b2b221de9fae4047154d8a08e16d13eed3 Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 15:40:17 +0530 Subject: [PATCH 30/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 6 +++--- spec/rest/client_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index 3574c62cb..d4dde9b0c 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -34,9 +34,9 @@ def initialize(username = nil, password = nil, account_sid = nil, region = nil, if Twilio.edge @edge = Twilio.edge elsif @region && @@region_mappings[region] - warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + warn '[DEPRECATION] Setting default `Edge` for the provided `region`.' # rubocop:enable Layout/LineLength - @edge = !region.nil? ? @@region_mappings[region] : nil + @edge = @@region_mappings[region] end @account_sid = account_sid || @username @auth_token = @password @@ -103,7 +103,7 @@ def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth def build_uri(uri) if @edge.nil? && @region && @@region_mappings[@region] # rubocop:disable Layout/LineLength - warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + warn '[DEPRECATION] Setting default `Edge` for the provided `region`.' # rubocop:enable Layout/LineLength @edge = @@region_mappings[@region] end diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index e3b4db5a6..e7b052725 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -37,10 +37,10 @@ begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.' - warn '[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.' + warn '[DEPRECATION] Setting default `Edge` for the provided `region`.' warnings = $stderr.string expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.') - expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`. For regional processing,DNS is of format product...twilio.com; otherwise use product.twilio.com.') + expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`.') ensure $stderr = original_stderr end From 5243245a0d2881966265d2cb9134b1c8add3391a Mon Sep 17 00:00:00 2001 From: manisha1997 Date: Fri, 28 Nov 2025 15:43:40 +0530 Subject: [PATCH 31/31] fix: Regional API domain processing --- lib/twilio-ruby/base/client_base.rb | 2 -- spec/rest/client_spec.rb | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/twilio-ruby/base/client_base.rb b/lib/twilio-ruby/base/client_base.rb index d4dde9b0c..7987cf9f0 100644 --- a/lib/twilio-ruby/base/client_base.rb +++ b/lib/twilio-ruby/base/client_base.rb @@ -102,9 +102,7 @@ def request(host, port, method, uri, params = {}, data = {}, headers = {}, auth # Build the final request uri def build_uri(uri) if @edge.nil? && @region && @@region_mappings[@region] - # rubocop:disable Layout/LineLength warn '[DEPRECATION] Setting default `Edge` for the provided `region`.' - # rubocop:enable Layout/LineLength @edge = @@region_mappings[@region] end return uri if @region.nil? && @edge.nil? diff --git a/spec/rest/client_spec.rb b/spec/rest/client_spec.rb index e7b052725..97230c521 100644 --- a/spec/rest/client_spec.rb +++ b/spec/rest/client_spec.rb @@ -36,10 +36,10 @@ $stderr = StringIO.new begin @client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger') - warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.' + warn '[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.' warn '[DEPRECATION] Setting default `Edge` for the provided `region`.' warnings = $stderr.string - expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.+[DEPRECATION] Setting default `Edge` for the provided `region`.') + expect(warnings).to include('[DEPRECATION] For regional processing, DNS is of format product...twilio.com; otherwise use product.twilio.com.') expect(warnings).to include('[DEPRECATION] Setting default `Edge` for the provided `region`.') ensure $stderr = original_stderr