Class: Google::Cloud::Talent::V4beta1::JobServiceClient

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/talent/v4beta1/job_service_client.rb,
lib/google/cloud/talent/v4beta1/helpers.rb

Overview

A service handles job management, including job CRUD, enumeration and search.

Defined Under Namespace

Classes: OperationsClient

Constant Summary collapse

SERVICE_ADDRESS =

The default address of the service.

"jobs.googleapis.com".freeze
DEFAULT_SERVICE_PORT =

The default port of the service.

443
GRPC_INTERCEPTORS =

The default set of gRPC interceptors.

[]
DEFAULT_TIMEOUT =
30
ALL_SCOPES =

The scopes needed to make gRPC calls to all of the methods defined in this service.

[
  "https://www.googleapis.com/auth/cloud-platform",
  "https://www.googleapis.com/auth/jobs"
].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, metadata: nil, service_address: nil, service_port: nil, exception_transformer: nil, lib_name: nil, lib_version: "") ⇒ JobServiceClient

Returns a new instance of JobServiceClient.

Parameters:

  • credentials (Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc) (defaults to: nil)

    Provides the means for authenticating requests made by the client. This parameter can be many types. A Google::Auth::Credentials uses a the properties of its represented keyfile for authenticating requests made by this client. A String will be treated as the path to the keyfile to be used for the construction of credentials for this client. A Hash will be treated as the contents of a keyfile to be used for the construction of credentials for this client. A GRPC::Core::Channel will be used to make calls through. A GRPC::Core::ChannelCredentials for the setting up the RPC client. The channel credentials should already be composed with a GRPC::Core::CallCredentials object. A Proc will be used as an updater_proc for the Grpc channel. The proc transforms the metadata for requests, generally, to give OAuth credentials.

  • scopes (Array<String>) (defaults to: ALL_SCOPES)

    The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.

  • client_config (Hash) (defaults to: {})

    A Hash for call options for each method. See Google::Gax#construct_settings for the structure of this data. Falls back to the default config if not specified or the specified config is missing data points.

  • timeout (Numeric) (defaults to: DEFAULT_TIMEOUT)

    The default timeout, in seconds, for calls made through this client.

  • metadata (Hash) (defaults to: nil)

    Default metadata to be sent with each request. This can be overridden on a per call basis.

  • service_address (String) (defaults to: nil)

    Override for the service hostname, or nil to leave as the default.

  • service_port (Integer) (defaults to: nil)

    Override for the service port, or nil to leave as the default.

  • exception_transformer (Proc) (defaults to: nil)

    An optional proc that intercepts any exceptions raised during an API call to inject custom error handling.



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 223

