google-cloud-language-v1beta2 0.1.4 → 0.2.3

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: a848d58616ce066da01b52b73d9c0e7f37247bf09f263d307b1d3f614bd496e4
4
- data.tar.gz: 752d80c52b6d62f0610cf0c6426fa6a276ee14525a30aef35eb6ffe524dcbcbb
3
+ metadata.gz: 0a9c2bfd759d4ac38a7b382379b5140ae4d757b35ce5f7d3d75bbb1d9eb48af2
4
+ data.tar.gz: e58f07419dfa72e33c4feda9eacda72b60da2aa9f71215c4894ec36ab18a7385
5
5
  SHA512:
6
- metadata.gz: 244ea95e05934f7c2e322d4ef1c3b4f6c58325b849915f0dbf1fa153da94fac01e1b5b8d768baea9a14a797076831327656fe557722d422ccce051c9104f6d5c
7
- data.tar.gz: 5dc79decc6e60beff2478da0fca241f6f6140e65f992847b9b76db9b7376c074280622ea997d2df9ed24de2e36a58a9e9259f21a8d8fd17b9ac4d8b158a59f89
6
+ metadata.gz: e53f670d27953ec98d9c2ac3e95fa77709003f309c3d2db824900ab0d1462803c7f55afedf07388b8c6776b3ed04a0289d5dee1ae72ae79e33bab902ac5f6c63
7
+ data.tar.gz: fdfa65b4043ab0b34980a13073c8ee2fd2a219428759c7509b4c64650beb84f917a1aaaac753ded061767f868fb97525fb87b60a79b849158b1e9bcc582fab21
@@ -27,7 +27,7 @@ export LANGUAGE_CREDENTIALS=path/to/keyfile.json
27
27
  ```ruby
28
28
  require "google/cloud/language/v1beta2"
29
29
 
30
- client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
30
+ client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
31
31
  ```
32
32
 
33
33
  ## Credential Lookup
@@ -64,7 +64,7 @@ containers where writing files is difficult or not encouraged.
64
64
 
65
65
  The environment variables that google-cloud-language-v1beta2
66
66
  checks for credentials are configured on the service Credentials class (such as
67
- {Google::Cloud::Language::V1beta2::LanguageService::Credentials}):
67
+ {::Google::Cloud::Language::V1beta2::LanguageService::Credentials}):
68
68
 
69
69
  1. `LANGUAGE_CREDENTIALS` - Path to JSON file, or JSON contents
70
70
  2. `LANGUAGE_KEYFILE` - Path to JSON file, or JSON contents
@@ -77,7 +77,7 @@ require "google/cloud/language/v1beta2"
77
77
 
78
78
  ENV["LANGUAGE_CREDENTIALS"] = "path/to/keyfile.json"
79
79
 
80
- client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
80
+ client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
81
81
  ```
82
82
 
83
83
  ### Configuration
@@ -88,7 +88,7 @@ environment variables. Either on an individual client initialization:
88
88
  ```ruby
89
89
  require "google/cloud/language/v1beta2"
90
90
 
91
- client = Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
91
+ client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
92
92
  config.credentials = "path/to/keyfile.json"
93
93
  end
94
94
  ```
@@ -98,11 +98,11 @@ Or configured globally for all clients:
98
98
  ```ruby
99
99
  require "google/cloud/language/v1beta2"
100
100
 
101
- Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
101
+ ::Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
102
102
  config.credentials = "path/to/keyfile.json"
103
103
  end
104
104
 
105
- client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
105
+ client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
106
106
  ```
107
107
 
108
108
  ### Cloud SDK
data/README.md CHANGED
@@ -18,6 +18,7 @@ In order to use this library, you first need to go through the following steps:
18
18
 
19
19
  1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
20
20
  1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
21
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
21
22
  1. {file:AUTHENTICATION.md Set up authentication.}
22
23
 
23
24
  ## Quick Start
@@ -25,7 +26,7 @@ In order to use this library, you first need to go through the following steps:
25
26
  ```ruby
26
27
  require "google/cloud/language/v1beta2"
27
28
 
28
- client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
29
+ client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
29
30
  request = my_create_request
30
31
  response = client.analyze_sentiment request
