From bcc97a30c21ef5ef5496bd6f19f79d7d48235ba8 Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Tue, 19 Aug 2025 14:53:52 -0400 Subject: [PATCH] use tn.get_details[:city] in stash_for_later i apparently thought this was broken earlier, but it seems to just work in test cases i have tried, so let's see if this version just does what it should --- lib/bandwidth_tn_repo.rb | 4 ++-- test/test_admin_command.rb | 27 ++++++++++++--------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/bandwidth_tn_repo.rb b/lib/bandwidth_tn_repo.rb index 9f2d746cf6d1c44b2e2dabb93162c699fc3b0d33..10e2fd3d590e487dda3befc7aed8f48d69379208 100644 --- a/lib/bandwidth_tn_repo.rb +++ b/lib/bandwidth_tn_repo.rb @@ -48,9 +48,9 @@ class BandwidthTnRepo def stash_for_later(tel, btn) LOG.info "stash_for_later #{tel}\n#{caller}" - details = btn.get_rate_center + details = btn.get_details region = details[:state] - locality = details[:rate_center] + locality = details[:city] params = [tel, region, locality, CONFIG[:creds][:account]] DB.exec(STASH_QUERY, params) end diff --git a/test/test_admin_command.rb b/test/test_admin_command.rb index 6d8ec8110287fe9193a9a77e045be1e800b77153..4a38fa5cfb162d50a73b48d88935fd8725c990d0 100644 --- a/test/test_admin_command.rb +++ b/test/test_admin_command.rb @@ -341,27 +341,24 @@ class AdminCommandTest < Minitest::Test em :test_action_cancel_account def test_action_cancel_account_keep_number - rate_center_response = { + details_response = { "TelephoneNumberDetails": { State: "NY", - RateCenter: "NWYRCYZN01" + City: "MANHATTEN" } }.to_xml(indent: 0, root: "TelephoneNumberResponse") bandwidth_req = stub_request( :get, - "https://dashboard.bandwidth.com/v1.0/tns/5566667777/ratecenter" - ) - .with( - headers: { - "Accept" => "application/xml", - "Accept-Encoding" => "gzip, compressed", - "Authorization" => "Basic dGVzdF9id191c2VyOnRlc3RfYndfcGFzc3dvcmQ=", - "User-Agent" => "Ruby-Bandwidth-Iris" - }, - body: "" - ) - .to_return(status: 200, body: rate_center_response, headers: {}) + "https://dashboard.bandwidth.com/v1.0/tns/5566667777/tndetails" + ).with( + headers: { + "Accept" => "application/xml", + "Accept-Encoding" => "gzip, compressed", + "Authorization" => "Basic dGVzdF9id191c2VyOnRlc3RfYndfcGFzc3dvcmQ=", + "User-Agent" => "Ruby-Bandwidth-Iris" + } + ).to_return(status: 200, body: details_response, headers: {}) churnbuster_req = stub_request( :post, @@ -385,7 +382,7 @@ class AdminCommandTest < Minitest::Test sgx, admin = admin_command("+15566667777") - sql_params = ["+15566667777", "NY", "NWYRCYZN01", "test_bw_account"] + sql_params = ["+15566667777", "NY", "MANHATTEN", "test_bw_account"] BandwidthTnRepo::DB.expect( :exec,