From b22959cc040384ab942bd41a69cdb4f2ffea0f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Fri, 11 May 2018 18:45:45 +0200 Subject: [PATCH] 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 --- lib/google_api/cloud_platform/client.rb | 34 ------------- .../google_api/cloud_platform/client_spec.rb | 48 ------------------- 2 files changed, 82 deletions(-) diff --git a/lib/google_api/cloud_platform/client.rb b/lib/google_api/cloud_platform/client.rb index f7a00974efc..36859b4d025 100644 --- a/lib/google_api/cloud_platform/client.rb +++ b/lib/google_api/cloud_platform/client.rb @@ -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 diff --git a/spec/lib/google_api/cloud_platform/client_spec.rb b/spec/lib/google_api/cloud_platform/client_spec.rb index 040cbda9468..27cb3198e5b 100644 --- a/spec/lib/google_api/cloud_platform/client_spec.rb +++ b/spec/lib/google_api/cloud_platform/client_spec.rb @@ -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 }