使用字段掩码更新公司 (v3)

使用字段掩码更新公司。

代码示例

Ruby

# 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

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器