Migrate Bandwidth from Basic Auth to OAuth

Amolith created

Switch ruby-bandwidth-iris from the fork (list-port-ins branch) to the
official gem ~> 7.4, which includes both the port-in listing feature and
OAuth client credentials support.

Replace username/password with client_id/client_secret in
BandwidthIris::Client.global_options for both
bin/active_tels_on_catapult and bin/cancel_expired_customers, and update
the Dhall config schema in cancel_expired_customers accordingly.

Add faraday-em_http and faraday-em_synchrony adapter forks needed for
Faraday 2 compatibility with EventMachine, and add the
faraday/em_synchrony require to cancel_expired_customers.

Change summary

Gemfile                      | 4 +++-
bin/active_tels_on_catapult  | 4 ++--
bin/cancel_expired_customers | 9 +++++----
3 files changed, 10 insertions(+), 7 deletions(-)

Detailed changes

Gemfile 🔗

@@ -13,12 +13,14 @@ gem "dhall", ">= 0.5.3.fixed"
 gem "em-http-request"
 gem "em_promise.rb"
 gem "em-synchrony"
+gem "faraday-em_http", git: "https://github.com/Amolith/faraday-em_http", branch: "fix-gzip"
+gem "faraday-em_synchrony", git: "https://github.com/Amolith/faraday-em_synchrony", branch: "update-for-faraday-2"
 gem "mail"
 gem "money-open-exchange-rates"
 gem "pg"
 gem "redis"
 gem "roda"
-gem "ruby-bandwidth-iris", git: "https://github.com/singpolyma/ruby-bandwidth-iris", branch: "list-port-ins"
+gem "ruby-bandwidth-iris", "~> 7.4"
 gem "sentry-ruby"
 gem "slim"
 

bin/active_tels_on_catapult 🔗

@@ -13,8 +13,8 @@ CONFIG = Dhall.load(ARGV[0]).sync
 
 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]
 }
 
 REDIS = Redis.new

bin/cancel_expired_customers 🔗

@@ -5,6 +5,7 @@ require "date"
 require "dhall"
 require "em_promise"
 require "pg"
+require "faraday/em_synchrony"
 require "ruby-bandwidth-iris"
 require "set"
 
@@ -16,8 +17,8 @@ CONFIG = Dhall.load(<<-DHALL).sync
 		sgx_jmp: Text,
 		creds: {
 			account: Text,
-			username: Text,
-			password: Text
+			client_id: Text,
+			client_secret: Text
 		},
 		notify_using: {
 			jid: Text,
@@ -32,8 +33,8 @@ DHALL
 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]
 }
 
 using ToForm