def initialize \
    credentials: nil,
    scopes: ALL_SCOPES,
    client_config: {},
    timeout: DEFAULT_TIMEOUT,
    metadata: nil,
    service_address: nil,
    service_port: nil,
    exception_transformer: nil,
    lib_name: nil,
    lib_version: ""
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "google/gax/grpc"
  require "google/cloud/talent/v4beta1/job_service_services_pb"

  credentials ||= Google::Cloud::Talent::V4beta1::Credentials.default

  @operations_client = OperationsClient.new(
    credentials: credentials,
    scopes: scopes,
    client_config: client_config,
    timeout: timeout,
    lib_name: lib_name,
    service_address: service_address,
    service_port: service_port,
    lib_version: lib_version,
    metadata: ,
  )

  if credentials.is_a?(String) || credentials.is_a?(Hash)
    updater_proc = Google::Cloud::Talent::V4beta1::Credentials.new(credentials).updater_proc
  end
  if credentials.is_a?(GRPC::Core::Channel)
    channel = credentials
  end
  if credentials.is_a?(GRPC::Core::ChannelCredentials)
    chan_creds = credentials
  end
  if credentials.is_a?(Proc)
    updater_proc = credentials
  end
  if credentials.is_a?(Google::Auth::Credentials)
    updater_proc = credentials.updater_proc
  end

  package_version = Google::Cloud::Talent::VERSION

  google_api_client = "gl-ruby/#{RUBY_VERSION}"
  google_api_client << " #{lib_name}/#{lib_version}" if lib_name
  google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
  google_api_client << " grpc/#{GRPC::VERSION}"
  google_api_client.freeze

  headers = { :"x-goog-api-client" => google_api_client }
  headers.merge!() unless .nil?
  client_config_file = Pathname.new(__dir__).join(
    "job_service_client_config.json"
  )
  defaults = client_config_file.open do |f|
    Google::Gax.construct_settings(
      "google.cloud.talent.v4beta1.JobService",
      JSON.parse(f.read),
      client_config,
      Google::Gax::Grpc::STATUS_CODE_NAMES,
      timeout,
      page_descriptors: PAGE_DESCRIPTORS,
      errors: Google::Gax::Grpc::API_ERRORS,
      metadata: headers
    )
  end

  # Allow overriding the service path/port in subclasses.
  service_path = service_address || self.class::SERVICE_ADDRESS
  port = service_port || self.class::DEFAULT_SERVICE_PORT
  interceptors = self.class::GRPC_INTERCEPTORS
  @job_service_stub = Google::Gax::Grpc.create_stub(
    service_path,
    port,
    chan_creds: chan_creds,
    channel: channel,
    updater_proc: updater_proc,
    scopes: scopes,
    interceptors: interceptors,
    &Google::Cloud::Talent::V4beta1::JobService::Stub.method(:new)
  )

  @create_job = Google::Gax.create_api_call(
    @job_service_stub.method(:create_job),
    defaults["create_job"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @get_job = Google::Gax.create_api_call(
    @job_service_stub.method(:get_job),
    defaults["get_job"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @update_job = Google::Gax.create_api_call(
    @job_service_stub.method(:update_job),
    defaults["update_job"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'job.name' => request.job.name}
    end
  )
  @delete_job = Google::Gax.create_api_call(
    @job_service_stub.method(:delete_job),
    defaults["delete_job"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'name' => request.name}
    end
  )
  @list_jobs = Google::Gax.create_api_call(
    @job_service_stub.method(:list_jobs),
    defaults["list_jobs"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @batch_delete_jobs = Google::Gax.create_api_call(
    @job_service_stub.method(:batch_delete_jobs),
    defaults["batch_delete_jobs"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @search_jobs = Google::Gax.create_api_call(
    @job_service_stub.method(:search_jobs),
    defaults["search_jobs"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @search_jobs_for_alert = Google::Gax.create_api_call(
    @job_service_stub.method(:search_jobs_for_alert),
    defaults["search_jobs_for_alert"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @batch_create_jobs = Google::Gax.create_api_call(
    @job_service_stub.method(:batch_create_jobs),
    defaults["batch_create_jobs"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
  @batch_update_jobs = Google::Gax.create_api_call(
    @job_service_stub.method(:batch_update_jobs),
    defaults["batch_update_jobs"],
    exception_transformer: exception_transformer,
    params_extractor: proc do |request|
      {'parent' => request.parent}
    end
  )
end

Class Method Details

.company_path(project, tenant, company) ⇒ String

Returns a fully-qualified company resource name string.

Parameters:

  • project (String)
  • tenant (String)
  • company (String)

Returns:

  • (String)


127
128
129
130
131
132
133
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 127

def self.company_path project, tenant, company
  COMPANY_PATH_TEMPLATE.render(
    :"project" => project,
    :"tenant" => tenant,
    :"company" => company
  )
end

.company_without_tenant_path(project, company) ⇒ String

Returns a fully-qualified company_without_tenant resource name string.

Parameters:

  • project (String)
  • company (String)

Returns:

  • (String)


139
140
141
142
143
144
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 139

def self.company_without_tenant_path project, company
  COMPANY_WITHOUT_TENANT_PATH_TEMPLATE.render(
    :"project" => project,
    :"company" => company
  )
end

.job_path(project, tenant, jobs) ⇒ String

Returns a fully-qualified job resource name string.

Parameters:

  • project (String)
  • tenant (String)
  • jobs (String)

Returns:

  • (String)


151
152
153
154
155
156
157
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 151

def self.job_path project, tenant, jobs
  JOB_PATH_TEMPLATE.render(
    :"project" => project,
    :"tenant" => tenant,
    :"jobs" => jobs
  )
end

.job_without_tenant_path(project, jobs) ⇒ String

Returns a fully-qualified job_without_tenant resource name string.

Parameters:

  • project (String)
  • jobs (String)

Returns:

  • (String)


163
164
165
166
167
168
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 163

def self.job_without_tenant_path project, jobs
  JOB_WITHOUT_TENANT_PATH_TEMPLATE.render(
    :"project" => project,
    :"jobs" => jobs
  )
end

.project_path(project) ⇒ String

Returns a fully-qualified project resource name string.

Parameters:

  • project (String)

Returns:

  • (String)


173
174
175
176
177
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 173

def self.project_path project
  PROJECT_PATH_TEMPLATE.render(
    :"project" => project
  )
end

.tenant_path(project, tenant) ⇒ String

Returns a fully-qualified tenant resource name string.

Parameters:

  • project (String)
  • tenant (String)

Returns:

  • (String)


183
184
185
186
187
188
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 183

def self.tenant_path project, tenant
  TENANT_PATH_TEMPLATE.render(
    :"project" => project,
    :"tenant" => tenant
  )
end

Instance Method Details

#batch_create_jobs(parent, jobs, options: nil) ⇒ Google::Gax::Operation

Begins executing a batch create jobs operation.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `jobs`:
jobs = []

# Register a callback during the method call.
operation = job_client.batch_create_jobs(formatted_parent, jobs) do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Or use the return value to register a callback.
operation.on_done do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Manually reload the operation.
operation.reload!

# Or block until the operation completes, triggering callbacks on
# completion.
operation.wait_until_done!

Parameters:

  • parent (String)

    Required. The resource name of the tenant under which the job is created.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

  • jobs (Array<Google::Cloud::Talent::V4beta1::Job | Hash>)

    Required. The jobs to be created. A hash of the same form as Google::Cloud::Talent::V4beta1::Job can also be provided.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

  • (Google::Gax::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 1456

def batch_create_jobs \
    parent,
    jobs,
    options: nil
  req = {
    parent: parent,
    jobs: jobs
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::BatchCreateJobsRequest)
  operation = Google::Gax::Operation.new(
    @batch_create_jobs.call(req, options),
    @operations_client,
    Google::Cloud::Talent::V4beta1::JobOperationResult,
    Google::Cloud::Talent::V4beta1::BatchOperationMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#batch_delete_jobs(parent, filter, options: nil) {|result, operation| ... } ⇒ Object

Deletes a list of Jobs by filter.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `filter`:
filter = ''
job_client.batch_delete_jobs(formatted_parent, filter)

Parameters:

  • parent (String)

    Required. The resource name of the tenant under which the job is created.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

  • filter (String)

    Required. The filter string specifies the jobs to be deleted.

    Supported operator: =, AND

    The fields eligible for filtering are:

    • companyName (Required)
    • requisitionId (Required)

    Sample Query: companyName = "projects/foo/companies/bar" AND requisitionId = "req-1"

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



696
697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 696

def batch_delete_jobs \
    parent,
    filter,
    options: nil,
    &block
  req = {
    parent: parent,
    filter: filter
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::BatchDeleteJobsRequest)
  @batch_delete_jobs.call(req, options, &block)
  nil
end

#batch_update_jobs(parent, jobs, update_mask: nil, options: nil) ⇒ Google::Gax::Operation

Begins executing a batch update jobs operation.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `jobs`:
jobs = []

# Register a callback during the method call.
operation = job_client.batch_update_jobs(formatted_parent, jobs) do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Or use the return value to register a callback.
operation.on_done do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Manually reload the operation.
operation.reload!

# Or block until the operation completes, triggering callbacks on
# completion.
operation.wait_until_done!

Parameters:

  • parent (String)

    Required. The resource name of the tenant under which the job is created.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

  • jobs (Array<Google::Cloud::Talent::V4beta1::Job | Hash>)

    Required. The jobs to be updated. A hash of the same form as Google::Cloud::Talent::V4beta1::Job can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash) (defaults to: nil)

    Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation.

    If update_mask is provided, only the specified fields in Job are updated. Otherwise all the fields are updated.

    A field mask to restrict the fields that are updated. Only top level fields of Job are supported.

    If update_mask is provided, The Job inside JobResult will only contains fields that is updated, plus the Id of the Job. Otherwise, Job will include all fields, which can yield a very large response. A hash of the same form as Google::Protobuf::FieldMask can also be provided.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

  • (Google::Gax::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 1551

def batch_update_jobs \
    parent,
    jobs,
    update_mask: nil,
    options: nil
  req = {
    parent: parent,
    jobs: jobs,
    update_mask: update_mask
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::BatchUpdateJobsRequest)
  operation = Google::Gax::Operation.new(
    @batch_update_jobs.call(req, options),
    @operations_client,
    Google::Cloud::Talent::V4beta1::JobOperationResult,
    Google::Cloud::Talent::V4beta1::BatchOperationMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#company_path(project, tenant, company) ⇒ String

Alias for Google::Cloud::Talent::V4beta1::JobServiceClient.company_path.

Parameters:

  • project (String)
  • tenant (String)
  • company (String)

Returns:

  • (String)


79
80
81
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 79

def company_path project, tenant, company
  self.class.company_path project, tenant, company
end

#company_without_tenant_path(project, company) ⇒ String

Alias for Google::Cloud::Talent::V4beta1::JobServiceClient.company_without_tenant_path.

Parameters:

  • project (String)
  • company (String)

Returns:

  • (String)


87
88
89
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 87

def company_without_tenant_path project, company
  self.class.company_without_tenant_path project, company
end

#create_job(parent, job, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Job

Creates a new job.

Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `job`:
job = {}
response = job_client.create_job(formatted_parent, job)

Parameters:

  • parent (String)

    Required. The resource name of the tenant under which the job is created.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo".

  • job (Google::Cloud::Talent::V4beta1::Job | Hash)

    Required. The Job to be created. A hash of the same form as Google::Cloud::Talent::V4beta1::Job can also be provided.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 428

def create_job \
    parent,
    job,
    options: nil,
    &block
  req = {
    parent: parent,
    job: job
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::CreateJobRequest)
  @create_job.call(req, options, &block)
end

#delete_job(name, options: nil) {|result, operation| ... } ⇒ Object

Deletes the specified job.

Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_name = Google::Cloud::Talent::V4beta1::JobServiceClient.job_path("[PROJECT]", "[TENANT]", "[JOBS]")
job_client.delete_job(formatted_name)

Parameters:

  • name (String)

    Required. The resource name of the job to be deleted.

    The format is "projects/project_id/tenants/tenant_id/jobs/job_id". For example, "projects/foo/tenants/bar/jobs/baz".

    If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



558
559
560
561
562
563
564
565
566
567
568
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 558

def delete_job \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::DeleteJobRequest)
  @delete_job.call(req, options, &block)
  nil
end

#get_job(name, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Job

Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_name = Google::Cloud::Talent::V4beta1::JobServiceClient.job_path("[PROJECT]", "[TENANT]", "[JOBS]")
response = job_client.get_job(formatted_name)

Parameters:

  • name (String)

    Required. The resource name of the job to retrieve.

    The format is "projects/project_id/tenants/tenant_id/jobs/job_id". For example, "projects/foo/tenants/bar/jobs/baz".

    If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



468
469
470
471
472
473
474
475
476
477
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 468

def get_job \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::GetJobRequest)
  @get_job.call(req, options, &block)
end

#job_path(project, tenant, jobs) ⇒ String

Alias for Google::Cloud::Talent::V4beta1::JobServiceClient.job_path.

Parameters:

  • project (String)
  • tenant (String)
  • jobs (String)

Returns:

  • (String)


96
97
98
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 96

def job_path project, tenant, jobs
  self.class.job_path project, tenant, jobs
end

#job_without_tenant_path(project, jobs) ⇒ String

Alias for Google::Cloud::Talent::V4beta1::JobServiceClient.job_without_tenant_path.

Parameters:

  • project (String)
  • jobs (String)

Returns:

  • (String)


104
105
106
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 104

def job_without_tenant_path project, jobs
  self.class.job_without_tenant_path project, jobs
end

#list_jobs(parent, filter, page_size: nil, job_view: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::Job>

Lists jobs by filter.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `filter`:
filter = ''

# Iterate over all results.
job_client.list_jobs(formatted_parent, filter).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
job_client.list_jobs(formatted_parent, filter).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    Required. The resource name of the tenant under which the job is created.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

  • filter (String)

    Required. The filter string specifies the jobs to be enumerated.

    Supported operator: =, AND

    The fields eligible for filtering are:

    • companyName (Required)
    • requisitionId
    • status Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified.

    Sample Query:

    • companyName = "projects/foo/tenants/bar/companies/baz"
    • companyName = "projects/foo/tenants/bar/companies/baz" AND requisitionId = "req-1"
    • companyName = "projects/foo/tenants/bar/companies/baz" AND status = "EXPIRED"
  • page_size (Integer) (defaults to: nil)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • job_view (Google::Cloud::Talent::V4beta1::JobView) (defaults to: nil)

    The desired job attributes returned for jobs in the search response. Defaults to JobView::JOB_VIEW_FULL if no value is specified.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::Job>)

    An enumerable of Google::Cloud::Talent::V4beta1::Job instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 642

def list_jobs \
    parent,
    filter,
    page_size: nil,
    job_view: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    filter: filter,
    page_size: page_size,
    job_view: job_view
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::ListJobsRequest)
  @list_jobs.call(req, options, &block)
end

#project_path(project) ⇒ String

Alias for Google::Cloud::Talent::V4beta1::JobServiceClient.project_path.

Parameters:

  • project (String)

Returns:

  • (String)


111
112
113
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 111

def project_path project
  self.class.project_path project
end

#search_jobs(parent, request_metadata, search_mode: nil, job_query: nil, enable_broadening: nil, require_precise_result_size: nil, histogram_queries: nil, job_view: nil, offset: nil, page_size: nil, order_by: nil, diversification_level: nil, custom_ranking_info: nil, disable_keyword_match: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::SearchJobsResponse::MatchingJob>

Searches for jobs using the provided SearchJobsRequest.

This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `request_metadata`:
 = {}

# Iterate over all results.
job_client.search_jobs(formatted_parent, ).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
job_client.search_jobs(formatted_parent, ).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    Required. The resource name of the tenant to search within.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

  • request_metadata (Google::Cloud::Talent::V4beta1::RequestMetadata | Hash)

    Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as user_id) are provided by users, and must be unique and consistent. A hash of the same form as Google::Cloud::Talent::V4beta1::RequestMetadata can also be provided.

  • search_mode (Google::Cloud::Talent::V4beta1::SearchJobsRequest::SearchMode) (defaults to: nil)

    Mode of a search.

    Defaults to SearchMode::JOB_SEARCH.

  • job_query (Google::Cloud::Talent::V4beta1::JobQuery | Hash) (defaults to: nil)

    Query used to search against jobs, such as keyword, location filters, etc. A hash of the same form as Google::Cloud::Talent::V4beta1::JobQuery can also be provided.

  • enable_broadening (true, false) (defaults to: nil)

    Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list.

    Defaults to false.

  • require_precise_result_size (true, false) (defaults to: nil)

    Controls if the search job request requires the return of a precise count of the first 300 results. Setting this to true ensures consistency in the number of results per page. Best practice is to set this value to true if a client allows users to jump directly to a non-sequential search results page.

    Enabling this flag may adversely impact performance.

    Defaults to false.

  • histogram_queries (Array<Google::Cloud::Talent::V4beta1::HistogramQuery | Hash>) (defaults to: nil)

    An expression specifies a histogram request against matching jobs.

    Expression syntax is an aggregation function call with histogram facets and other options.

    Available aggregation function calls are:

    • count(string_histogram_facet): Count the number of matching entities, for each distinct attribute value.
    • count(numeric_histogram_facet, list of buckets): Count the number of matching entities within each bucket.

    Data types:

    • Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+.
    • String: string like "any string with backslash escape for quote(\")."
    • Number: whole number and floating point number like 10, -1 and -0.01.
    • List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"].

    Built-in constants:

    • MIN (minimum number similar to java Double.MIN_VALUE)
    • MAX (maximum number similar to java Double.MAX_VALUE)

    Built-in functions:

    • bucket(start, end[, label]): bucket built-in function creates a bucket with range of [start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10).

    Job histogram facets:

    • company_display_name: histogram by Job#company_display_name.
    • employment_type: histogram by Job#employment_types, for example, "FULL_TIME", "PART_TIME".
    • company_size: histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG".
    • publish_time_in_month: histogram by the Job#posting_publish_time in months. Must specify list of numeric buckets in spec.
    • publish_time_in_year: histogram by the Job#posting_publish_time in years. Must specify list of numeric buckets in spec.
    • degree_types: histogram by the Job#degree_types, for example, "Bachelors", "Masters".
    • job_level: histogram by the Job#job_level, for example, "Entry Level".
    • country: histogram by the country code of jobs, for example, "US", "FR".
    • admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL".
    • city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY".
    • admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US".
    • city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically.
    • locale: histogram by the Job#language_code, for example, "en-US", "fr-FR".
    • language: histogram by the language subtag of the Job#language_code, for example, "en", "fr".
    • category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE".
    • base_compensation_unit: histogram by the CompensationInfo::CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY".
    • base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by.
    • annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by.
    • annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by.
    • string_custom_attribute: histogram by string Job#custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"].
    • numeric_custom_attribute: histogram by numeric Job#custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by.

    Example expressions:

    • count(admin1)
    • count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)])
    • count(string_custom_attribute["some-string-custom-attribute"])
    • count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"]) A hash of the same form as Google::Cloud::Talent::V4beta1::HistogramQuery can also be provided.
  • job_view (Google::Cloud::Talent::V4beta1::JobView) (defaults to: nil)

    The desired job attributes returned for jobs in the search response. Defaults to JobView::JOB_VIEW_SMALL if no value is specified.

  • offset (Integer) (defaults to: nil)

    An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset.

    For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page).

  • page_size (Integer) (defaults to: nil)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • order_by (String) (defaults to: nil)

    The criteria determining how search results are sorted. Default is "relevance desc".

    Supported options are:

    • "relevance desc": By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering.
    • "posting_publish_time desc": By Job#posting_publish_time descending.
    • "posting_update_time desc": By Job#posting_update_time descending.
    • "title": By Job#title ascending.
    • "title desc": By Job#title descending.
    • "annualized_base_compensation": By job's CompensationInfo#annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "annualized_base_compensation desc": By job's CompensationInfo#annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "annualized_total_compensation": By job's CompensationInfo#annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "annualized_total_compensation desc": By job's CompensationInfo#annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "custom_ranking desc": By the relevance score adjusted to the SearchJobsRequest::CustomRankingInfo#ranking_expression with weight factor assigned by SearchJobsRequest::CustomRankingInfo#importance_level in descending order.
    • Location sorting: Use the special syntax to order jobs by distance:
      "distance_from('Hawaii')": Order by distance from Hawaii.
      "distance_from(19.89, 155.5)": Order by distance from a coordinate.
      "distance_from('Hawaii'), distance_from('Puerto Rico')": Order by multiple locations. See details below.
      "distance_from('Hawaii'), distance_from(19.89, 155.5)": Order by multiple locations. See details below.
      The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.
  • diversification_level (Google::Cloud::Talent::V4beta1::SearchJobsRequest::DiversificationLevel) (defaults to: nil)

    Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results.

    Defaults to DiversificationLevel::SIMPLE if no value is specified.

  • custom_ranking_info (Google::Cloud::Talent::V4beta1::SearchJobsRequest::CustomRankingInfo | Hash) (defaults to: nil)

    Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). A hash of the same form as Google::Cloud::Talent::V4beta1::SearchJobsRequest::CustomRankingInfo can also be provided.

  • disable_keyword_match (true, false) (defaults to: nil)

    Controls whether to disable exact keyword match on Job#title, Job#description, Job#company_display_name, Job#addresses, Job#qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description.

    For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value.

    Use Company#keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests.

    Defaults to false.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::SearchJobsResponse::MatchingJob>)

    An enumerable of Google::Cloud::Talent::V4beta1::SearchJobsResponse::MatchingJob instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 1017

def search_jobs \
    parent,
    ,
    search_mode: nil,
    job_query: nil,
    enable_broadening: nil,
    require_precise_result_size: nil,
    histogram_queries: nil,
    job_view: nil,
    offset: nil,
    page_size: nil,
    order_by: nil,
    diversification_level: nil,
    custom_ranking_info: nil,
    disable_keyword_match: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    request_metadata: ,
    search_mode: search_mode,
    job_query: job_query,
    enable_broadening: enable_broadening,
    require_precise_result_size: require_precise_result_size,
    histogram_queries: histogram_queries,
    job_view: job_view,
    offset: offset,
    page_size: page_size,
    order_by: order_by,
    diversification_level: diversification_level,
    custom_ranking_info: custom_ranking_info,
    disable_keyword_match: disable_keyword_match
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::SearchJobsRequest)
  @search_jobs.call(req, options, &block)
end

#search_jobs_for_alert(parent, request_metadata, search_mode: nil, job_query: nil, enable_broadening: nil, require_precise_result_size: nil, histogram_queries: nil, job_view: nil, offset: nil, page_size: nil, order_by: nil, diversification_level: nil, custom_ranking_info: nil, disable_keyword_match: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::SearchJobsResponse::MatchingJob>

Searches for jobs using the provided SearchJobsRequest.

This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), and has different algorithmic adjustments that are targeted to passive job seekers.

This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)
formatted_parent = Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path("[PROJECT]", "[TENANT]")

# TODO: Initialize `request_metadata`:
 = {}

# Iterate over all results.
job_client.search_jobs_for_alert(formatted_parent, ).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
job_client.search_jobs_for_alert(formatted_parent, ).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    Required. The resource name of the tenant to search within.

    The format is "projects/project_id/tenants/tenant_id". For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".

  • request_metadata (Google::Cloud::Talent::V4beta1::RequestMetadata | Hash)

    Required. The meta information collected about the job searcher, used to improve the search quality of the service. The identifiers (such as user_id) are provided by users, and must be unique and consistent. A hash of the same form as Google::Cloud::Talent::V4beta1::RequestMetadata can also be provided.

  • search_mode (Google::Cloud::Talent::V4beta1::SearchJobsRequest::SearchMode) (defaults to: nil)

    Mode of a search.

    Defaults to SearchMode::JOB_SEARCH.

  • job_query (Google::Cloud::Talent::V4beta1::JobQuery | Hash) (defaults to: nil)

    Query used to search against jobs, such as keyword, location filters, etc. A hash of the same form as Google::Cloud::Talent::V4beta1::JobQuery can also be provided.

  • enable_broadening (true, false) (defaults to: nil)

    Controls whether to broaden the search when it produces sparse results. Broadened queries append results to the end of the matching results list.

    Defaults to false.

  • require_precise_result_size (true, false) (defaults to: nil)

    Controls if the search job request requires the return of a precise count of the first 300 results. Setting this to true ensures consistency in the number of results per page. Best practice is to set this value to true if a client allows users to jump directly to a non-sequential search results page.

    Enabling this flag may adversely impact performance.

    Defaults to false.

  • histogram_queries (Array<Google::Cloud::Talent::V4beta1::HistogramQuery | Hash>) (defaults to: nil)

    An expression specifies a histogram request against matching jobs.

    Expression syntax is an aggregation function call with histogram facets and other options.

    Available aggregation function calls are:

    • count(string_histogram_facet): Count the number of matching entities, for each distinct attribute value.
    • count(numeric_histogram_facet, list of buckets): Count the number of matching entities within each bucket.

    Data types:

    • Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9_]+.
    • String: string like "any string with backslash escape for quote(\")."
    • Number: whole number and floating point number like 10, -1 and -0.01.
    • List: list of elements with comma(,) separator surrounded by square brackets, for example, [1, 2, 3] and ["one", "two", "three"].

    Built-in constants:

    • MIN (minimum number similar to java Double.MIN_VALUE)
    • MAX (maximum number similar to java Double.MAX_VALUE)

    Built-in functions:

    • bucket(start, end[, label]): bucket built-in function creates a bucket with range of [start, end). Note that the end is exclusive, for example, bucket(1, MAX, "positive number") or bucket(1, 10).

    Job histogram facets:

    • company_display_name: histogram by Job#company_display_name.
    • employment_type: histogram by Job#employment_types, for example, "FULL_TIME", "PART_TIME".
    • company_size: histogram by CompanySize, for example, "SMALL", "MEDIUM", "BIG".
    • publish_time_in_month: histogram by the Job#posting_publish_time in months. Must specify list of numeric buckets in spec.
    • publish_time_in_year: histogram by the Job#posting_publish_time in years. Must specify list of numeric buckets in spec.
    • degree_types: histogram by the Job#degree_types, for example, "Bachelors", "Masters".
    • job_level: histogram by the Job#job_level, for example, "Entry Level".
    • country: histogram by the country code of jobs, for example, "US", "FR".
    • admin1: histogram by the admin1 code of jobs, which is a global placeholder referring to the state, province, or the particular term a country uses to define the geographic structure below the country level, for example, "CA", "IL".
    • city: histogram by a combination of the "city name, admin1 code". For example, "Mountain View, CA", "New York, NY".
    • admin1_country: histogram by a combination of the "admin1 code, country", for example, "CA, US", "IL, US".
    • city_coordinate: histogram by the city center's GPS coordinates (latitude and longitude), for example, 37.4038522,-122.0987765. Since the coordinates of a city center can change, customers may need to refresh them periodically.
    • locale: histogram by the Job#language_code, for example, "en-US", "fr-FR".
    • language: histogram by the language subtag of the Job#language_code, for example, "en", "fr".
    • category: histogram by the JobCategory, for example, "COMPUTER_AND_IT", "HEALTHCARE".
    • base_compensation_unit: histogram by the CompensationInfo::CompensationUnit of base salary, for example, "WEEKLY", "MONTHLY".
    • base_compensation: histogram by the base salary. Must specify list of numeric buckets to group results by.
    • annualized_base_compensation: histogram by the base annualized salary. Must specify list of numeric buckets to group results by.
    • annualized_total_compensation: histogram by the total annualized salary. Must specify list of numeric buckets to group results by.
    • string_custom_attribute: histogram by string Job#custom_attributes. Values can be accessed via square bracket notations like string_custom_attribute["key1"].
    • numeric_custom_attribute: histogram by numeric Job#custom_attributes. Values can be accessed via square bracket notations like numeric_custom_attribute["key1"]. Must specify list of numeric buckets to group results by.

    Example expressions:

    • count(admin1)
    • count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)])
    • count(string_custom_attribute["some-string-custom-attribute"])
    • count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"]) A hash of the same form as Google::Cloud::Talent::V4beta1::HistogramQuery can also be provided.
  • job_view (Google::Cloud::Talent::V4beta1::JobView) (defaults to: nil)

    The desired job attributes returned for jobs in the search response. Defaults to JobView::JOB_VIEW_SMALL if no value is specified.

  • offset (Integer) (defaults to: nil)

    An integer that specifies the current offset (that is, starting result location, amongst the jobs deemed by the API as relevant) in search results. This field is only considered if page_token is unset.

    For example, 0 means to return results starting from the first matching job, and 10 means to return from the 11th job. This can be used for pagination, (for example, pageSize = 10 and offset = 10 means to return from the second page).

  • page_size (Integer) (defaults to: nil)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • order_by (String) (defaults to: nil)

    The criteria determining how search results are sorted. Default is "relevance desc".

    Supported options are:

    • "relevance desc": By relevance descending, as determined by the API algorithms. Relevance thresholding of query results is only available with this ordering.
    • "posting_publish_time desc": By Job#posting_publish_time descending.
    • "posting_update_time desc": By Job#posting_update_time descending.
    • "title": By Job#title ascending.
    • "title desc": By Job#title descending.
    • "annualized_base_compensation": By job's CompensationInfo#annualized_base_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "annualized_base_compensation desc": By job's CompensationInfo#annualized_base_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "annualized_total_compensation": By job's CompensationInfo#annualized_total_compensation_range ascending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "annualized_total_compensation desc": By job's CompensationInfo#annualized_total_compensation_range descending. Jobs whose annualized base compensation is unspecified are put at the end of search results.
    • "custom_ranking desc": By the relevance score adjusted to the SearchJobsRequest::CustomRankingInfo#ranking_expression with weight factor assigned by SearchJobsRequest::CustomRankingInfo#importance_level in descending order.
    • Location sorting: Use the special syntax to order jobs by distance:
      "distance_from('Hawaii')": Order by distance from Hawaii.
      "distance_from(19.89, 155.5)": Order by distance from a coordinate.
      "distance_from('Hawaii'), distance_from('Puerto Rico')": Order by multiple locations. See details below.
      "distance_from('Hawaii'), distance_from(19.89, 155.5)": Order by multiple locations. See details below.
      The string can have a maximum of 256 characters. When multiple distance centers are provided, a job that is close to any of the distance centers would have a high rank. When a job has multiple locations, the job location closest to one of the distance centers will be used. Jobs that don't have locations will be ranked at the bottom. Distance is calculated with a precision of 11.3 meters (37.4 feet). Diversification strategy is still applied unless explicitly disabled in diversification_level.
  • diversification_level (Google::Cloud::Talent::V4beta1::SearchJobsRequest::DiversificationLevel) (defaults to: nil)

    Controls whether highly similar jobs are returned next to each other in the search results. Jobs are identified as highly similar based on their titles, job categories, and locations. Highly similar results are clustered so that only one representative job of the cluster is displayed to the job seeker higher up in the results, with the other jobs being displayed lower down in the results.

    Defaults to DiversificationLevel::SIMPLE if no value is specified.

  • custom_ranking_info (Google::Cloud::Talent::V4beta1::SearchJobsRequest::CustomRankingInfo | Hash) (defaults to: nil)

    Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). A hash of the same form as Google::Cloud::Talent::V4beta1::SearchJobsRequest::CustomRankingInfo can also be provided.

  • disable_keyword_match (true, false) (defaults to: nil)

    Controls whether to disable exact keyword match on Job#title, Job#description, Job#company_display_name, Job#addresses, Job#qualifications. When disable keyword match is turned off, a keyword match returns jobs that do not match given category filters when there are matching keywords. For example, for the query "program manager," a result is returned even if the job posting has the title "software developer," which doesn't fall into "program manager" ontology, but does have "program manager" appearing in its description.

    For queries like "cloud" that don't contain title or location specific ontology, jobs with "cloud" keyword matches are returned regardless of this flag's value.

    Use Company#keyword_searchable_job_custom_attributes if company-specific globally matched custom field/attribute string values are needed. Enabling keyword match improves recall of subsequent search requests.

    Defaults to false.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Cloud::Talent::V4beta1::SearchJobsResponse::MatchingJob>)

    An enumerable of Google::Cloud::Talent::V4beta1::SearchJobsResponse::MatchingJob instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 1366

