lib/google/cloud/talent/v4beta1/company_service_client.rb in google-cloud-talent-0.9.0 vs lib/google/cloud/talent/v4beta1/company_service_client.rb in google-cloud-talent-0.10.0

- old
+ new

@@ -92,10 +92,12 @@ ) private_constant :TENANT_PATH_TEMPLATE # Returns a fully-qualified company resource name string. + # @deprecated Multi-pattern resource names will have unified creation and parsing helper functions. + # This helper function will be deleted in the next major version. # @param project [String] # @param tenant [String] # @param company [String] # @return [String] def self.company_path project, tenant, company @@ -105,10 +107,12 @@ :"company" => company ) end # Returns a fully-qualified company_without_tenant resource name string. + # @deprecated Multi-pattern resource names will have unified creation and parsing helper functions. + # This helper function will be deleted in the next major version. # @param project [String] # @param company [String] # @return [String] def self.company_without_tenant_path project, company COMPANY_WITHOUT_TENANT_PATH_TEMPLATE.render( @@ -247,10 +251,18 @@ scopes: scopes, interceptors: interceptors, &Google::Cloud::Talent::V4beta1::CompanyService::Stub.method(:new) ) + @delete_company = Google::Gax.create_api_call( + @company_service_stub.method(:delete_company), + defaults["delete_company"], + exception_transformer: exception_transformer, + params_extractor: proc do |request| + {'name' => request.name} + end + ) @create_company = Google::Gax.create_api_call( @company_service_stub.method(:create_company), defaults["create_company"], exception_transformer: exception_transformer, params_extractor: proc do |request| @@ -271,18 +283,10 @@ exception_transformer: exception_transformer, params_extractor: proc do |request| {'company.name' => request.company.name} end ) - @delete_company = Google::Gax.create_api_call( - @company_service_stub.method(:delete_company), - defaults["delete_company"], - exception_transformer: exception_transformer, - params_extractor: proc do |request| - {'name' => request.name} - end - ) @list_companies = Google::Gax.create_api_call( @company_service_stub.method(:list_companies), defaults["list_companies"], exception_transformer: exception_transformer, params_extractor: proc do |request| @@ -291,10 +295,48 @@ ) end # Service calls + # Deletes specified company. + # Prerequisite: The company has no jobs associated with it. + # + # @param name [String] + # Required. The resource name of the company to be deleted. + # + # The format is + # "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for + # example, "projects/foo/tenants/bar/companies/baz". + # + # If tenant id is unspecified, the default tenant is used, for + # example, "projects/foo/companies/bar". + # @param options [Google::Gax::CallOptions] + # Overrides the default settings for this call, e.g, timeout, + # retries, etc. + # @yield [result, operation] Access the result along with the RPC operation + # @yieldparam result [] + # @yieldparam operation [GRPC::ActiveCall::Operation] + # @raise [Google::Gax::GaxError] if the RPC is aborted. + # @example + # require "google/cloud/talent" + # + # company_client = Google::Cloud::Talent::CompanyService.new(version: :v4beta1) + # formatted_name = Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_without_tenant_path("[PROJECT]", "[COMPANY]") + # company_client.delete_company(formatted_name) + + def delete_company \ + name, + options: nil, + &block + req = { + name: name + }.delete_if { |_, v| v.nil? } + req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::DeleteCompanyRequest) + @delete_company.call(req, options, &block) + nil + end + # Creates a new company entity. # # @param parent [String] # Required. Resource name of the tenant under which the company is created. # @@ -315,11 +357,11 @@ # @raise [Google::Gax::GaxError] if the RPC is aborted. # @example # require "google/cloud/talent" # # company_client = Google::Cloud::Talent::CompanyService.new(version: :v4beta1) - # formatted_parent = Google::Cloud::Talent::V4beta1::CompanyServiceClient.tenant_path("[PROJECT]", "[TENANT]") + # formatted_parent = Google::Cloud::Talent::V4beta1::CompanyServiceClient.project_path("[PROJECT]") # # # TODO: Initialize `company`: # company = {} # response = company_client.create_company(formatted_parent, company) @@ -357,11 +399,11 @@ # @raise [Google::Gax::GaxError] if the RPC is aborted. # @example # require "google/cloud/talent" # # company_client = Google::Cloud::Talent::CompanyService.new(version: :v4beta1) - # formatted_name = Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_path("[PROJECT]", "[TENANT]", "[COMPANY]") + # formatted_name = Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_without_tenant_path("[PROJECT]", "[COMPANY]") # response = company_client.get_company(formatted_name) def get_company \ name, options: nil, @@ -417,48 +459,10 @@ }.delete_if { |_, v| v.nil? } req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::UpdateCompanyRequest) @update_company.call(req, options, &block) end - # Deletes specified company. - # Prerequisite: The company has no jobs associated with it. - # - # @param name [String] - # Required. The resource name of the company to be deleted. - # - # The format is - # "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for - # example, "projects/foo/tenants/bar/companies/baz". - # - # If tenant id is unspecified, the default tenant is used, for - # example, "projects/foo/companies/bar". - # @param options [Google::Gax::CallOptions] - # Overrides the default settings for this call, e.g, timeout, - # retries, etc. - # @yield [result, operation] Access the result along with the RPC operation - # @yieldparam result [] - # @yieldparam operation [GRPC::ActiveCall::Operation] - # @raise [Google::Gax::GaxError] if the RPC is aborted. - # @example - # require "google/cloud/talent" - # - # company_client = Google::Cloud::Talent::CompanyService.new(version: :v4beta1) - # formatted_name = Google::Cloud::Talent::V4beta1::CompanyServiceClient.company_path("[PROJECT]", "[TENANT]", "[COMPANY]") - # company_client.delete_company(formatted_name) - - def delete_company \ - name, - options: nil, - &block - req = { - name: name - }.delete_if { |_, v| v.nil? } - req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::DeleteCompanyRequest) - @delete_company.call(req, options, &block) - nil - end - # Lists all companies associated with the project. # # @param parent [String] # Required. Resource name of the tenant under which the company is created. # @@ -494,10 +498,10 @@ # @raise [Google::Gax::GaxError] if the RPC is aborted. # @example # require "google/cloud/talent" # # company_client = Google::Cloud::Talent::CompanyService.new(version: :v4beta1) - # formatted_parent = Google::Cloud::Talent::V4beta1::CompanyServiceClient.tenant_path("[PROJECT]", "[TENANT]") + # formatted_parent = Google::Cloud::Talent::V4beta1::CompanyServiceClient.project_path("[PROJECT]") # # # Iterate over all results. # company_client.list_companies(formatted_parent).each do |element| # # Process element. # end