Switch BW clients from Basic to Client creds

Amolith created

Basic credentials are only usable for id.bandwidth.com, both gems prefer
api.bandwidth.com, and only iris seems to fall back to id. This adds the new
client cred fields to the config and uses them throughout.

Change summary

config-schema.dhall      | 8 +++++++-
config.dhall.sample      | 2 ++
lib/bandwidth_tn_repo.rb | 4 ++--
sgx_jmp.rb               | 8 ++++----
test/test_helper.rb      | 2 ++
5 files changed, 17 insertions(+), 7 deletions(-)

Detailed changes

config-schema.dhall 🔗

@@ -17,7 +17,13 @@
 , churnbuster : { account_id : Text, api_key : Text }
 , component : { jid : Text, secret : Text }
 , credit_card_url : forall (jid : Text) -> forall (customer_id : Text) -> Text
-, creds : { account : Text, password : Text, username : Text }
+, creds :
+    { account : Text
+    , client_id : Text
+    , client_secret : Text
+    , password : Text
+    , username : Text
+    }
 , direct_sources : List { mapKey : Text, mapValue : Text }
 , direct_targets : List { mapKey : Text, mapValue : Text }
 , electrum :

config.dhall.sample 🔗

@@ -19,6 +19,8 @@ in
 	],
 	creds = {
 		account = "00000",
+		client_id = "oauth client id",
+		client_secret = "oauth client secret",
 		username = "dashboard user",
 		password = "dashboard password"
 	},

lib/bandwidth_tn_repo.rb 🔗

@@ -25,8 +25,8 @@ class BandwidthTnRepo
 		@move_client =
 			BandwidthIris::Client.new(
 				account_id: CONFIG[:keep_area_codes_in][:account],
-				username: CONFIG[:creds][:username],
-				password: CONFIG[:creds][:password]
+				client_id: CONFIG[:creds][:client_id],
+				client_secret: CONFIG[:creds][:client_secret]
 			)
 	end
 

sgx_jmp.rb 🔗

@@ -121,12 +121,12 @@ EM::Hiredis::Client.load_scripts_from("#{__dir__}/redis_lua")
 Faraday.default_adapter = :em_synchrony
 BandwidthIris::Client.global_options = {
 	account_id: CONFIG[:creds][:account],
-	username: CONFIG[:creds][:username],
-	password: CONFIG[:creds][:password]
+	client_id: CONFIG[:creds][:client_id],
+	client_secret: CONFIG[:creds][:client_secret]
 }
 Bandwidth.configure do |config|
-	config.client_id = CONFIG[:creds][:username]
-	config.client_secret = CONFIG[:creds][:password]
+	config.client_id = CONFIG[:creds][:client_id]
+	config.client_secret = CONFIG[:creds][:client_secret]
 end
 BANDWIDTH_VOICE = Bandwidth::CallsApi.new
 

test/test_helper.rb 🔗

@@ -85,6 +85,8 @@ CONFIG = {
 	},
 	creds: {
 		account: "test_bw_account",
+		client_id: "test_bw_client_id",
+		client_secret: "test_bw_client_secret",
 		username: "test_bw_user",
 		password: "test_bw_password"
 	},