def search_jobs_for_alert \
    parent,
    ,
    search_mode: nil,
    job_query: nil,
    enable_broadening: nil,
    require_precise_result_size: nil,
    histogram_queries: nil,
    job_view: nil,
    offset: nil,
    page_size: nil,
    order_by: nil,
    diversification_level: nil,
    custom_ranking_info: nil,
    disable_keyword_match: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    request_metadata: ,
    search_mode: search_mode,
    job_query: job_query,
    enable_broadening: enable_broadening,
    require_precise_result_size: require_precise_result_size,
    histogram_queries: histogram_queries,
    job_view: job_view,
    offset: offset,
    page_size: page_size,
    order_by: order_by,
    diversification_level: diversification_level,
    custom_ranking_info: custom_ranking_info,
    disable_keyword_match: disable_keyword_match
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::SearchJobsRequest)
  @search_jobs_for_alert.call(req, options, &block)
end

#tenant_path(project, tenant) ⇒ String

Alias for Google::Cloud::Talent::V4beta1::JobServiceClient.tenant_path.

Parameters:

  • project (String)
  • tenant (String)

Returns:

  • (String)


119
120
121
# File 'lib/google/cloud/talent/v4beta1/helpers.rb', line 119

def tenant_path project, tenant
  self.class.tenant_path project, tenant
end

#update_job(job, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Cloud::Talent::V4beta1::Job

Updates specified job.

Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.

Examples:

require "google/cloud/talent"

job_client = Google::Cloud::Talent::JobService.new(version: :v4beta1)

# TODO: Initialize `job`:
job = {}
response = job_client.update_job(job)

Parameters:

  • job (Google::Cloud::Talent::V4beta1::Job | Hash)

    Required. The Job to be updated. A hash of the same form as Google::Cloud::Talent::V4beta1::Job can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash) (defaults to: nil)

    Strongly recommended for the best service experience.

    If update_mask is provided, only the specified fields in job are updated. Otherwise all the fields are updated.

    A field mask to restrict the fields that are updated. Only top level fields of Job are supported. A hash of the same form as Google::Protobuf::FieldMask can also be provided.

  • options (Google::Gax::CallOptions) (defaults to: nil)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



517
518
519
520
521
522
523
524
525
526
527
528
# File 'lib/google/cloud/talent/v4beta1/job_service_client.rb', line 517

def update_job \
    job,
    update_mask: nil,
    options: nil,
    &block
  req = {
    job: job,
    update_mask: update_mask
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Cloud::Talent::V4beta1::UpdateJobRequest)
  @update_job.call(req, options, &block)
end