diff --git a/forms/admin_info.rb b/forms/admin_info.rb index 81b44dfb9dfaaa6490d97b48babd3d8f8d09df01..5a4d9678aa30fa3141cca8fb0333ec398c69736c 100644 --- a/forms/admin_info.rb +++ b/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", diff --git a/lib/api.rb b/lib/api.rb deleted file mode 100644 index 73c5f0f1c553b196bbcaa48bf629949cb37fe438..0000000000000000000000000000000000000000 --- a/lib/api.rb +++ /dev/null @@ -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 diff --git a/lib/customer_info.rb b/lib/customer_info.rb index 8e02d9ef53df3ffa614e91af62f2bfa338821619..a2bd09edd41f5135351303e5636355a2f5fd63f9 100644 --- a/lib/customer_info.rb +++ b/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, diff --git a/test/test_customer_info.rb b/test/test_customer_info.rb index ccaca204906514342bd1c34410ce7c420b59ad01..f4258afdff1e5a739f05735232dc28008b1e0bd1 100644 --- a/test/test_customer_info.rb +++ b/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 diff --git a/test/test_porting_step.rb b/test/test_porting_step.rb index 940110d94b6a41d1be2d370703bc1c27d1c14afe..00674517c973ecef9588a1504193cc23831a345e 100644 --- a/test/test_porting_step.rb +++ b/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"