Update company with field mask (v3)

Update a company with field mask.

Code sample

Ruby

To authenticate to CTS, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

# company_name     = "The name of the company you want to update. The format is "projects/{project_id}/companies/{company_id}""
# field_mask       = "The field mask you want to update"
# company_updated  = "The new company object to be updated"

require "google/apis/jobs_v3"

jobs = Google::Apis::JobsV3
talent_solution_client = jobs::CloudTalentSolutionService.new
# @see
# https://developers.google.com/identity/protocols/application-default-credentials#callingruby
talent_solution_client.authorization = Google::Auth.get_application_default(
  "https://www.googleapis.com/auth/jobs"
)

begin
  update_company_request = jobs::UpdateCompanyRequest.new company:     company_updated,
                                                          update_mask: field_mask
  company_updated = talent_solution_client
                    .patch_project_company(company_name, update_company_request)
  puts "Company updated with filedMask #{update_company_request.update_mask}. "
  puts "Updated company: #{company_updated.to_json}"
  company_updated
rescue StandardError => e
  puts "Exception occurred while updating company with fieldMask: #{e}"
end

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.