Remove old API code for v1 vs v2

Stephen Paul Weber created

v1 is long gone

Change summary

forms/admin_info.rb        |  6 -----
lib/api.rb                 | 44 ----------------------------------------
lib/customer_info.rb       |  3 --
test/test_customer_info.rb |  1 
test/test_porting_step.rb  |  1 
5 files changed, 55 deletions(-)

Detailed changes

forms/admin_info.rb 🔗

@@ -57,12 +57,6 @@ field(
 	value: @admin_info.trust_level
 )
 
-field(
-	var: "api",
-	label: "API",
-	value: @admin_info.api.to_s
-)
-
 field(
 	var: "link",
 	label: "Link",

lib/api.rb 🔗

@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-class API
-	def self.for(customer)
-		EMPromise.all([
-			sgx_jmp?(customer),
-			api_version(customer)
-		]).then do |is_jmp, api|
-			is_jmp ? JMP.new : api
-		end
-	end
-
-	def self.sgx_jmp?(customer)
-		key = "catapult_cred-customer_#{customer.customer_id}@jmp.chat"
-		REDIS.exists(key).then { |is_sgx| is_sgx == 1 }
-	end
-
-	def self.api_version(customer)
-		REDIS.lindex("catapult_cred-#{customer.jid}", 0).then do |api|
-			case api
-			when CONFIG.dig(:creds, :account)
-				V2.new
-			else
-				new
-			end
-		end
-	end
-
-	class V2 < API
-		def to_s
-			"v2"
-		end
-	end
-
-	class JMP < V2
-		def to_s
-			"sgx-jmp"
-		end
-	end
-
-	def to_s
-		"not JMP"
-	end
-end

lib/customer_info.rb 🔗

@@ -5,7 +5,6 @@ require "forwardable"
 require "relative_time"
 require "value_semantics/monkey_patched"
 
-require_relative "api"
 require_relative "call_attempt_repo"
 require_relative "customer"
 require_relative "customer_plan"
@@ -112,7 +111,6 @@ class AdminInfo
 		customer_id String
 		fwd Either(CustomerFwd, nil)
 		info CustomerInfo
-		api API
 		call_info String
 		trust_level String
 		backend_jid String
@@ -129,7 +127,6 @@ class AdminInfo
 			jid: customer.jid, customer_id: customer.customer_id,
 			fwd: customer.fwd,
 			info: CustomerInfo.for(customer),
-			api: API.for(customer),
 			call_info: call_info(customer, call_attempt_repo),
 			trust_level: trust_level_repo.find(customer).then(&:to_s),
 			backend_jid: backend_repo.get(customer.customer_id).from_jid.to_s,

test/test_customer_info.rb 🔗

@@ -5,7 +5,6 @@ require "customer_info"
 require "trust_level_repo"
 require "trust_level"
 
-API::REDIS = FakeRedis.new
 CustomerPlan::DB = Minitest::Mock.new
 CustomerPlan::REDIS = Minitest::Mock.new
 CustomerUsage::DB = Minitest::Mock.new

test/test_porting_step.rb 🔗

@@ -67,7 +67,6 @@ def admin_info(customer_id, tel)
 		customer_id: customer_id,
 		fwd: nil,
 		info: info(tel),
-		api: API::V2.new,
 		call_info: "",
 		trust_level: "",
 		backend_jid: "customer_#{customer_id}@example.com"