Commit b22959cc authored by Matija Čupić's avatar Matija Čupić

Remove redundant GoogleApi::CloudPlatform::Client methods

The methods removed are #projects_list #get_project_billing_info
as well as #project_zones_list and #project_zone_machine_types_list
parent 2205ed4f
......@@ -43,40 +43,6 @@ module GoogleApi
true
end
def projects_list
service = Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService.new
service.authorization = access_token
service.fetch_all(items: :projects) do |token|
service.list_projects(page_token: token, options: user_agent_header)
end
end
def projects_get_billing_info(project_id)
service = Google::Apis::CloudbillingV1::CloudbillingService.new
service.authorization = access_token
service.get_project_billing_info("projects/#{project_id}", options: user_agent_header)
end
def projects_zones_list(project_id)
service = Google::Apis::ComputeV1::ComputeService.new
service.authorization = access_token
service.fetch_all do |token|
service.list_zones(project_id, page_token: token, options: user_agent_header)
end
end
def projects_zones_machine_types_list(project_id, zone)
service = Google::Apis::ComputeV1::ComputeService.new
service.authorization = access_token
service.fetch_all do |token|
service.list_machine_types(project_id, zone, page_token: token, options: user_agent_header)
end
end
def projects_zones_clusters_get(project_id, zone, cluster_id)
service = Google::Apis::ContainerV1::ContainerService.new
service.authorization = access_token
......
......@@ -50,54 +50,6 @@ describe GoogleApi::CloudPlatform::Client do
end
end
describe '#projects_list' do
subject { client.projects_list }
let(:projects) { double }
before do
allow_any_instance_of(Google::Apis::CloudresourcemanagerV1::CloudResourceManagerService)
.to receive(:fetch_all).and_return(projects)
end
it { is_expected.to eq(projects) }
end
describe '#projects_get_billing_info' do
subject { client.projects_get_billing_info('project') }
let(:billing_info) { double }
before do
allow_any_instance_of(Google::Apis::CloudbillingV1::CloudbillingService)
.to receive(:get_project_billing_info).and_return(billing_info)
end
it { is_expected.to eq(billing_info) }
end
describe '#projects_zones_list' do
subject { client.projects_zones_list('project') }
let(:zones) { double }
before do
allow_any_instance_of(Google::Apis::ComputeV1::ComputeService)
.to receive(:fetch_all).and_return(zones)
end
it { is_expected.to eq(zones) }
end
describe '#projects_zones_machine_types_list' do
subject { client.projects_zones_machine_types_list('project', 'zone') }
let(:machine_types) { double }
before do
allow_any_instance_of(Google::Apis::ComputeV1::ComputeService)
.to receive(:fetch_all).and_return(machine_types)
end
it { is_expected.to eq(machine_types) }
end
describe '#projects_zones_clusters_get' do
subject { client.projects_zones_clusters_get(spy, spy, spy) }
let(:gke_cluster) { double }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment