use tn.get_details[:city] in stash_for_later

Phillip Davis created

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

Change summary

lib/bandwidth_tn_repo.rb   |  4 ++--
test/test_admin_command.rb | 27 ++++++++++++---------------
2 files changed, 14 insertions(+), 17 deletions(-)

Detailed changes

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

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,