google-cloud-talent 1.5.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3041c24f9dc8fbc17bc742a746ba241da4c40bab472572229e6e350699a3755
4
- data.tar.gz: 2308c91ecaa6ff574de5abc80463c2f47c6491b537349f69ba615eb3602d2954
3
+ metadata.gz: 5d89d415751877617d7d4b92c1c940df23c19d80dc632f01664b6f7edc7f167a
4
+ data.tar.gz: 179777deaf5af40886aaf0854051c3e13667353dc02b8f8ecc0bfc8468ca0440
5
5
  SHA512:
6
- metadata.gz: d0d709730985e7eefe94bedd10c6a1aef1dba539a5a2d91df9cb73556a19b98549141754938b5d0ae48c8853bdd841f8e60d4a18ef642dcf2c3b197d1ce16e86
7
- data.tar.gz: 3e3e66d82f6aa49b65f14b7f6a26d1614ea97b84f69a494843e990587093ee6547a38af36386f3d9e44064f4f8058aefc7f3e76fa9312870cc2dfdb62a66927a
6
+ metadata.gz: fca255866b3a2e9c2e650e3894432830a36f20d92033fd6ed73858a1c82afa5671ac4a99cb83b1d4b275a2691e2bd563fbf56568e1b320a9162238b27697d4a6
7
+ data.tar.gz: 0cd4004bd76edc0200b7e873729b904056c31b46f3849d54b14cf6979d2cf69f1eecbe8727381f90b6af055ae105dc802aedffe147e9ba3e3b631c46da9e5c30
data/.yardopts CHANGED
@@ -8,5 +8,4 @@
8
8
  -
9
9
  README.md
10
10
  AUTHENTICATION.md
11
- MIGRATING.md
12
11
  LICENSE.md
data/README.md CHANGED
@@ -16,8 +16,7 @@ for this library, google-cloud-talent, to see the convenience methods for
16
16
  constructing client objects. Reference documentation for the client objects
17
17
  themselves can be found in the client library documentation for the versioned
18
18
  client gems:
19
- [google-cloud-talent-v4](https://cloud.google.com/ruby/docs/reference/google-cloud-talent-v4/latest),
20
- [google-cloud-talent-v4beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-talent-v4beta1/latest).
19
+ [google-cloud-talent-v4](https://cloud.google.com/ruby/docs/reference/google-cloud-talent-v4/latest).
21
20
 
22
21
  See also the [Product Documentation](https://cloud.google.com/solutions/talent-solution)
23
22
  for more usage information.
@@ -35,17 +34,39 @@ In order to use this library, you first need to go through the following steps:
35
34
  1. [Enable the API.](https://console.cloud.google.com/apis/library/jobs.googleapis.com)
36
35
  1. {file:AUTHENTICATION.md Set up authentication.}
37
36
 
38
- ## Migrating from pre-0.20 versions
39
-
40
- The 0.20 release of the google-cloud-talent client is a significant upgrade
41
- based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
42
- and includes substantial interface changes. Existing code written for earlier
43
- versions of this library will likely require updates to use this version.
44
- See the {file:MIGRATING.md MIGRATING.md} document for more information.
37
+ ## Debug Logging
38
+
39
+ This library comes with opt-in Debug Logging that can help you troubleshoot
40
+ your application's integration with the API. When logging is activated, key
41
+ events such as requests and responses, along with data payloads and metadata
42
+ such as headers and client configuration, are logged to the standard error
43
+ stream.
44
+
45
+ **WARNING:** Client Library Debug Logging includes your data payloads in
46
+ plaintext, which could include sensitive data such as PII for yourself or your
47
+ customers, private keys, or other security data that could be compromising if
48
+ leaked. Always practice good data hygiene with your application logs, and follow
49
+ the principle of least access. Google also recommends that Client Library Debug
50
+ Logging be enabled only temporarily during active debugging, and not used
51
+ permanently in production.
52
+
53
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
54
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
55
+ list of client library gem names. This will select the default logging behavior,
56
+ which writes logs to the standard error stream. On a local workstation, this may
57
+ result in logs appearing on the console. When running on a Google Cloud hosting
58
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
59
+ results in logs appearing alongside your application logs in the
60
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
61
+
62
+ Debug logging also requires that the versioned clients for this service be
63
+ sufficiently recent, released after about Dec 10, 2024. If logging is not
64
+ working, try updating the versioned clients in your bundle or installed gems:
65
+ [google-cloud-talent-v4](https://cloud.google.com/ruby/docs/reference/google-cloud-talent-v4/latest).
45
66
 
46
67
  ## Supported Ruby Versions
47
68
 
48
- This library is supported on Ruby 2.7+.
69
+ This library is supported on Ruby 3.0+.
49
70
 
50
71
  Google provides official support for Ruby versions that are actively supported
51
72
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -20,7 +20,7 @@
20
20
  module Google
21
21
  module Cloud
22
22
  module Talent
23
- VERSION = "1.5.1"
23
+ VERSION = "2.0.0"
24
24
  end
25
25
  end
26
26
  end
@@ -58,6 +58,11 @@ module Google
58
58
  # You can also specify a different transport by passing `:rest` or `:grpc` in
59
59
  # the `transport` parameter.
60
60
  #
61
+ # Raises an exception if the currently installed versioned client gem for the
62
+ # given API version does not support the given transport of the CompanyService service.
63
+ # You can determine whether the method will succeed by calling
64
+ # {Google::Cloud::Talent.company_service_available?}.
65
+ #
61
66
  # ## About CompanyService
62
67
  #
63
68
  # A service that handles company management, including CRUD and enumeration.
@@ -79,6 +84,37 @@ module Google
79
84
  service_module.const_get(:Client).new(&block)
80
85
  end
81
86
 
87
+ ##
88
+ # Determines whether the CompanyService service is supported by the current client.
89
+ # If true, you can retrieve a client object by calling {Google::Cloud::Talent.company_service}.
90
+ # If false, that method will raise an exception. This could happen if the given
91
+ # API version does not exist or does not support the CompanyService service,
92
+ # or if the versioned client gem needs an update to support the CompanyService service.
93
+ #
94
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
95
+ # Defaults to `:v4`.
96
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
97
+ # @return [boolean] Whether the service is available.
98
+ #
99
+ def self.company_service_available? version: :v4, transport: :grpc
100
+ require "google/cloud/talent/#{version.to_s.downcase}"
101
+ package_name = Google::Cloud::Talent
102
+ .constants
103
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
104
+ .first
105
+ return false unless package_name
106
+ service_module = Google::Cloud::Talent.const_get package_name
107
+ return false unless service_module.const_defined? :CompanyService
108
+ service_module = service_module.const_get :CompanyService
109
+ if transport == :rest
110
+ return false unless service_module.const_defined? :Rest
111
+ service_module = service_module.const_get :Rest
112
+ end
113
+ service_module.const_defined? :Client
114
+ rescue ::LoadError
115
+ false
116
+ end
117
+
82
118
  ##
83
119
  # Create a new client object for Completion.
84
120
  #
@@ -92,6 +128,11 @@ module Google
92
128
  # You can also specify a different transport by passing `:rest` or `:grpc` in
93
129
  # the `transport` parameter.
94
130
  #
131
+ # Raises an exception if the currently installed versioned client gem for the
132
+ # given API version does not support the given transport of the Completion service.
133
+ # You can determine whether the method will succeed by calling
134
+ # {Google::Cloud::Talent.completion_available?}.
135
+ #
95
136
  # ## About Completion
96
137
  #
97
138
  # A service handles auto completion.
@@ -113,6 +154,37 @@ module Google
113
154
  service_module.const_get(:Client).new(&block)
114
155
  end
115
156
 
157
+ ##
158
+ # Determines whether the Completion service is supported by the current client.
159
+ # If true, you can retrieve a client object by calling {Google::Cloud::Talent.completion}.
160
+ # If false, that method will raise an exception. This could happen if the given
161
+ # API version does not exist or does not support the Completion service,
162
+ # or if the versioned client gem needs an update to support the Completion service.
163
+ #
164
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
165
+ # Defaults to `:v4`.
166
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
167
+ # @return [boolean] Whether the service is available.
168
+ #
169
+ def self.completion_available? version: :v4, transport: :grpc
170
+ require "google/cloud/talent/#{version.to_s.downcase}"
171
+ package_name = Google::Cloud::Talent
172
+ .constants
173
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
174
+ .first
175
+ return false unless package_name
176
+ service_module = Google::Cloud::Talent.const_get package_name
177
+ return false unless service_module.const_defined? :Completion
178
+ service_module = service_module.const_get :Completion
179
+ if transport == :rest
180
+ return false unless service_module.const_defined? :Rest
181
+ service_module = service_module.const_get :Rest
182
+ end
183
+ service_module.const_defined? :Client
184
+ rescue ::LoadError
185
+ false
186
+ end
187
+
116
188
  ##
117
189
  # Create a new client object for EventService.
118
190
  #
@@ -126,6 +198,11 @@ module Google
126
198
  # You can also specify a different transport by passing `:rest` or `:grpc` in
127
199
  # the `transport` parameter.
128
200
  #
201
+ # Raises an exception if the currently installed versioned client gem for the
202
+ # given API version does not support the given transport of the EventService service.
203
+ # You can determine whether the method will succeed by calling
204
+ # {Google::Cloud::Talent.event_service_available?}.
205
+ #
129
206
  # ## About EventService
130
207
  #
131
208
  # A service handles client event report.
@@ -147,6 +224,37 @@ module Google
147
224
  service_module.const_get(:Client).new(&block)
148
225
  end
149
226
 
227
+ ##
228
+ # Determines whether the EventService service is supported by the current client.
229
+ # If true, you can retrieve a client object by calling {Google::Cloud::Talent.event_service}.
230
+ # If false, that method will raise an exception. This could happen if the given
231
+ # API version does not exist or does not support the EventService service,
232
+ # or if the versioned client gem needs an update to support the EventService service.
233
+ #
234
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
235
+ # Defaults to `:v4`.
236
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
237
+ # @return [boolean] Whether the service is available.
238
+ #
239
+ def self.event_service_available? version: :v4, transport: :grpc
240
+ require "google/cloud/talent/#{version.to_s.downcase}"
241
+ package_name = Google::Cloud::Talent
242
+ .constants
243
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
244
+ .first
245
+ return false unless package_name
246
+ service_module = Google::Cloud::Talent.const_get package_name
247
+ return false unless service_module.const_defined? :EventService
248
+ service_module = service_module.const_get :EventService
249
+ if transport == :rest
250
+ return false unless service_module.const_defined? :Rest
251
+ service_module = service_module.const_get :Rest
252
+ end
253
+ service_module.const_defined? :Client
254
+ rescue ::LoadError
255
+ false
256
+ end
257
+
150
258
  ##
151
259
  # Create a new client object for JobService.
152
260
  #
@@ -160,6 +268,11 @@ module Google
160
268
  # You can also specify a different transport by passing `:rest` or `:grpc` in
161
269
  # the `transport` parameter.
162
270
  #
271
+ # Raises an exception if the currently installed versioned client gem for the
272
+ # given API version does not support the given transport of the JobService service.
273
+ # You can determine whether the method will succeed by calling
274
+ # {Google::Cloud::Talent.job_service_available?}.
275
+ #
163
276
  # ## About JobService
164
277
  #
165
278
  # A service handles job management, including job CRUD, enumeration and search.
@@ -181,6 +294,37 @@ module Google
181
294
  service_module.const_get(:Client).new(&block)
182
295
  end
183
296
 
297
+ ##
298
+ # Determines whether the JobService service is supported by the current client.
299
+ # If true, you can retrieve a client object by calling {Google::Cloud::Talent.job_service}.
300
+ # If false, that method will raise an exception. This could happen if the given
301
+ # API version does not exist or does not support the JobService service,
302
+ # or if the versioned client gem needs an update to support the JobService service.
303
+ #
304
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
305
+ # Defaults to `:v4`.
306
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
307
+ # @return [boolean] Whether the service is available.
308
+ #
309
+ def self.job_service_available? version: :v4, transport: :grpc
310
+ require "google/cloud/talent/#{version.to_s.downcase}"
311
+ package_name = Google::Cloud::Talent
312
+ .constants
313
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
314
+ .first
315
+ return false unless package_name
316
+ service_module = Google::Cloud::Talent.const_get package_name
317
+ return false unless service_module.const_defined? :JobService
318
+ service_module = service_module.const_get :JobService
319
+ if transport == :rest
320
+ return false unless service_module.const_defined? :Rest
321
+ service_module = service_module.const_get :Rest
322
+ end
323
+ service_module.const_defined? :Client
324
+ rescue ::LoadError
325
+ false
326
+ end
327
+
184
328
  ##
185
329
  # Create a new client object for TenantService.
186
330
  #
@@ -194,6 +338,11 @@ module Google
194
338
  # You can also specify a different transport by passing `:rest` or `:grpc` in
195
339
  # the `transport` parameter.
196
340
  #
341
+ # Raises an exception if the currently installed versioned client gem for the
342
+ # given API version does not support the given transport of the TenantService service.
343
+ # You can determine whether the method will succeed by calling
344
+ # {Google::Cloud::Talent.tenant_service_available?}.
345
+ #
197
346
  # ## About TenantService
198
347
  #
199
348
  # A service that handles tenant management, including CRUD and enumeration.
@@ -215,6 +364,37 @@ module Google
215
364
  service_module.const_get(:Client).new(&block)
216
365
  end
217
366
 
367
+ ##
368
+ # Determines whether the TenantService service is supported by the current client.
369
+ # If true, you can retrieve a client object by calling {Google::Cloud::Talent.tenant_service}.
370
+ # If false, that method will raise an exception. This could happen if the given
371
+ # API version does not exist or does not support the TenantService service,
372
+ # or if the versioned client gem needs an update to support the TenantService service.
373
+ #
374
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
375
+ # Defaults to `:v4`.
376
+ # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
377
+ # @return [boolean] Whether the service is available.
378
+ #
379
+ def self.tenant_service_available? version: :v4, transport: :grpc
380
+ require "google/cloud/talent/#{version.to_s.downcase}"
381
+ package_name = Google::Cloud::Talent
382
+ .constants
383
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
384
+ .first
385
+ return false unless package_name
386
+ service_module = Google::Cloud::Talent.const_get package_name
387
+ return false unless service_module.const_defined? :TenantService
388
+ service_module = service_module.const_get :TenantService
389
+ if transport == :rest
390
+ return false unless service_module.const_defined? :Rest
391
+ service_module = service_module.const_get :Rest
392
+ end
393
+ service_module.const_defined? :Client
394
+ rescue ::LoadError
395
+ false
396
+ end
397
+
218
398
  ##
219
399
  # Configure the google-cloud-talent library.
220
400
  #
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-talent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-08 00:00:00.000000000 Z
10
+ date: 2025-02-13 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: google-cloud-core
@@ -28,42 +27,16 @@ dependencies:
28
27
  name: google-cloud-talent-v4
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0.12'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: 2.a
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '0.12'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: 2.a
47
- - !ruby/object:Gem::Dependency
48
- name: google-cloud-talent-v4beta1
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0.10'
54
- - - "<"
30
+ - - "~>"
55
31
  - !ruby/object:Gem::Version
56
- version: 2.a
32
+ version: '1.3'
57
33
  type: :runtime
58
34
  prerelease: false
59
35
  version_requirements: !ruby/object:Gem::Requirement
60
36
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '0.10'
64
- - - "<"
37
+ - - "~>"
65
38
  - !ruby/object:Gem::Version
66
- version: 2.a
39
+ version: '1.3'
67
40
  description: Transform your job search and candidate matching capabilities with Cloud
68
41
  Talent Solution, designed to support enterprise talent acquisition technology and
69
42
  evolve with your growing needs. This AI solution includes features such as Job Search
@@ -77,7 +50,6 @@ files:
77
50
  - ".yardopts"
78
51
  - AUTHENTICATION.md
79
52
  - LICENSE.md
80
- - MIGRATING.md
81
53
  - README.md
82
54
  - lib/google-cloud-talent.rb
83
55
  - lib/google/cloud/talent.rb
@@ -86,7 +58,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
86
58
  licenses:
87
59
  - Apache-2.0
88
60
  metadata: {}
89
- post_install_message:
90
61
  rdoc_options: []
91
62
  require_paths:
92
63
  - lib
@@ -94,15 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
65
  requirements:
95
66
  - - ">="
96
67
  - !ruby/object:Gem::Version
97
- version: '2.7'
68
+ version: '3.0'
98
69
  required_rubygems_version: !ruby/object:Gem::Requirement
99
70
  requirements:
100
71
  - - ">="
101
72
  - !ruby/object:Gem::Version
102
73
  version: '0'
103
74
  requirements: []
104
- rubygems_version: 3.5.6
105
- signing_key:
75
+ rubygems_version: 3.6.3
106
76
  specification_version: 4
107
77
  summary: API Client library for the Cloud Talent Solution API
108
78
  test_files: []
data/MIGRATING.md DELETED
@@ -1,347 +0,0 @@
1
- ## Migrating to google-cloud-talent 0.20
2
-
3
- The 0.20 release of the google-cloud-talent client is a significant upgrade
4
- based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
5
- and includes substantial interface changes. Existing code written for earlier
6
- versions of this library will likely require updates to use this version.
7
- This document describes the changes that have been made, and what you need to
8
- do to update your usage.
9
-
10
- To summarize:
11
-
12
- * The library has been broken out into two libraries. The new gem
13
- `google-cloud-talent-v4beta1` contains the actual client classes for version
14
- V4beta1 of the Talent service, and the gem `google-cloud-talent` now
15
- simply provides a convenience wrapper. See
16
- [Library Structure](#library-structure) for more info.
17
- * The library uses a new configuration mechanism giving you closer control
18
- over endpoint address, network timeouts, and retry. See
19
- [Client Configuration](#client-configuration) for more info. Furthermore,
20
- when creating a client object, you can customize its configuration in a
21
- block rather than passing arguments to the constructor. See
22
- [Creating Clients](#creating-clients) for more info.
23
- * Previously, positional arguments were used to indicate required arguments.
24
- Now, all method arguments are keyword arguments, with documentation that
25
- specifies whether they are required or optional. Additionally, you can pass
26
- a proto request object instead of separate arguments. See
27
- [Passing Arguments](#passing-arguments) for more info.
28
- * Previously, some client classes included class methods for constructing
29
- resource paths. These paths are now instance methods on the client objects,
30
- and are also available in a separate paths module. See
31
- [Resource Path Helpers](#resource-path-helpers) for more info.
32
- * Previously, clients reported RPC errors by raising instances of
33
- `Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
34
- `Google::Cloud::Error` and its subclasses. See
35
- [Handling Errors](#handling-errors) for more info.
36
- * Some classes have moved into different namespaces. See
37
- [Class Namespaces](#class-namespaces) for more info.
38
-
39
- ### Library Structure
40
-
41
- Older pre-0.20 releases of the `google-cloud-talent` gem were all-in-one gems
42
- that included potentially multiple clients for multiple versions of the
43
- Talent service. Factory methods such as `Google::Cloud::Talent::ApplicationService.new`
44
- would return you instances of client classes such as
45
- `Google::Cloud::Talent::V4beta1::ApplicationServiceClient`. These classes were all defined
46
- in the same gem.
47
-
48
- With the 0.20 release, the `google-cloud-talent` gem still provides factory
49
- methods for obtaining clients. (The method signatures will have changed. See
50
- [Creating Clients](#creating-clients) for details.) However, the actual client
51
- classes have been moved into separate gems, one per service version. Currently,
52
- Talent has one version, V4beta1. The
53
- `Google::Cloud::Talent::V4beta1::ApplicationService::Client` class, along with its
54
- helpers and data types, is now part of the `google-cloud-talent-v4beta1` gem.
55
-
56
- For normal usage, you can continue to install the `google-cloud-talent` gem
57
- (which will bring in the versioned client gems as dependencies) and continue to
58
- use factory methods to create clients. However, you may alternatively choose to
59
- install only one of the versioned gems. For example, if you know you will only
60
- use `V4beta1` of the service, you can install `google-cloud-talent-v4beta1` by
61
- itself, and construct instances of the
62
- `Google::Cloud::Talent::V4beta1::ApplicationService::Client` client class directly.
63
-
64
- ### Client Configuration
65
-
66
- In older releases, if you wanted to customize performance parameters or
67
- low-level behavior of the client (such as credentials, timeouts, or
68
- instrumentation), you would pass a variety of keyword arguments to the client
69
- constructor. It was also extremely difficult to customize the default settings.
70
-
71
- With the 0.20 release, a configuration interface provides control over these
72
- parameters, including defaults for all instances of a client, and settings for
73
- each specific client instance. For example, to set default credentials and
74
- timeout for all Talent V4beta1 application service clients:
75
-
76
- ```
77
- Google::Cloud::Talent::V4beta1::ApplicationService::Client.configure do |config|
78
- config.credentials = "/path/to/credentials.json"
79
- config.timeout = 10.0
80
- end
81
- ```
82
-
83
- Individual RPCs can also be configured independently. For example, to set the
84
- timeout for the `list_applications` call:
85
-
86
- ```
87
- Google::Cloud::Talent::V4beta1::ApplicationService::Client.configure do |config|
88
- config.rpcs.list_applications.timeout = 20.0
89
- end
90
- ```
91
-
92
- Defaults for certain configurations can be set for all Talent versions and
93
- services globally:
94
-
95
- ```
96
- Google::Cloud::Talent.configure do |config|
97
- config.credentials = "/path/to/credentials.json"
98
- config.timeout = 10.0
99
- end
100
- ```
101
-
102
- Finally, you can override the configuration for each client instance. See the
103
- next section on [Creating Clients](#creating-clients) for details.
104
-
105
- ### Creating Clients
106
-
107
- In older releases, to create a client object, you would use the `new` method
108
- of modules under `Google::Cloud::Talent`. For example, you might call
109
- `Google::Cloud::Talent::ApplicationService.new`. Keyword arguments were available to
110
- select a service version and to configure parameters such as credentials and
111
- timeouts.
112
-
113
- With the 0.20 release, use named class methods of `Google::Cloud::Talent` to
114
- create a client object. For example, `Google::Cloud::Talent.application_service`.
115
- You may select a service version using the `:version` keyword argument.
116
- However, other configuration parameters should be set in a configuration block
117
- when you create the client.
118
-
119
- Old:
120
- ```
121
- client = Google::Cloud::Talent::ApplicationService.new credentials: "/path/to/credentials.json"
122
- ```
123
-
124
- New:
125
- ```
126
- client = Google::Cloud::Talent.application_service do |config|
127
- config.credentials = "/path/to/credentials.json"
128
- end
129
- ```
130
-
131
- The configuration block is optional. If you do not provide it, or you do not
132
- set some configuration parameters, then the default configuration is used. See
133
- [Client Configuration](#client-configuration).
134
-
135
- ### Passing Arguments
136
-
137
- In older releases, required arguments would be passed as positional method
138
- arguments, while most optional arguments would be passed as keyword arguments.
139
-
140
- With the 0.20 release, all RPC arguments are passed as keyword arguments,
141
- regardless of whether they are required or optional. For example:
142
-
143
- Old:
144
- ```
145
- client = Google::Cloud::Talent::ApplicationService.new
146
-
147
- parent = "projects/my-project/tenants/my-tenant/profiles/my-profile"
148
-
149
- # Parent is a positional argument, but page_size is a keyword argument
150
- response = client.list_applications parent, page_size: 10
151
- ```
152
-
153
- New:
154
- ```
155
- client = Google::Cloud::Talent.application_service
156
-
157
- parent = "projects/my-project/tenants/my-tenant/profiles/my-profile"
158
-
159
- # Parent and page_size are both keyword arguments
160
- response = client.list_applications parent: parent, page_size: 10
161
- ```
162
-
163
- In the 0.20 release, it is also possible to pass a request object, either
164
- as a hash or as a protocol buffer.
165
-
166
- New:
167
- ```
168
- client = Google::Cloud::Talent.application_service
169
-
170
- request = Google::Cloud::Talent::V1beta4::ListApplicationsRequest.new(
171
- parent: "projects/my-project/tenants/my-tenant/profiles/my-profile",
172
- page_size: 10
173
- )
174
-
175
- # Pass a request object as a positional argument:
176
- response = client.list_applications request
177
- ```
178
-
179
- Finally, in older releases, to provide call options, you would pass a
180
- `Google::Gax::CallOptions` object with the `:options` keyword argument. In the
181
- 0.20 release, pass call options using a _second set_ of keyword arguments.
182
-
183
- Old:
184
- ```
185
- client = Google::Cloud::Talent::ApplicationService.new
186
-
187
- parent = "projects/my-project/tenants/my-tenant/profiles/my-profile"
188
-
189
- options = Google::Gax::CallOptions.new timeout: 10.0
190
-
191
- response = client.list_applications parent, page_size: 10, options: options
192
- ```
193
-
194
- New:
195
- ```
196
- client = Google::Cloud::Talent.application_service
197
-
198
- parent = "projects/my-project/tenants/my-tenant/profiles/my-profile"
199
-
200
- # Use a hash to wrap the normal call arguments (or pass a request object), and
201
- # then add further keyword arguments for the call options.
202
- response = client.list_applications(
203
- { parent: parent, page_size: 10 },
204
- timeout: 10.0
205
- )
206
- ```
207
-
208
- ### Resource Path Helpers
209
-
210
- The client library includes helper methods for generating the resource path
211
- strings passed to many calls. These helpers have changed in two ways:
212
-
213
- * In older releases, they are _class_ methods on the client class. In the 0.20
214
- release, they are _instance_ methods on the client. They are also available
215
- on a separate paths module that you can include elsewhere for convenience.
216
- * In older releases, arguments to a resource path helper are passed as
217
- _positional_ arguments. In the 0.20 release, they are passed as named _keyword_
218
- arguments. Some helpers also support different sets of arguments, each set
219
- corresponding to a different type of path.
220
-
221
- Following is an example involving using a resource path helper.
222
-
223
- Old:
224
- ```
225
- client = Google::Cloud::Talent::ApplicationService.new
226
-
227
- # Call the helper on the client class
228
- parent = Google::Cloud::Talent::V1beta4::ApplicationServiceClient.profile_path(
229
- "my-project", "my-tenant", "my-profile"
230
- )
231
-
232
- response = client.list_applications parent, page_size: 10
233
- ```
234
-
235
- New:
236
- ```
237
- client = Google::Cloud::Talent.application_service
238
-
239
- # Call the helper on the client instance, and use keyword arguments
240
- parent = client.profile_path project: "my-project", tenant: "my-tenant",
241
- profile: "my-profile"
242
-
243
- response = client.list_applications parent: parent, page_size: 10
244
- ```
245
-
246
- Because arguments are passed as keyword arguments, some closely related paths
247
- have been combined. For example, `job_path` and `job_without_tenant_path` used
248
- to be separate helpers, one that took a tenant argument and one that did not.
249
- In the 0.20 client, use `job_path` for both, and either pass or omit the
250
- `tenant` keyword argument.
251
-
252
- Old:
253
- ```
254
- job1 = Google::Cloud::Talent::V1beta4::ApplicationServiceClient.job_path(
255
- "my-project", "my-tenant", "my-job"
256
- )
257
- job2 = Google::Cloud::Talent::V1beta4::ApplicationServiceClient.job_without_tenant_path(
258
- "my-project", "my-job"
259
- )
260
- ```
261
-
262
- New:
263
- ```
264
- client = Google::Cloud::Talent.application_service
265
- job1 = client.job_path project: "my-project", tenant: "my-tenant", job: "my-job"
266
- job2 = client.job_path project: "my-project", job: "my-job"
267
- ```
268
-
269
- Finally, in the 0.20 client, you can also use the paths module as a convenience module.
270
-
271
- New:
272
- ```
273
- # Bring the path helper methods into the current class
274
- include Google::Cloud::Talent::V1beta4::ApplicationService::Paths
275
-
276
- def foo
277
- client = Google::Cloud::Talent.application_service
278
-
279
- # Call the included helper method
280
- parent = profile_path project: "my-project", tenant: "my-tenant",
281
- profile: "my-profile"
282
-
283
- response = client.list_applications parent: parent, page_size: 10
284
-
285
- # Do something with response...
286
- end
287
- ```
288
-
289
- ### Handling Errors
290
-
291
- The client reports standard
292
- [gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
293
- by raising exceptions. In older releases, these exceptions were located in the
294
- `Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
295
- exception class, defined in the `google-gax` gem. However, these classes were
296
- different from the standard exceptions (subclasses of `Google::Cloud::Error`)
297
- thrown by other client libraries such as `google-cloud-storage`.
298
-
299
- The 0.20 client library now uses the `Google::Cloud::Error` exception hierarchy,
300
- for consistency across all the Google Cloud client libraries. In general, these
301
- exceptions have the same name as their counterparts from older releases, but
302
- are located in the `Google::Cloud` namespace rather than the `Google::Gax`
303
- namespace.
304
-
305
- Old:
306
- ```
307
- client = Google::Cloud::Talent::ApplicationService.new
308
-
309
- parent = "projects/my-project/tenants/my-tenant/profiles/my-profile"
310
-
311
- begin
312
- response = client.list_applications parent, page_size: 10
313
- rescue Google::Gax::Error => e
314
- # Handle exceptions that subclass Google::Gax::Error
315
- end
316
- ```
317
-
318
- New:
319
- ```
320
- client = Google::Cloud::Talent.application_service
321
-
322
- parent = "projects/my-project/tenants/my-tenant/profiles/my-profile"
323
-
324
- begin
325
- response = client.list_applications parent: parent, page_size: 10
326
- rescue Google::Cloud::Error => e
327
- # Handle exceptions that subclass Google::Cloud::Error
328
- end
329
- ```
330
-
331
- ### Class Namespaces
332
-
333
- In older releases, the client object was of classes with names like:
334
- `Google::Cloud::Talent::V1beta4::ApplicationServiceClient`.
335
- In the 0.20 release, the client object is of a different class:
336
- `Google::Cloud::Talent::V1beta4::ApplicationService::Client`.
337
- Note that most users will use the factory methods such as
338
- `Google::Cloud::Talent.application_service` to create instances of the client object,
339
- so you may not need to reference the actual class directly.
340
- See [Creating Clients](#creating-clients).
341
-
342
- In older releases, the credentials object was of class
343
- `Google::Cloud::Talent::V1beta4::Credentials`.
344
- In the 0.20 release, each service has its own credentials class, e.g.
345
- `Google::Cloud::Talent::V1beta4::ApplicationService::Credentials`.
346
- Again, most users will not need to reference this class directly.
347
- See [Client Configuration](#client-configuration).