31
32
  ```
@@ -33,6 +34,9 @@ response = client.analyze_sentiment request
33
34
  View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-language-v1beta2/latest)
34
35
  for class and method documentation.
35
36
 
37
+ See also the [Product Documentation](https://cloud.google.com/natural-language)
38
+ for general usage information.
39
+
36
40
  ## Enabling Logging
37
41
 
38
42
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
@@ -26,7 +26,7 @@ module Google
26
26
  # To load this package, including all its services, and instantiate a client:
27
27
  #
28
28
  # require "google/cloud/language/v1beta2"
29
- # client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
29
+ # client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
30
30
  #
31
31
  module V1beta2
32
32
  end
@@ -36,7 +36,7 @@ module Google
36
36
  # To load this service and instantiate a client:
37
37
  #
38
38
  # require "google/cloud/language/v1beta2/language_service"
39
- # client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
39
+ # client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
40
40
  #
41
41
  module LanguageService
42
42
  end
@@ -37,15 +37,15 @@ module Google
37
37
  ##
38
38
  # Configure the LanguageService Client class.
39
39
  #
40
- # See {Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration}
40
+ # See {::Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration}
41
41
  # for a description of the configuration fields.
42
42
  #
43
43
  # ## Example
44
44
  #
45
45
  # To modify the configuration for all LanguageService clients:
46
46
  #
47
- # Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
48
- # config.timeout = 10_000
47
+ # ::Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
49
  # end
50
50
  #
51
51
  # @yield [config] Configure the Client client.
@@ -125,7 +125,7 @@ module Google
125
125
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
126
126
  # should be made on {Client.configure}.
127
127
  #
128
- # See {Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration}
128
+ # See {::Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration}
129
129
  # for a description of the configuration fields.
130
130
  #
131
131
  # @yield [config] Configure the Client client.
@@ -146,13 +146,13 @@ module Google
146
146
  # To create a new LanguageService client with the default
147
147
  # configuration:
148
148
  #
149
- # client = Google::Cloud::Language::V1beta2::LanguageService::Client.new
149
+ # client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
150
150
  #
151
151
  # To create a new LanguageService client with a custom
152
152
  # configuration:
153
153
  #
154
- # client = Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
155
- # config.timeout = 10_000
154
+ # client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
155
+ # config.timeout = 10.0
156
156
  # end
157
157
  #
158
158
  # @yield [config] Configure the LanguageService client.
@@ -177,10 +177,11 @@ module Google
177
177
  if credentials.is_a?(String) || credentials.is_a?(Hash)
178
178
  credentials = Credentials.new credentials, scope: @config.scope
179
179
  end
180
- @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
180
+ @quota_project_id = @config.quota_project
181
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
181
182
 
182
- @language_service_stub = Gapic::ServiceStub.new(
183
- Google::Cloud::Language::V1beta2::LanguageService::Stub,
183
+ @language_service_stub = ::Gapic::ServiceStub.new(
184
+ ::Google::Cloud::Language::V1beta2::LanguageService::Stub,
184
185
  credentials: credentials,
185
186
  endpoint: @config.endpoint,
186
187
  channel_args: @config.channel_args,
@@ -195,12 +196,12 @@ module Google
195
196
  #
196
197
  # @overload analyze_sentiment(request, options = nil)
197
198
  # Pass arguments to `analyze_sentiment` via a request object, either of type
198
- # {Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest} or an equivalent Hash.
199
+ # {::Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest} or an equivalent Hash.
199
200
  #
200
- # @param request [Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest, Hash]
201
+ # @param request [::Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest, ::Hash]
201
202
  # A request object representing the call parameters. Required. To specify no
202
203
  # parameters, or to keep all the default parameter values, pass an empty Hash.
203
- # @param options [Gapic::CallOptions, Hash]
204
+ # @param options [::Gapic::CallOptions, ::Hash]
204
205
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
205
206
  #
206
207
  # @overload analyze_sentiment(document: nil, encoding_type: nil)
@@ -208,33 +209,33 @@ module Google
208
209
  # least one keyword argument is required. To specify no parameters, or to keep all
209
210
  # the default parameter values, pass an empty Hash as a request object (see above).
210
211
  #
211
- # @param document [Google::Cloud::Language::V1beta2::Document, Hash]
212
+ # @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
212
213
  # Required. Input document.
213
- # @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
214
+ # @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
214
215
  # The encoding type used by the API to calculate sentence offsets for the
215
216
  # sentence sentiment.
216
217
  #
217
218
  # @yield [response, operation] Access the result along with the RPC operation
218
- # @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
219
- # @yieldparam operation [GRPC::ActiveCall::Operation]
219
+ # @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
220
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
220
221
  #
221
- # @return [Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
222
+ # @return [::Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
222
223
  #
223
- # @raise [Google::Cloud::Error] if the RPC is aborted.
224
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
224
225
  #
225
226
  def analyze_sentiment request, options = nil
226
- raise ArgumentError, "request must be provided" if request.nil?
227
+ raise ::ArgumentError, "request must be provided" if request.nil?
227
228
 
228
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest
229
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest
229
230
 
230
231
  # Converts hash and nil to an options object
231
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
232
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
232
233
 
233
234
  # Customize the options with defaults
234
235
  metadata = @config.rpcs.analyze_sentiment.metadata.to_h
235
236
 
236
237
  # Set x-goog-api-client and x-goog-user-project headers
237
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
238
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
238
239
  lib_name: @config.lib_name, lib_version: @config.lib_version,
239
240
  gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
240
241
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -249,8 +250,8 @@ module Google
249
250
  yield response, operation if block_given?
250
251
  return response
251
252
  end
252
- rescue GRPC::BadStatus => e
253
- raise Google::Cloud::Error.from_error(e)
253
+ rescue ::GRPC::BadStatus => e
254
+ raise ::Google::Cloud::Error.from_error(e)
254
255
  end
255
256
 
256
257
  ##
@@ -260,12 +261,12 @@ module Google
260
261
  #
261
262
  # @overload analyze_entities(request, options = nil)
262
263
  # Pass arguments to `analyze_entities` via a request object, either of type
263
- # {Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest} or an equivalent Hash.
264
+ # {::Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest} or an equivalent Hash.
264
265
  #
265
- # @param request [Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest, Hash]
266
+ # @param request [::Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest, ::Hash]
266
267
  # A request object representing the call parameters. Required. To specify no
267
268
  # parameters, or to keep all the default parameter values, pass an empty Hash.
268
- # @param options [Gapic::CallOptions, Hash]
269
+ # @param options [::Gapic::CallOptions, ::Hash]
269
270
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
270
271
  #
271
272
  # @overload analyze_entities(document: nil, encoding_type: nil)
@@ -273,32 +274,32 @@ module Google
273
274
  # least one keyword argument is required. To specify no parameters, or to keep all
274
275
  # the default parameter values, pass an empty Hash as a request object (see above).
275
276
  #
276
- # @param document [Google::Cloud::Language::V1beta2::Document, Hash]
277
+ # @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
277
278
  # Required. Input document.
278
- # @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
279
+ # @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
279
280
  # The encoding type used by the API to calculate offsets.
280
281
  #
281
282
  # @yield [response, operation] Access the result along with the RPC operation
282
- # @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
283
- # @yieldparam operation [GRPC::ActiveCall::Operation]
283
+ # @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
284
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
284
285
  #
285
- # @return [Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
286
+ # @return [::Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
286
287
  #
287
- # @raise [Google::Cloud::Error] if the RPC is aborted.
288
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
288
289
  #
289
290
  def analyze_entities request, options = nil
290
- raise ArgumentError, "request must be provided" if request.nil?
291
+ raise ::ArgumentError, "request must be provided" if request.nil?
291
292
 
292
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest
293
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest
293
294
 
294
295
  # Converts hash and nil to an options object
295
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
296
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
296
297
 
297
298
  # Customize the options with defaults
298
299
  metadata = @config.rpcs.analyze_entities.metadata.to_h
299
300
 
300
301
  # Set x-goog-api-client and x-goog-user-project headers
301
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
302
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
302
303
  lib_name: @config.lib_name, lib_version: @config.lib_version,
303
304
  gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
304
305
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -313,22 +314,22 @@ module Google
313
314
  yield response, operation if block_given?
314
315
  return response
315
316
  end
316
- rescue GRPC::BadStatus => e
317
- raise Google::Cloud::Error.from_error(e)
317
+ rescue ::GRPC::BadStatus => e
318
+ raise ::Google::Cloud::Error.from_error(e)
318
319
  end
319
320
 
320
321
  ##
321
- # Finds entities, similar to {Google::Cloud::Language::V1beta2::LanguageService::Client#analyze_entities AnalyzeEntities} in the text and analyzes
322
+ # Finds entities, similar to {::Google::Cloud::Language::V1beta2::LanguageService::Client#analyze_entities AnalyzeEntities} in the text and analyzes
322
323
  # sentiment associated with each entity and its mentions.
323
324
  #
324
325
  # @overload analyze_entity_sentiment(request, options = nil)
325
326
  # Pass arguments to `analyze_entity_sentiment` via a request object, either of type
326
- # {Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest} or an equivalent Hash.
327
+ # {::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest} or an equivalent Hash.
327
328
  #
328
- # @param request [Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest, Hash]
329
+ # @param request [::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest, ::Hash]
329
330
  # A request object representing the call parameters. Required. To specify no
330
331
  # parameters, or to keep all the default parameter values, pass an empty Hash.
331
- # @param options [Gapic::CallOptions, Hash]
332
+ # @param options [::Gapic::CallOptions, ::Hash]
332
333
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
333
334
  #
334
335
  # @overload analyze_entity_sentiment(document: nil, encoding_type: nil)
@@ -336,32 +337,32 @@ module Google
336
337
  # least one keyword argument is required. To specify no parameters, or to keep all
337
338
  # the default parameter values, pass an empty Hash as a request object (see above).
338
339
  #
339
- # @param document [Google::Cloud::Language::V1beta2::Document, Hash]
340
+ # @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
340
341
  # Required. Input document.
341
- # @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
342
+ # @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
342
343
  # The encoding type used by the API to calculate offsets.
343
344
  #
344
345
  # @yield [response, operation] Access the result along with the RPC operation
345
- # @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
346
- # @yieldparam operation [GRPC::ActiveCall::Operation]
346
+ # @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
347
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
347
348
  #
348
- # @return [Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
349
+ # @return [::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
349
350
  #
350
- # @raise [Google::Cloud::Error] if the RPC is aborted.
351
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
351
352
  #
352
353
  def analyze_entity_sentiment request, options = nil
353
- raise ArgumentError, "request must be provided" if request.nil?
354
+ raise ::ArgumentError, "request must be provided" if request.nil?
354
355
 
355
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest
356
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest
356
357
 
357
358
  # Converts hash and nil to an options object
358
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
359
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
359
360
 
360
361
  # Customize the options with defaults
361
362
  metadata = @config.rpcs.analyze_entity_sentiment.metadata.to_h
362
363
 
363
364
  # Set x-goog-api-client and x-goog-user-project headers
364
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
365
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
365
366
  lib_name: @config.lib_name, lib_version: @config.lib_version,
366
367
  gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
367
368
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -376,8 +377,8 @@ module Google
376
377
  yield response, operation if block_given?
377
378
  return response
378
379
  end
379
- rescue GRPC::BadStatus => e
380
- raise Google::Cloud::Error.from_error(e)
380
+ rescue ::GRPC::BadStatus => e
381
+ raise ::Google::Cloud::Error.from_error(e)
381
382
  end
382
383
 
383
384
  ##
@@ -387,12 +388,12 @@ module Google
387
388
  #
388
389
  # @overload analyze_syntax(request, options = nil)
389
390
  # Pass arguments to `analyze_syntax` via a request object, either of type
390
- # {Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest} or an equivalent Hash.
391
+ # {::Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest} or an equivalent Hash.
391
392
  #
392
- # @param request [Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest, Hash]
393
+ # @param request [::Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest, ::Hash]
393
394
  # A request object representing the call parameters. Required. To specify no
394
395
  # parameters, or to keep all the default parameter values, pass an empty Hash.
395
- # @param options [Gapic::CallOptions, Hash]
396
+ # @param options [::Gapic::CallOptions, ::Hash]
396
397
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
397
398
  #
398
399
  # @overload analyze_syntax(document: nil, encoding_type: nil)
@@ -400,32 +401,32 @@ module Google
400
401
  # least one keyword argument is required. To specify no parameters, or to keep all
401
402
  # the default parameter values, pass an empty Hash as a request object (see above).
402
403
  #
403
- # @param document [Google::Cloud::Language::V1beta2::Document, Hash]
404
+ # @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
404
405
  # Required. Input document.
405
- # @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
406
+ # @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
406
407
  # The encoding type used by the API to calculate offsets.
407
408
  #
408
409
  # @yield [response, operation] Access the result along with the RPC operation
409
- # @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
410
- # @yieldparam operation [GRPC::ActiveCall::Operation]
410
+ # @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
411
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
411
412
  #
412
- # @return [Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
413
+ # @return [::Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
413
414
  #
414
- # @raise [Google::Cloud::Error] if the RPC is aborted.
415
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
415
416
  #
416
417
  def analyze_syntax request, options = nil
417
- raise ArgumentError, "request must be provided" if request.nil?
418
+ raise ::ArgumentError, "request must be provided" if request.nil?
418
419
 
419
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest
420
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest
420
421
 
421
422
  # Converts hash and nil to an options object
422
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
423
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
423
424
 
424
425
  # Customize the options with defaults
425
426
  metadata = @config.rpcs.analyze_syntax.metadata.to_h
426
427
 
427
428
  # Set x-goog-api-client and x-goog-user-project headers
428
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
429
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
429
430
  lib_name: @config.lib_name, lib_version: @config.lib_version,
430
431
  gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
431
432
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -440,8 +441,8 @@ module Google
440
441
  yield response, operation if block_given?
441
442
  return response
442
443
  end
443
- rescue GRPC::BadStatus => e
444
- raise Google::Cloud::Error.from_error(e)
444
+ rescue ::GRPC::BadStatus => e
445
+ raise ::Google::Cloud::Error.from_error(e)
445
446
  end
446
447
 
447
448
  ##
@@ -449,12 +450,12 @@ module Google
449
450
  #
450
451
  # @overload classify_text(request, options = nil)
451
452
  # Pass arguments to `classify_text` via a request object, either of type
452
- # {Google::Cloud::Language::V1beta2::ClassifyTextRequest} or an equivalent Hash.
453
+ # {::Google::Cloud::Language::V1beta2::ClassifyTextRequest} or an equivalent Hash.
453
454
  #
454
- # @param request [Google::Cloud::Language::V1beta2::ClassifyTextRequest, Hash]
455
+ # @param request [::Google::Cloud::Language::V1beta2::ClassifyTextRequest, ::Hash]
455
456
  # A request object representing the call parameters. Required. To specify no
456
457
  # parameters, or to keep all the default parameter values, pass an empty Hash.
457
- # @param options [Gapic::CallOptions, Hash]
458
+ # @param options [::Gapic::CallOptions, ::Hash]
458
459
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
459
460
  #
460
461
  # @overload classify_text(document: nil)
@@ -462,30 +463,30 @@ module Google
462
463
  # least one keyword argument is required. To specify no parameters, or to keep all
463
464
  # the default parameter values, pass an empty Hash as a request object (see above).
464
465
  #
465
- # @param document [Google::Cloud::Language::V1beta2::Document, Hash]
466
+ # @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
466
467
  # Required. Input document.
467
468
  #
468
469
  # @yield [response, operation] Access the result along with the RPC operation
469
- # @yieldparam response [Google::Cloud::Language::V1beta2::ClassifyTextResponse]
470
- # @yieldparam operation [GRPC::ActiveCall::Operation]
470
+ # @yieldparam response [::Google::Cloud::Language::V1beta2::ClassifyTextResponse]
471
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
471
472
  #
472
- # @return [Google::Cloud::Language::V1beta2::ClassifyTextResponse]
473
+ # @return [::Google::Cloud::Language::V1beta2::ClassifyTextResponse]
473
474
  #
474
- # @raise [Google::Cloud::Error] if the RPC is aborted.
475
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
475
476
  #
476
477
  def classify_text request, options = nil
477
- raise ArgumentError, "request must be provided" if request.nil?
478
+ raise ::ArgumentError, "request must be provided" if request.nil?
478
479
 
479
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::ClassifyTextRequest
480
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::ClassifyTextRequest
480
481
 
481
482
  # Converts hash and nil to an options object
482
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
483
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
483
484
 
484
485
  # Customize the options with defaults
485
486
  metadata = @config.rpcs.classify_text.metadata.to_h
486
487
 
487
488
  # Set x-goog-api-client and x-goog-user-project headers
488
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
489
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
489
490
  lib_name: @config.lib_name, lib_version: @config.lib_version,
490
491
  gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
491
492
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -500,8 +501,8 @@ module Google
500
501
  yield response, operation if block_given?
501
502
  return response
502
503
  end
503
- rescue GRPC::BadStatus => e
504
- raise Google::Cloud::Error.from_error(e)
504
+ rescue ::GRPC::BadStatus => e
505
+ raise ::Google::Cloud::Error.from_error(e)
505
506
  end
506
507
 
507
508
  ##
@@ -510,12 +511,12 @@ module Google
510
511
  #
511
512
  # @overload annotate_text(request, options = nil)
512
513
  # Pass arguments to `annotate_text` via a request object, either of type
513
- # {Google::Cloud::Language::V1beta2::AnnotateTextRequest} or an equivalent Hash.
514
+ # {::Google::Cloud::Language::V1beta2::AnnotateTextRequest} or an equivalent Hash.
514
515
  #
515
- # @param request [Google::Cloud::Language::V1beta2::AnnotateTextRequest, Hash]
516
+ # @param request [::Google::Cloud::Language::V1beta2::AnnotateTextRequest, ::Hash]
516
517
  # A request object representing the call parameters. Required. To specify no
517
518
  # parameters, or to keep all the default parameter values, pass an empty Hash.
518
- # @param options [Gapic::CallOptions, Hash]
519
+ # @param options [::Gapic::CallOptions, ::Hash]
519
520
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
520
521
  #
521
522
  # @overload annotate_text(document: nil, features: nil, encoding_type: nil)
@@ -523,34 +524,34 @@ module Google
523
524
  # least one keyword argument is required. To specify no parameters, or to keep all
524
525
  # the default parameter values, pass an empty Hash as a request object (see above).
525
526
  #
526
- # @param document [Google::Cloud::Language::V1beta2::Document, Hash]
527
+ # @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
527
528
  # Required. Input document.
528
- # @param features [Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features, Hash]
529
+ # @param features [::Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features, ::Hash]
529
530
  # Required. The enabled features.
530
- # @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
531
+ # @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
531
532
  # The encoding type used by the API to calculate offsets.
532
533
  #
533
534
  # @yield [response, operation] Access the result along with the RPC operation
534
- # @yieldparam response [Google::Cloud::Language::V1beta2::AnnotateTextResponse]
535
- # @yieldparam operation [GRPC::ActiveCall::Operation]
535
+ # @yieldparam response [::Google::Cloud::Language::V1beta2::AnnotateTextResponse]
536
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
536
537
  #
537
- # @return [Google::Cloud::Language::V1beta2::AnnotateTextResponse]
538
+ # @return [::Google::Cloud::Language::V1beta2::AnnotateTextResponse]
538
539
  #
539
- # @raise [Google::Cloud::Error] if the RPC is aborted.
540
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
540
541
  #
541
542
  def annotate_text request, options = nil
542
- raise ArgumentError, "request must be provided" if request.nil?
543
+ raise ::ArgumentError, "request must be provided" if request.nil?
543
544
 
544
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnnotateTextRequest
545
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnnotateTextRequest
545
546
 
546
547
  # Converts hash and nil to an options object
547
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
548
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
548
549
 
549
550
  # Customize the options with defaults
550
551
  metadata = @config.rpcs.annotate_text.metadata.to_h
551
552
 
552
553
  # Set x-goog-api-client and x-goog-user-project headers
553
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
554
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
554
555
  lib_name: @config.lib_name, lib_version: @config.lib_version,
555
556
  gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
556
557
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -565,8 +566,8 @@ module Google
565
566
  yield response, operation if block_given?
566
567
  return response
567
568
  end
568
- rescue GRPC::BadStatus => e
569
- raise Google::Cloud::Error.from_error(e)
569
+ rescue ::GRPC::BadStatus => e
570
+ raise ::Google::Cloud::Error.from_error(e)
570
571
  end
571
572
 
572
573
  ##
@@ -576,7 +577,7 @@ module Google
576
577
  # providing control over timeouts, retry behavior, logging, transport
577
578
  # parameters, and other low-level controls. Certain parameters can also be
578
579
  # applied individually to specific RPCs. See
579
- # {Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration::Rpcs}
580
+ # {::Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration::Rpcs}
580
581
  # for a list of RPCs that can be configured independently.
581
582
  #
582
583
  # Configuration can be applied globally to all clients, or to a single client
@@ -587,22 +588,22 @@ module Google
587
588
  # To modify the global config, setting the timeout for analyze_sentiment
588
589
  # to 20 seconds, and all remaining timeouts to 10 seconds:
589
590
  #
590
- # Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
591
- # config.timeout = 10_000
592
- # config.rpcs.analyze_sentiment.timeout = 20_000
591
+ # ::Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
592
+ # config.timeout = 10.0
593
+ # config.rpcs.analyze_sentiment.timeout = 20.0
593
594
  # end
594
595
  #
595
596
  # To apply the above configuration only to a new client:
596
597
  #
597
- # client = Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
598
- # config.timeout = 10_000
599
- # config.rpcs.analyze_sentiment.timeout = 20_000
598
+ # client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
599
+ # config.timeout = 10.0
600
+ # config.rpcs.analyze_sentiment.timeout = 20.0
600
601
  # end
601
602
  #
602
603
  # @!attribute [rw] endpoint
603
604
  # The hostname or hostname:port of the service endpoint.
604
605
  # Defaults to `"language.googleapis.com"`.
605
- # @return [String]
606
+ # @return [::String]
606
607
  # @!attribute [rw] credentials
607
608
  # Credentials to send with calls. You may provide any of the following types:
608
609
  # * (`String`) The path to a service account key file in JSON format
@@ -614,29 +615,29 @@ module Google
614
615
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
615
616
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
616
617
  # * (`nil`) indicating no credentials
617
- # @return [Object]
618
+ # @return [::Object]
618
619
  # @!attribute [rw] scope
619
620
  # The OAuth scopes
620
- # @return [Array<String>]
621
+ # @return [::Array<::String>]
621
622
  # @!attribute [rw] lib_name
622
623
  # The library name as recorded in instrumentation and logging
623
- # @return [String]
624
+ # @return [::String]
624
625
  # @!attribute [rw] lib_version
625
626
  # The library version as recorded in instrumentation and logging
626
- # @return [String]
627
+ # @return [::String]
627
628
  # @!attribute [rw] channel_args
628
629
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
629
630
  # `GRPC::Core::Channel` object is provided as the credential.
630
- # @return [Hash]
631
+ # @return [::Hash]
631
632
  # @!attribute [rw] interceptors
632
633
  # An array of interceptors that are run before calls are executed.
633
- # @return [Array<GRPC::ClientInterceptor>]
634
+ # @return [::Array<::GRPC::ClientInterceptor>]
634
635
  # @!attribute [rw] timeout
635
- # The call timeout in milliseconds.
636
- # @return [Numeric]
636
+ # The call timeout in seconds.
637
+ # @return [::Numeric]
637
638
  # @!attribute [rw] metadata
638
639
  # Additional gRPC headers to be sent with the call.
639
- # @return [Hash{Symbol=>String}]
640
+ # @return [::Hash{::Symbol=>::String}]
640
641
  # @!attribute [rw] retry_policy
641
642
  # The retry policy. The value is a hash with the following keys:
642
643
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -644,25 +645,29 @@ module Google
644
645
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
645
646
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
646
647
  # trigger a retry.
647
- # @return [Hash]
648
+ # @return [::Hash]
649
+ # @!attribute [rw] quota_project
650
+ # A separate project against which to charge quota.
651
+ # @return [::String]
648
652
  #
649
653
  class Configuration
650
- extend Gapic::Config
654
+ extend ::Gapic::Config
651
655
 
652
- config_attr :endpoint, "language.googleapis.com", String
653
- config_attr :credentials, nil do |value|
656
+ config_attr :endpoint, "language.googleapis.com", ::String
657
+ config_attr :credentials, nil do |value|
654
658
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
655
659
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
656
660
  allowed.any? { |klass| klass === value }
657
661
  end
658
- config_attr :scope, nil, String, Array, nil
659
- config_attr :lib_name, nil, String, nil
660
- config_attr :lib_version, nil, String, nil
661
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
662
- config_attr :interceptors, nil, Array, nil
663
- config_attr :timeout, nil, Numeric, nil
664
- config_attr :metadata, nil, Hash, nil
665
- config_attr :retry_policy, nil, Hash, Proc, nil
662
+ config_attr :scope, nil, ::String, ::Array, nil
663
+ config_attr :lib_name, nil, ::String, nil
664
+ config_attr :lib_version, nil, ::String, nil
665
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
666
+ config_attr :interceptors, nil, ::Array, nil
667
+ config_attr :timeout, nil, ::Numeric, nil
668
+ config_attr :metadata, nil, ::Hash, nil
669
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
670
+ config_attr :quota_project, nil, ::String, nil
666
671
 
667
672
  # @private
668
673
  def initialize parent_config = nil
@@ -678,7 +683,7 @@ module Google
678
683
  def rpcs
679
684
  @rpcs ||= begin
680
685
  parent_rpcs = nil
681
- parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
686
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
682
687
  Rpcs.new parent_rpcs
683
688
  end
684
689
  end
@@ -703,49 +708,49 @@ module Google
703
708
  class Rpcs
704
709
  ##
705
710
  # RPC-specific configuration for `analyze_sentiment`
706
- # @return [Gapic::Config::Method]
711
+ # @return [::Gapic::Config::Method]
707
712
  #
708
713
  attr_reader :analyze_sentiment
709
714
  ##
710
715
  # RPC-specific configuration for `analyze_entities`
711
- # @return [Gapic::Config::Method]
716
+ # @return [::Gapic::Config::Method]
712
717
  #
713
718
  attr_reader :analyze_entities
714
719
  ##
715
720
  # RPC-specific configuration for `analyze_entity_sentiment`
716
- # @return [Gapic::Config::Method]
721
+ # @return [::Gapic::Config::Method]
717
722
  #
718
723
  attr_reader :analyze_entity_sentiment
719
724
  ##
720
725
  # RPC-specific configuration for `analyze_syntax`
721
- # @return [Gapic::Config::Method]
726
+ # @return [::Gapic::Config::Method]
722
727
  #
723
728
  attr_reader :analyze_syntax
724
729
  ##
725
730
  # RPC-specific configuration for `classify_text`
726
- # @return [Gapic::Config::Method]
731
+ # @return [::Gapic::Config::Method]
727
732
  #
728
733
  attr_reader :classify_text
729
734
  ##
730
735
  # RPC-specific configuration for `annotate_text`
731
- # @return [Gapic::Config::Method]
736
+ # @return [::Gapic::Config::Method]
732
737
  #
733
738
  attr_reader :annotate_text
734
739
 
735
740
  # @private
736
741
  def initialize parent_rpcs = nil
737
742
  analyze_sentiment_config = parent_rpcs&.analyze_sentiment if parent_rpcs&.respond_to? :analyze_sentiment
738
- @analyze_sentiment = Gapic::Config::Method.new analyze_sentiment_config
743
+ @analyze_sentiment = ::Gapic::Config::Method.new analyze_sentiment_config
739
744
  analyze_entities_config = parent_rpcs&.analyze_entities if parent_rpcs&.respond_to? :analyze_entities
740
- @analyze_entities = Gapic::Config::Method.new analyze_entities_config
745
+ @analyze_entities = ::Gapic::Config::Method.new analyze_entities_config
741
746
  analyze_entity_sentiment_config = parent_rpcs&.analyze_entity_sentiment if parent_rpcs&.respond_to? :analyze_entity_sentiment
742
- @analyze_entity_sentiment = Gapic::Config::Method.new analyze_entity_sentiment_config
747
+ @analyze_entity_sentiment = ::Gapic::Config::Method.new analyze_entity_sentiment_config
743
748
  analyze_syntax_config = parent_rpcs&.analyze_syntax if parent_rpcs&.respond_to? :analyze_syntax
744
- @analyze_syntax = Gapic::Config::Method.new analyze_syntax_config
749
+ @analyze_syntax = ::Gapic::Config::Method.new analyze_syntax_config
745
750
  classify_text_config = parent_rpcs&.classify_text if parent_rpcs&.respond_to? :classify_text
746
- @classify_text = Gapic::Config::Method.new classify_text_config
751
+ @classify_text = ::Gapic::Config::Method.new classify_text_config
747
752
  annotate_text_config = parent_rpcs&.annotate_text if parent_rpcs&.respond_to? :annotate_text
748
- @annotate_text = Gapic::Config::Method.new annotate_text_config
753
+ @annotate_text = ::Gapic::Config::Method.new annotate_text_config
749
754
 
750
755
  yield self if block_given?
751
756
  end