google-cloud-language-v1 0.1.3 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa9b3392a6c79b5a1467f83355581382dbf1de2b85235425f7323687cb0f6c54
4
- data.tar.gz: 9499739748001e7af7d649ed3b377c4c98740725efddccca867e8055c6751f88
3
+ metadata.gz: 6b7186098f33dd09810b5a3d6b3de996c6012e846b9fb4e5cff683306696043a
4
+ data.tar.gz: f4484a4b5f5e82a8ae08079ad104ce4b7e620d29c849b52ccb68a49485766438
5
5
  SHA512:
6
- metadata.gz: 369c5a657a3e4e4b312fb8c8bc85568e1a1332353bca99a3b01279f4f772db34b968df36f5b839a45a449de0eb267b81299f5490ada8cca4b38f2ba0fbe5d822
7
- data.tar.gz: d03a8dc9f2b7e479f1265a171ec59f5d308a0558c8cf65495b516358d3ce5950862150abbfe23967e0f42a0918811178f805822871cf9fa874643b8c75c3377e
6
+ metadata.gz: 2aa378906e31d278a0e357d0205a18eeeb15aec7335b7719034d8b29dde6e4c13e4d42c5f2e5d5153bab25aa63ea9eb2f49d79e52295b4e8fc062db71d11ede4
7
+ data.tar.gz: 90c01d9533723be98f38caa42915e4aea81e142478fa69513c96100c25f621b4cbe65143e0227823f710c1bf27f3bae6b5e65b902fd8fa9c619ba4aa12b26602
@@ -27,7 +27,7 @@ export LANGUAGE_CREDENTIALS=path/to/keyfile.json
27
27
  ```ruby
28
28
  require "google/cloud/language/v1"
29
29
 
30
- client = Google::Cloud::Language::V1::LanguageService::Client.new
30
+ client = ::Google::Cloud::Language::V1::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-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
- {Google::Cloud::Language::V1::LanguageService::Credentials}):
67
+ {::Google::Cloud::Language::V1::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/v1"
77
77
 
78
78
  ENV["LANGUAGE_CREDENTIALS"] = "path/to/keyfile.json"
79
79
 
80
- client = Google::Cloud::Language::V1::LanguageService::Client.new
80
+ client = ::Google::Cloud::Language::V1::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/v1"
90
90
 
91
- client = Google::Cloud::Language::V1::LanguageService::Client.new do |config|
91
+ client = ::Google::Cloud::Language::V1::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/v1"
100
100
 
101
- Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
101
+ ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
102
102
  config.credentials = "path/to/keyfile.json"
103
103
  end
104
104
 
105
- client = Google::Cloud::Language::V1::LanguageService::Client.new
105
+ client = ::Google::Cloud::Language::V1::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/v1"
27
28
 
28
- client = Google::Cloud::Language::V1::LanguageService::Client.new
29
+ client = ::Google::Cloud::Language::V1::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-v1/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/v1"
29
- # client = Google::Cloud::Language::V1::LanguageService::Client.new
29
+ # client = ::Google::Cloud::Language::V1::LanguageService::Client.new
30
30
  #
31
31
  module V1
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/v1/language_service"
39
- # client = Google::Cloud::Language::V1::LanguageService::Client.new
39
+ # client = ::Google::Cloud::Language::V1::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::V1::LanguageService::Client::Configuration}
40
+ # See {::Google::Cloud::Language::V1::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::V1::LanguageService::Client.configure do |config|
48
- # config.timeout = 10_000
47
+ # ::Google::Cloud::Language::V1::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::V1::LanguageService::Client::Configuration}
128
+ # See {::Google::Cloud::Language::V1::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::V1::LanguageService::Client.new
149
+ # client = ::Google::Cloud::Language::V1::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::V1::LanguageService::Client.new do |config|
155
- # config.timeout = 10_000
154
+ # client = ::Google::Cloud::Language::V1::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::V1::LanguageService::Stub,
183
+ @language_service_stub = ::Gapic::ServiceStub.new(
184
+ ::Google::Cloud::Language::V1::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::V1::AnalyzeSentimentRequest} or an equivalent Hash.
199
+ # {::Google::Cloud::Language::V1::AnalyzeSentimentRequest} or an equivalent Hash.
199
200
  #
200
- # @param request [Google::Cloud::Language::V1::AnalyzeSentimentRequest, Hash]
201
+ # @param request [::Google::Cloud::Language::V1::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,32 +209,32 @@ 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::V1::Document, Hash]
212
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
212
213
  # Input document.
213
- # @param encoding_type [Google::Cloud::Language::V1::EncodingType]
214
+ # @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
214
215
  # The encoding type used by the API to calculate sentence offsets.
215
216
  #
216
217
  # @yield [response, operation] Access the result along with the RPC operation
217
- # @yieldparam response [Google::Cloud::Language::V1::AnalyzeSentimentResponse]
218
- # @yieldparam operation [GRPC::ActiveCall::Operation]
218
+ # @yieldparam response [::Google::Cloud::Language::V1::AnalyzeSentimentResponse]
219
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
219
220
  #
220
- # @return [Google::Cloud::Language::V1::AnalyzeSentimentResponse]
221
+ # @return [::Google::Cloud::Language::V1::AnalyzeSentimentResponse]
221
222
  #
222
- # @raise [Google::Cloud::Error] if the RPC is aborted.
223
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
223
224
  #
224
225
  def analyze_sentiment request, options = nil
225
- raise ArgumentError, "request must be provided" if request.nil?
226
+ raise ::ArgumentError, "request must be provided" if request.nil?
226
227
 
227
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeSentimentRequest
228
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeSentimentRequest
228
229
 
229
230
  # Converts hash and nil to an options object
230
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
231
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
231
232
 
232
233
  # Customize the options with defaults
233
234
  metadata = @config.rpcs.analyze_sentiment.metadata.to_h
234
235
 
235
236
  # Set x-goog-api-client and x-goog-user-project headers
236
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
237
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
237
238
  lib_name: @config.lib_name, lib_version: @config.lib_version,
238
239
  gapic_version: ::Google::Cloud::Language::V1::VERSION
239
240
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -248,8 +249,8 @@ module Google
248
249
  yield response, operation if block_given?
249
250
  return response
250
251
  end
251
- rescue GRPC::BadStatus => e
252
- raise Google::Cloud::Error.from_error(e)
252
+ rescue ::GRPC::BadStatus => e
253
+ raise ::Google::Cloud::Error.from_error(e)
253
254
  end
254
255
 
255
256
  ##
@@ -259,12 +260,12 @@ module Google
259
260
  #
260
261
  # @overload analyze_entities(request, options = nil)
261
262
  # Pass arguments to `analyze_entities` via a request object, either of type
262
- # {Google::Cloud::Language::V1::AnalyzeEntitiesRequest} or an equivalent Hash.
263
+ # {::Google::Cloud::Language::V1::AnalyzeEntitiesRequest} or an equivalent Hash.
263
264
  #
264
- # @param request [Google::Cloud::Language::V1::AnalyzeEntitiesRequest, Hash]
265
+ # @param request [::Google::Cloud::Language::V1::AnalyzeEntitiesRequest, ::Hash]
265
266
  # A request object representing the call parameters. Required. To specify no
266
267
  # parameters, or to keep all the default parameter values, pass an empty Hash.
267
- # @param options [Gapic::CallOptions, Hash]
268
+ # @param options [::Gapic::CallOptions, ::Hash]
268
269
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
269
270
  #
270
271
  # @overload analyze_entities(document: nil, encoding_type: nil)
@@ -272,32 +273,32 @@ module Google
272
273
  # least one keyword argument is required. To specify no parameters, or to keep all
273
274
  # the default parameter values, pass an empty Hash as a request object (see above).
274
275
  #
275
- # @param document [Google::Cloud::Language::V1::Document, Hash]
276
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
276
277
  # Input document.
277
- # @param encoding_type [Google::Cloud::Language::V1::EncodingType]
278
+ # @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
278
279
  # The encoding type used by the API to calculate offsets.
279
280
  #
280
281
  # @yield [response, operation] Access the result along with the RPC operation
281
- # @yieldparam response [Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
282
- # @yieldparam operation [GRPC::ActiveCall::Operation]
282
+ # @yieldparam response [::Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
283
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
283
284
  #
284
- # @return [Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
285
+ # @return [::Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
285
286
  #
286
- # @raise [Google::Cloud::Error] if the RPC is aborted.
287
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
287
288
  #
288
289
  def analyze_entities request, options = nil
289
- raise ArgumentError, "request must be provided" if request.nil?
290
+ raise ::ArgumentError, "request must be provided" if request.nil?
290
291
 
291
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeEntitiesRequest
292
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeEntitiesRequest
292
293
 
293
294
  # Converts hash and nil to an options object
294
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
295
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
295
296
 
296
297
  # Customize the options with defaults
297
298
  metadata = @config.rpcs.analyze_entities.metadata.to_h
298
299
 
299
300
  # Set x-goog-api-client and x-goog-user-project headers
300
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
301
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
301
302
  lib_name: @config.lib_name, lib_version: @config.lib_version,
302
303
  gapic_version: ::Google::Cloud::Language::V1::VERSION
303
304
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -312,22 +313,22 @@ module Google
312
313
  yield response, operation if block_given?
313
314
  return response
314
315
  end
315
- rescue GRPC::BadStatus => e
316
- raise Google::Cloud::Error.from_error(e)
316
+ rescue ::GRPC::BadStatus => e
317
+ raise ::Google::Cloud::Error.from_error(e)
317
318
  end
318
319
 
319
320
  ##
320
- # Finds entities, similar to {Google::Cloud::Language::V1::LanguageService::Client#analyze_entities AnalyzeEntities} in the text and analyzes
321
+ # Finds entities, similar to {::Google::Cloud::Language::V1::LanguageService::Client#analyze_entities AnalyzeEntities} in the text and analyzes
321
322
  # sentiment associated with each entity and its mentions.
322
323
  #
323
324
  # @overload analyze_entity_sentiment(request, options = nil)
324
325
  # Pass arguments to `analyze_entity_sentiment` via a request object, either of type
325
- # {Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest} or an equivalent Hash.
326
+ # {::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest} or an equivalent Hash.
326
327
  #
327
- # @param request [Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest, Hash]
328
+ # @param request [::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest, ::Hash]
328
329
  # A request object representing the call parameters. Required. To specify no
329
330
  # parameters, or to keep all the default parameter values, pass an empty Hash.
330
- # @param options [Gapic::CallOptions, Hash]
331
+ # @param options [::Gapic::CallOptions, ::Hash]
331
332
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
332
333
  #
333
334
  # @overload analyze_entity_sentiment(document: nil, encoding_type: nil)
@@ -335,32 +336,32 @@ module Google
335
336
  # least one keyword argument is required. To specify no parameters, or to keep all
336
337
  # the default parameter values, pass an empty Hash as a request object (see above).
337
338
  #
338
- # @param document [Google::Cloud::Language::V1::Document, Hash]
339
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
339
340
  # Input document.
340
- # @param encoding_type [Google::Cloud::Language::V1::EncodingType]
341
+ # @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
341
342
  # The encoding type used by the API to calculate offsets.
342
343
  #
343
344
  # @yield [response, operation] Access the result along with the RPC operation
344
- # @yieldparam response [Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
345
- # @yieldparam operation [GRPC::ActiveCall::Operation]
345
+ # @yieldparam response [::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
346
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
346
347
  #
347
- # @return [Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
348
+ # @return [::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
348
349
  #
349
- # @raise [Google::Cloud::Error] if the RPC is aborted.
350
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
350
351
  #
351
352
  def analyze_entity_sentiment request, options = nil
352
- raise ArgumentError, "request must be provided" if request.nil?
353
+ raise ::ArgumentError, "request must be provided" if request.nil?
353
354
 
354
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest
355
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest
355
356
 
356
357
  # Converts hash and nil to an options object
357
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
358
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
358
359
 
359
360
  # Customize the options with defaults
360
361
  metadata = @config.rpcs.analyze_entity_sentiment.metadata.to_h
361
362
 
362
363
  # Set x-goog-api-client and x-goog-user-project headers
363
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
364
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
364
365
  lib_name: @config.lib_name, lib_version: @config.lib_version,
365
366
  gapic_version: ::Google::Cloud::Language::V1::VERSION
366
367
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -375,8 +376,8 @@ module Google
375
376
  yield response, operation if block_given?
376
377
  return response
377
378
  end
378
- rescue GRPC::BadStatus => e
379
- raise Google::Cloud::Error.from_error(e)
379
+ rescue ::GRPC::BadStatus => e
380
+ raise ::Google::Cloud::Error.from_error(e)
380
381
  end
381
382
 
382
383
  ##
@@ -386,12 +387,12 @@ module Google
386
387
  #
387
388
  # @overload analyze_syntax(request, options = nil)
388
389
  # Pass arguments to `analyze_syntax` via a request object, either of type
389
- # {Google::Cloud::Language::V1::AnalyzeSyntaxRequest} or an equivalent Hash.
390
+ # {::Google::Cloud::Language::V1::AnalyzeSyntaxRequest} or an equivalent Hash.
390
391
  #
391
- # @param request [Google::Cloud::Language::V1::AnalyzeSyntaxRequest, Hash]
392
+ # @param request [::Google::Cloud::Language::V1::AnalyzeSyntaxRequest, ::Hash]
392
393
  # A request object representing the call parameters. Required. To specify no
393
394
  # parameters, or to keep all the default parameter values, pass an empty Hash.
394
- # @param options [Gapic::CallOptions, Hash]
395
+ # @param options [::Gapic::CallOptions, ::Hash]
395
396
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
396
397
  #
397
398
  # @overload analyze_syntax(document: nil, encoding_type: nil)
@@ -399,32 +400,32 @@ module Google
399
400
  # least one keyword argument is required. To specify no parameters, or to keep all
400
401
  # the default parameter values, pass an empty Hash as a request object (see above).
401
402
  #
402
- # @param document [Google::Cloud::Language::V1::Document, Hash]
403
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
403
404
  # Input document.
404
- # @param encoding_type [Google::Cloud::Language::V1::EncodingType]
405
+ # @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
405
406
  # The encoding type used by the API to calculate offsets.
406
407
  #
407
408
  # @yield [response, operation] Access the result along with the RPC operation
408
- # @yieldparam response [Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
409
- # @yieldparam operation [GRPC::ActiveCall::Operation]
409
+ # @yieldparam response [::Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
410
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
410
411
  #
411
- # @return [Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
412
+ # @return [::Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
412
413
  #
413
- # @raise [Google::Cloud::Error] if the RPC is aborted.
414
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
414
415
  #
415
416
  def analyze_syntax request, options = nil
416
- raise ArgumentError, "request must be provided" if request.nil?
417
+ raise ::ArgumentError, "request must be provided" if request.nil?
417
418
 
418
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeSyntaxRequest
419
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeSyntaxRequest
419
420
 
420
421
  # Converts hash and nil to an options object
421
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
422
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
422
423
 
423
424
  # Customize the options with defaults
424
425
  metadata = @config.rpcs.analyze_syntax.metadata.to_h
425
426
 
426
427
  # Set x-goog-api-client and x-goog-user-project headers
427
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
428
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
428
429
  lib_name: @config.lib_name, lib_version: @config.lib_version,
429
430
  gapic_version: ::Google::Cloud::Language::V1::VERSION
430
431
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -439,8 +440,8 @@ module Google
439
440
  yield response, operation if block_given?
440
441
  return response
441
442
  end
442
- rescue GRPC::BadStatus => e
443
- raise Google::Cloud::Error.from_error(e)
443
+ rescue ::GRPC::BadStatus => e
444
+ raise ::Google::Cloud::Error.from_error(e)
444
445
  end
445
446
 
446
447
  ##
@@ -448,12 +449,12 @@ module Google
448
449
  #
449
450
  # @overload classify_text(request, options = nil)
450
451
  # Pass arguments to `classify_text` via a request object, either of type
451
- # {Google::Cloud::Language::V1::ClassifyTextRequest} or an equivalent Hash.
452
+ # {::Google::Cloud::Language::V1::ClassifyTextRequest} or an equivalent Hash.
452
453
  #
453
- # @param request [Google::Cloud::Language::V1::ClassifyTextRequest, Hash]
454
+ # @param request [::Google::Cloud::Language::V1::ClassifyTextRequest, ::Hash]
454
455
  # A request object representing the call parameters. Required. To specify no
455
456
  # parameters, or to keep all the default parameter values, pass an empty Hash.
456
- # @param options [Gapic::CallOptions, Hash]
457
+ # @param options [::Gapic::CallOptions, ::Hash]
457
458
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
458
459
  #
459
460
  # @overload classify_text(document: nil)
@@ -461,30 +462,30 @@ module Google
461
462
  # least one keyword argument is required. To specify no parameters, or to keep all
462
463
  # the default parameter values, pass an empty Hash as a request object (see above).
463
464
  #
464
- # @param document [Google::Cloud::Language::V1::Document, Hash]
465
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
465
466
  # Input document.
466
467
  #
467
468
  # @yield [response, operation] Access the result along with the RPC operation
468
- # @yieldparam response [Google::Cloud::Language::V1::ClassifyTextResponse]
469
- # @yieldparam operation [GRPC::ActiveCall::Operation]
469
+ # @yieldparam response [::Google::Cloud::Language::V1::ClassifyTextResponse]
470
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
470
471
  #
471
- # @return [Google::Cloud::Language::V1::ClassifyTextResponse]
472
+ # @return [::Google::Cloud::Language::V1::ClassifyTextResponse]
472
473
  #
473
- # @raise [Google::Cloud::Error] if the RPC is aborted.
474
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
474
475
  #
475
476
  def classify_text request, options = nil
476
- raise ArgumentError, "request must be provided" if request.nil?
477
+ raise ::ArgumentError, "request must be provided" if request.nil?
477
478
 
478
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::ClassifyTextRequest
479
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::ClassifyTextRequest
479
480
 
480
481
  # Converts hash and nil to an options object
481
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
482
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
482
483
 
483
484
  # Customize the options with defaults
484
485
  metadata = @config.rpcs.classify_text.metadata.to_h
485
486
 
486
487
  # Set x-goog-api-client and x-goog-user-project headers
487
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
488
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
488
489
  lib_name: @config.lib_name, lib_version: @config.lib_version,
489
490
  gapic_version: ::Google::Cloud::Language::V1::VERSION
490
491
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -499,8 +500,8 @@ module Google
499
500
  yield response, operation if block_given?
500
501
  return response
501
502
  end
502
- rescue GRPC::BadStatus => e
503
- raise Google::Cloud::Error.from_error(e)
503
+ rescue ::GRPC::BadStatus => e
504
+ raise ::Google::Cloud::Error.from_error(e)
504
505
  end
505
506
 
506
507
  ##
@@ -509,12 +510,12 @@ module Google
509
510
  #
510
511
  # @overload annotate_text(request, options = nil)
511
512
  # Pass arguments to `annotate_text` via a request object, either of type
512
- # {Google::Cloud::Language::V1::AnnotateTextRequest} or an equivalent Hash.
513
+ # {::Google::Cloud::Language::V1::AnnotateTextRequest} or an equivalent Hash.
513
514
  #
514
- # @param request [Google::Cloud::Language::V1::AnnotateTextRequest, Hash]
515
+ # @param request [::Google::Cloud::Language::V1::AnnotateTextRequest, ::Hash]
515
516
  # A request object representing the call parameters. Required. To specify no
516
517
  # parameters, or to keep all the default parameter values, pass an empty Hash.
517
- # @param options [Gapic::CallOptions, Hash]
518
+ # @param options [::Gapic::CallOptions, ::Hash]
518
519
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
519
520
  #
520
521
  # @overload annotate_text(document: nil, features: nil, encoding_type: nil)
@@ -522,34 +523,34 @@ module Google
522
523
  # least one keyword argument is required. To specify no parameters, or to keep all
523
524
  # the default parameter values, pass an empty Hash as a request object (see above).
524
525
  #
525
- # @param document [Google::Cloud::Language::V1::Document, Hash]
526
+ # @param document [::Google::Cloud::Language::V1::Document, ::Hash]
526
527
  # Input document.
527
- # @param features [Google::Cloud::Language::V1::AnnotateTextRequest::Features, Hash]
528
+ # @param features [::Google::Cloud::Language::V1::AnnotateTextRequest::Features, ::Hash]
528
529
  # The enabled features.
529
- # @param encoding_type [Google::Cloud::Language::V1::EncodingType]
530
+ # @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
530
531
  # The encoding type used by the API to calculate offsets.
531
532
  #
532
533
  # @yield [response, operation] Access the result along with the RPC operation
533
- # @yieldparam response [Google::Cloud::Language::V1::AnnotateTextResponse]
534
- # @yieldparam operation [GRPC::ActiveCall::Operation]
534
+ # @yieldparam response [::Google::Cloud::Language::V1::AnnotateTextResponse]
535
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
535
536
  #
536
- # @return [Google::Cloud::Language::V1::AnnotateTextResponse]
537
+ # @return [::Google::Cloud::Language::V1::AnnotateTextResponse]
537
538
  #
538
- # @raise [Google::Cloud::Error] if the RPC is aborted.
539
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
539
540
  #
540
541
  def annotate_text request, options = nil
541
- raise ArgumentError, "request must be provided" if request.nil?
542
+ raise ::ArgumentError, "request must be provided" if request.nil?
542
543
 
543
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnnotateTextRequest
544
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnnotateTextRequest
544
545
 
545
546
  # Converts hash and nil to an options object
546
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
547
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
547
548
 
548
549
  # Customize the options with defaults
549
550
  metadata = @config.rpcs.annotate_text.metadata.to_h
550
551
 
551
552
  # Set x-goog-api-client and x-goog-user-project headers
552
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
553
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
553
554
  lib_name: @config.lib_name, lib_version: @config.lib_version,
554
555
  gapic_version: ::Google::Cloud::Language::V1::VERSION
555
556
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -564,8 +565,8 @@ module Google
564
565
  yield response, operation if block_given?
565
566
  return response
566
567
  end
567
- rescue GRPC::BadStatus => e
568
- raise Google::Cloud::Error.from_error(e)
568
+ rescue ::GRPC::BadStatus => e
569
+ raise ::Google::Cloud::Error.from_error(e)
569
570
  end
570
571
 
571
572
  ##
@@ -575,7 +576,7 @@ module Google
575
576
  # providing control over timeouts, retry behavior, logging, transport
576
577
  # parameters, and other low-level controls. Certain parameters can also be
577
578
  # applied individually to specific RPCs. See
578
- # {Google::Cloud::Language::V1::LanguageService::Client::Configuration::Rpcs}
579
+ # {::Google::Cloud::Language::V1::LanguageService::Client::Configuration::Rpcs}
579
580
  # for a list of RPCs that can be configured independently.
580
581
  #
581
582
  # Configuration can be applied globally to all clients, or to a single client
@@ -586,22 +587,22 @@ module Google
586
587
  # To modify the global config, setting the timeout for analyze_sentiment
587
588
  # to 20 seconds, and all remaining timeouts to 10 seconds:
588
589
  #
589
- # Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
590
- # config.timeout = 10_000
591
- # config.rpcs.analyze_sentiment.timeout = 20_000
590
+ # ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
591
+ # config.timeout = 10.0
592
+ # config.rpcs.analyze_sentiment.timeout = 20.0
592
593
  # end
593
594
  #
594
595
  # To apply the above configuration only to a new client:
595
596
  #
596
- # client = Google::Cloud::Language::V1::LanguageService::Client.new do |config|
597
- # config.timeout = 10_000
598
- # config.rpcs.analyze_sentiment.timeout = 20_000
597
+ # client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
598
+ # config.timeout = 10.0
599
+ # config.rpcs.analyze_sentiment.timeout = 20.0
599
600
  # end
600
601
  #
601
602
  # @!attribute [rw] endpoint
602
603
  # The hostname or hostname:port of the service endpoint.
603
604
  # Defaults to `"language.googleapis.com"`.
604
- # @return [String]
605
+ # @return [::String]
605
606
  # @!attribute [rw] credentials
606
607
  # Credentials to send with calls. You may provide any of the following types:
607
608
  # * (`String`) The path to a service account key file in JSON format
@@ -613,29 +614,29 @@ module Google
613
614
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
614
615
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
615
616
  # * (`nil`) indicating no credentials
616
- # @return [Object]
617
+ # @return [::Object]
617
618
  # @!attribute [rw] scope
618
619
  # The OAuth scopes
619
- # @return [Array<String>]
620
+ # @return [::Array<::String>]
620
621
  # @!attribute [rw] lib_name
621
622
  # The library name as recorded in instrumentation and logging
622
- # @return [String]
623
+ # @return [::String]
623
624
  # @!attribute [rw] lib_version
624
625
  # The library version as recorded in instrumentation and logging
625
- # @return [String]
626
+ # @return [::String]
626
627
  # @!attribute [rw] channel_args
627
628
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
628
629
  # `GRPC::Core::Channel` object is provided as the credential.
629
- # @return [Hash]
630
+ # @return [::Hash]
630
631
  # @!attribute [rw] interceptors
631
632
  # An array of interceptors that are run before calls are executed.
632
- # @return [Array<GRPC::ClientInterceptor>]
633
+ # @return [::Array<::GRPC::ClientInterceptor>]
633
634
  # @!attribute [rw] timeout
634
- # The call timeout in milliseconds.
635
- # @return [Numeric]
635
+ # The call timeout in seconds.
636
+ # @return [::Numeric]
636
637
  # @!attribute [rw] metadata
637
638
  # Additional gRPC headers to be sent with the call.
638
- # @return [Hash{Symbol=>String}]
639
+ # @return [::Hash{::Symbol=>::String}]
639
640
  # @!attribute [rw] retry_policy
640
641
  # The retry policy. The value is a hash with the following keys:
641
642
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -643,25 +644,29 @@ module Google
643
644
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
644
645
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
645
646
  # trigger a retry.
646
- # @return [Hash]
647
+ # @return [::Hash]
648
+ # @!attribute [rw] quota_project
649
+ # A separate project against which to charge quota.
650
+ # @return [::String]
647
651
  #
648
652
  class Configuration
649
- extend Gapic::Config
653
+ extend ::Gapic::Config
650
654
 
651
- config_attr :endpoint, "language.googleapis.com", String
652
- config_attr :credentials, nil do |value|
655
+ config_attr :endpoint, "language.googleapis.com", ::String
656
+ config_attr :credentials, nil do |value|
653
657
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
654
658
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
655
659
  allowed.any? { |klass| klass === value }
656
660
  end
657
- config_attr :scope, nil, String, Array, nil
658
- config_attr :lib_name, nil, String, nil
659
- config_attr :lib_version, nil, String, nil
660
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
661
- config_attr :interceptors, nil, Array, nil
662
- config_attr :timeout, nil, Numeric, nil
663
- config_attr :metadata, nil, Hash, nil
664
- config_attr :retry_policy, nil, Hash, Proc, nil
661
+ config_attr :scope, nil, ::String, ::Array, nil
662
+ config_attr :lib_name, nil, ::String, nil
663
+ config_attr :lib_version, nil, ::String, nil
664
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
665
+ config_attr :interceptors, nil, ::Array, nil
666
+ config_attr :timeout, nil, ::Numeric, nil
667
+ config_attr :metadata, nil, ::Hash, nil
668
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
669
+ config_attr :quota_project, nil, ::String, nil
665
670
 
666
671
  # @private
667
672
  def initialize parent_config = nil
@@ -677,7 +682,7 @@ module Google
677
682
  def rpcs
678
683
  @rpcs ||= begin
679
684
  parent_rpcs = nil
680
- parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
685
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
681
686
  Rpcs.new parent_rpcs
682
687
  end
683
688
  end
@@ -702,49 +707,49 @@ module Google
702
707
  class Rpcs
703
708
  ##
704
709
  # RPC-specific configuration for `analyze_sentiment`
705
- # @return [Gapic::Config::Method]
710
+ # @return [::Gapic::Config::Method]
706
711
  #
707
712
  attr_reader :analyze_sentiment
708
713
  ##
709
714
  # RPC-specific configuration for `analyze_entities`
710
- # @return [Gapic::Config::Method]
715
+ # @return [::Gapic::Config::Method]
711
716
  #
712
717
  attr_reader :analyze_entities
713
718
  ##
714
719
  # RPC-specific configuration for `analyze_entity_sentiment`
715
- # @return [Gapic::Config::Method]
720
+ # @return [::Gapic::Config::Method]
716
721
  #
717
722
  attr_reader :analyze_entity_sentiment
718
723
  ##
719
724
  # RPC-specific configuration for `analyze_syntax`
720
- # @return [Gapic::Config::Method]
725
+ # @return [::Gapic::Config::Method]
721
726
  #
722
727
  attr_reader :analyze_syntax
723
728
  ##
724
729
  # RPC-specific configuration for `classify_text`
725
- # @return [Gapic::Config::Method]
730
+ # @return [::Gapic::Config::Method]
726
731
  #
727
732
  attr_reader :classify_text
728
733
  ##
729
734
  # RPC-specific configuration for `annotate_text`
730
- # @return [Gapic::Config::Method]
735
+ # @return [::Gapic::Config::Method]
731
736
  #
732
737
  attr_reader :annotate_text
733
738
 
734
739
  # @private
735
740
  def initialize parent_rpcs = nil
736
741
  analyze_sentiment_config = parent_rpcs&.analyze_sentiment if parent_rpcs&.respond_to? :analyze_sentiment
737
- @analyze_sentiment = Gapic::Config::Method.new analyze_sentiment_config
742
+ @analyze_sentiment = ::Gapic::Config::Method.new analyze_sentiment_config
738
743
  analyze_entities_config = parent_rpcs&.analyze_entities if parent_rpcs&.respond_to? :analyze_entities
739
- @analyze_entities = Gapic::Config::Method.new analyze_entities_config
744
+ @analyze_entities = ::Gapic::Config::Method.new analyze_entities_config
740
745
  analyze_entity_sentiment_config = parent_rpcs&.analyze_entity_sentiment if parent_rpcs&.respond_to? :analyze_entity_sentiment
741
- @analyze_entity_sentiment = Gapic::Config::Method.new analyze_entity_sentiment_config
746
+ @analyze_entity_sentiment = ::Gapic::Config::Method.new analyze_entity_sentiment_config
742
747
  analyze_syntax_config = parent_rpcs&.analyze_syntax if parent_rpcs&.respond_to? :analyze_syntax
743
- @analyze_syntax = Gapic::Config::Method.new analyze_syntax_config
748
+ @analyze_syntax = ::Gapic::Config::Method.new analyze_syntax_config
744
749
  classify_text_config = parent_rpcs&.classify_text if parent_rpcs&.respond_to? :classify_text
745
- @classify_text = Gapic::Config::Method.new classify_text_config
750
+ @classify_text = ::Gapic::Config::Method.new classify_text_config
746
751
  annotate_text_config = parent_rpcs&.annotate_text if parent_rpcs&.respond_to? :annotate_text
747
- @annotate_text = Gapic::Config::Method.new annotate_text_config
752
+ @annotate_text = ::Gapic::Config::Method.new annotate_text_config
748
753
 
749
754
  yield self if block_given?
750
755
  end