google-cloud-language-v1 0.1.2 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +48 -1
- data/lib/google-cloud-language-v1.rb +21 -1
- data/lib/google/cloud/language/v1.rb +16 -0
- data/lib/google/cloud/language/v1/language_service.rb +30 -1
- data/lib/google/cloud/language/v1/language_service/client.rb +196 -171
- data/lib/google/cloud/language/v1/language_service/credentials.rb +1 -1
- data/lib/google/cloud/language/v1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/language/v1/language_service.rb +136 -136
- metadata +33 -6
- data/lib/google/cloud/common_resources_pb.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bb7f1c489a272cac59e409c6f1e54db10bf094583ae64575f0f84de2d47e806
|
4
|
+
data.tar.gz: a0dd9d7218ff8dbdbdd0404797a338dc2b0e1a54e875860cee1d425051226b0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a65dd1c54e9a7e9dc1917367c5e1f553548f06cfb9de8f72182c3fc6effe0c77bb87052f9900e7c7fa0c4ca36495d1b6a0f77df194032a24c92a68b45135d2a8
|
7
|
+
data.tar.gz: db67e9068a1e49e3709f30e63bf998c6adf8a00169a450518686765721dbceb60c185073ed83f39eff60e4fc0a779f150db17765c6ca60416ebca70f5f546630
|
data/AUTHENTICATION.md
CHANGED
@@ -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
@@ -1,4 +1,4 @@
|
|
1
|
-
# Natural Language V1
|
1
|
+
# Ruby Client for the Natural Language V1 API
|
2
2
|
|
3
3
|
API Client library for the Natural Language V1 API
|
4
4
|
|
@@ -12,6 +12,53 @@ https://github.com/googleapis/google-cloud-ruby
|
|
12
12
|
$ gem install google-cloud-language-v1
|
13
13
|
```
|
14
14
|
|
15
|
+
## Before You Begin
|
16
|
+
|
17
|
+
In order to use this library, you first need to go through the following steps:
|
18
|
+
|
19
|
+
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
20
|
+
1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
21
|
+
1. {file:AUTHENTICATION.md Set up authentication.}
|
22
|
+
|
23
|
+
## Quick Start
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require "google/cloud/language/v1"
|
27
|
+
|
28
|
+
client = ::Google::Cloud::Language::V1::LanguageService::Client.new
|
29
|
+
request = my_create_request
|
30
|
+
response = client.analyze_sentiment request
|
31
|
+
```
|
32
|
+
|
33
|
+
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-language-v1/latest)
|
34
|
+
for class and method documentation.
|
35
|
+
|
36
|
+
## Enabling Logging
|
37
|
+
|
38
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
39
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
|
40
|
+
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
41
|
+
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
42
|
+
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
43
|
+
|
44
|
+
Configuring a Ruby stdlib logger:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
require "logger"
|
48
|
+
|
49
|
+
module MyLogger
|
50
|
+
LOGGER = Logger.new $stderr, level: Logger::WARN
|
51
|
+
def logger
|
52
|
+
LOGGER
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
57
|
+
module GRPC
|
58
|
+
extend MyLogger
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
15
62
|
## Supported Ruby Versions
|
16
63
|
|
17
64
|
This library is supported on Ruby 2.4+.
|
@@ -1 +1,21 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/cloud/language/v1"
|
@@ -17,3 +17,19 @@
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
19
|
require "google/cloud/language/v1/language_service"
|
20
|
+
require "google/cloud/language/v1/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module Language
|
25
|
+
##
|
26
|
+
# To load this package, including all its services, and instantiate a client:
|
27
|
+
#
|
28
|
+
# require "google/cloud/language/v1"
|
29
|
+
# client = ::Google::Cloud::Language::V1::LanguageService::Client.new
|
30
|
+
#
|
31
|
+
module V1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -16,5 +16,34 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
|
-
require "
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/language/v1/version"
|
24
|
+
|
20
25
|
require "google/cloud/language/v1/language_service/credentials"
|
26
|
+
require "google/cloud/language/v1/language_service/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module Language
|
31
|
+
module V1
|
32
|
+
##
|
33
|
+
# Provides text analysis operations such as sentiment analysis and entity
|
34
|
+
# recognition.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/language/v1/language_service"
|
39
|
+
# client = ::Google::Cloud::Language::V1::LanguageService::Client.new
|
40
|
+
#
|
41
|
+
module LanguageService
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "language_service", "helpers.rb"
|
49
|
+
require "google/cloud/language/v1/language_service/helpers" if ::File.file? helper_path
|
@@ -16,14 +16,8 @@
|
|
16
16
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
|
-
require "gapic/common"
|
20
|
-
require "gapic/config"
|
21
|
-
require "gapic/config/method"
|
22
|
-
|
23
19
|
require "google/cloud/errors"
|
24
|
-
require "google/cloud/language/v1/version"
|
25
20
|
require "google/cloud/language/v1/language_service_pb"
|
26
|
-
require "google/cloud/language/v1/language_service/credentials"
|
27
21
|
|
28
22
|
module Google
|
29
23
|
module Cloud
|
@@ -43,15 +37,15 @@ module Google
|
|
43
37
|
##
|
44
38
|
# Configure the LanguageService Client class.
|
45
39
|
#
|
46
|
-
# See {Google::Cloud::Language::V1::LanguageService::Client::Configuration}
|
40
|
+
# See {::Google::Cloud::Language::V1::LanguageService::Client::Configuration}
|
47
41
|
# for a description of the configuration fields.
|
48
42
|
#
|
49
43
|
# ## Example
|
50
44
|
#
|
51
45
|
# To modify the configuration for all LanguageService clients:
|
52
46
|
#
|
53
|
-
# Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
|
54
|
-
# config.timeout =
|
47
|
+
# ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
55
49
|
# end
|
56
50
|
#
|
57
51
|
# @yield [config] Configure the Client client.
|
@@ -131,7 +125,7 @@ module Google
|
|
131
125
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
132
126
|
# should be made on {Client.configure}.
|
133
127
|
#
|
134
|
-
# See {Google::Cloud::Language::V1::LanguageService::Client::Configuration}
|
128
|
+
# See {::Google::Cloud::Language::V1::LanguageService::Client::Configuration}
|
135
129
|
# for a description of the configuration fields.
|
136
130
|
#
|
137
131
|
# @yield [config] Configure the Client client.
|
@@ -152,13 +146,13 @@ module Google
|
|
152
146
|
# To create a new LanguageService client with the default
|
153
147
|
# configuration:
|
154
148
|
#
|
155
|
-
# client = Google::Cloud::Language::V1::LanguageService::Client.new
|
149
|
+
# client = ::Google::Cloud::Language::V1::LanguageService::Client.new
|
156
150
|
#
|
157
151
|
# To create a new LanguageService client with a custom
|
158
152
|
# configuration:
|
159
153
|
#
|
160
|
-
# client = Google::Cloud::Language::V1::LanguageService::Client.new do |config|
|
161
|
-
# config.timeout =
|
154
|
+
# client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
|
155
|
+
# config.timeout = 10.0
|
162
156
|
# end
|
163
157
|
#
|
164
158
|
# @yield [config] Configure the LanguageService client.
|
@@ -183,10 +177,11 @@ module Google
|
|
183
177
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
184
178
|
credentials = Credentials.new credentials, scope: @config.scope
|
185
179
|
end
|
186
|
-
@quota_project_id =
|
180
|
+
@quota_project_id = @config.quota_project
|
181
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
187
182
|
|
188
|
-
@language_service_stub = Gapic::ServiceStub.new(
|
189
|
-
Google::Cloud::Language::V1::LanguageService::Stub,
|
183
|
+
@language_service_stub = ::Gapic::ServiceStub.new(
|
184
|
+
::Google::Cloud::Language::V1::LanguageService::Stub,
|
190
185
|
credentials: credentials,
|
191
186
|
endpoint: @config.endpoint,
|
192
187
|
channel_args: @config.channel_args,
|
@@ -200,39 +195,46 @@ module Google
|
|
200
195
|
# Analyzes the sentiment of the provided text.
|
201
196
|
#
|
202
197
|
# @overload analyze_sentiment(request, options = nil)
|
203
|
-
#
|
204
|
-
#
|
205
|
-
#
|
198
|
+
# Pass arguments to `analyze_sentiment` via a request object, either of type
|
199
|
+
# {::Google::Cloud::Language::V1::AnalyzeSentimentRequest} or an equivalent Hash.
|
200
|
+
#
|
201
|
+
# @param request [::Google::Cloud::Language::V1::AnalyzeSentimentRequest, ::Hash]
|
202
|
+
# A request object representing the call parameters. Required. To specify no
|
203
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
204
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
206
205
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
207
206
|
#
|
208
207
|
# @overload analyze_sentiment(document: nil, encoding_type: nil)
|
209
|
-
#
|
208
|
+
# Pass arguments to `analyze_sentiment` via keyword arguments. Note that at
|
209
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
210
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
211
|
+
#
|
212
|
+
# @param document [::Google::Cloud::Language::V1::Document, ::Hash]
|
210
213
|
# Input document.
|
211
|
-
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
214
|
+
# @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
|
212
215
|
# The encoding type used by the API to calculate sentence offsets.
|
213
216
|
#
|
214
|
-
#
|
215
217
|
# @yield [response, operation] Access the result along with the RPC operation
|
216
|
-
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeSentimentResponse]
|
217
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
218
|
+
# @yieldparam response [::Google::Cloud::Language::V1::AnalyzeSentimentResponse]
|
219
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
218
220
|
#
|
219
|
-
# @return [Google::Cloud::Language::V1::AnalyzeSentimentResponse]
|
221
|
+
# @return [::Google::Cloud::Language::V1::AnalyzeSentimentResponse]
|
220
222
|
#
|
221
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
223
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
222
224
|
#
|
223
225
|
def analyze_sentiment request, options = nil
|
224
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
226
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
225
227
|
|
226
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeSentimentRequest
|
228
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeSentimentRequest
|
227
229
|
|
228
230
|
# Converts hash and nil to an options object
|
229
|
-
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
|
230
232
|
|
231
233
|
# Customize the options with defaults
|
232
234
|
metadata = @config.rpcs.analyze_sentiment.metadata.to_h
|
233
235
|
|
234
236
|
# Set x-goog-api-client and x-goog-user-project headers
|
235
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
237
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
236
238
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
237
239
|
gapic_version: ::Google::Cloud::Language::V1::VERSION
|
238
240
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -247,8 +249,8 @@ module Google
|
|
247
249
|
yield response, operation if block_given?
|
248
250
|
return response
|
249
251
|
end
|
250
|
-
rescue GRPC::BadStatus => e
|
251
|
-
raise Google::Cloud::Error.from_error(e)
|
252
|
+
rescue ::GRPC::BadStatus => e
|
253
|
+
raise ::Google::Cloud::Error.from_error(e)
|
252
254
|
end
|
253
255
|
|
254
256
|
##
|
@@ -257,41 +259,46 @@ module Google
|
|
257
259
|
# other properties.
|
258
260
|
#
|
259
261
|
# @overload analyze_entities(request, options = nil)
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
#
|
262
|
+
# Pass arguments to `analyze_entities` via a request object, either of type
|
263
|
+
# {::Google::Cloud::Language::V1::AnalyzeEntitiesRequest} or an equivalent Hash.
|
264
|
+
#
|
265
|
+
# @param request [::Google::Cloud::Language::V1::AnalyzeEntitiesRequest, ::Hash]
|
266
|
+
# A request object representing the call parameters. Required. To specify no
|
267
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
268
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
265
269
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
266
270
|
#
|
267
271
|
# @overload analyze_entities(document: nil, encoding_type: nil)
|
268
|
-
#
|
272
|
+
# Pass arguments to `analyze_entities` via keyword arguments. Note that at
|
273
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
274
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
275
|
+
#
|
276
|
+
# @param document [::Google::Cloud::Language::V1::Document, ::Hash]
|
269
277
|
# Input document.
|
270
|
-
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
278
|
+
# @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
|
271
279
|
# The encoding type used by the API to calculate offsets.
|
272
280
|
#
|
273
|
-
#
|
274
281
|
# @yield [response, operation] Access the result along with the RPC operation
|
275
|
-
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
|
276
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
282
|
+
# @yieldparam response [::Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
|
283
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
277
284
|
#
|
278
|
-
# @return [Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
|
285
|
+
# @return [::Google::Cloud::Language::V1::AnalyzeEntitiesResponse]
|
279
286
|
#
|
280
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
287
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
281
288
|
#
|
282
289
|
def analyze_entities request, options = nil
|
283
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
290
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
284
291
|
|
285
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeEntitiesRequest
|
292
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeEntitiesRequest
|
286
293
|
|
287
294
|
# Converts hash and nil to an options object
|
288
|
-
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
|
289
296
|
|
290
297
|
# Customize the options with defaults
|
291
298
|
metadata = @config.rpcs.analyze_entities.metadata.to_h
|
292
299
|
|
293
300
|
# Set x-goog-api-client and x-goog-user-project headers
|
294
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
301
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
295
302
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
296
303
|
gapic_version: ::Google::Cloud::Language::V1::VERSION
|
297
304
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -306,49 +313,55 @@ module Google
|
|
306
313
|
yield response, operation if block_given?
|
307
314
|
return response
|
308
315
|
end
|
309
|
-
rescue GRPC::BadStatus => e
|
310
|
-
raise Google::Cloud::Error.from_error(e)
|
316
|
+
rescue ::GRPC::BadStatus => e
|
317
|
+
raise ::Google::Cloud::Error.from_error(e)
|
311
318
|
end
|
312
319
|
|
313
320
|
##
|
314
|
-
# 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
|
315
322
|
# sentiment associated with each entity and its mentions.
|
316
323
|
#
|
317
324
|
# @overload analyze_entity_sentiment(request, options = nil)
|
318
|
-
#
|
319
|
-
#
|
320
|
-
#
|
321
|
-
# @param
|
325
|
+
# Pass arguments to `analyze_entity_sentiment` via a request object, either of type
|
326
|
+
# {::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest} or an equivalent Hash.
|
327
|
+
#
|
328
|
+
# @param request [::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest, ::Hash]
|
329
|
+
# A request object representing the call parameters. Required. To specify no
|
330
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
331
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
322
332
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
323
333
|
#
|
324
334
|
# @overload analyze_entity_sentiment(document: nil, encoding_type: nil)
|
325
|
-
#
|
335
|
+
# Pass arguments to `analyze_entity_sentiment` via keyword arguments. Note that at
|
336
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
337
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
338
|
+
#
|
339
|
+
# @param document [::Google::Cloud::Language::V1::Document, ::Hash]
|
326
340
|
# Input document.
|
327
|
-
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
341
|
+
# @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
|
328
342
|
# The encoding type used by the API to calculate offsets.
|
329
343
|
#
|
330
|
-
#
|
331
344
|
# @yield [response, operation] Access the result along with the RPC operation
|
332
|
-
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
|
333
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
345
|
+
# @yieldparam response [::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
|
346
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
334
347
|
#
|
335
|
-
# @return [Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
|
348
|
+
# @return [::Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse]
|
336
349
|
#
|
337
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
350
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
338
351
|
#
|
339
352
|
def analyze_entity_sentiment request, options = nil
|
340
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
353
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
341
354
|
|
342
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest
|
355
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest
|
343
356
|
|
344
357
|
# Converts hash and nil to an options object
|
345
|
-
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
|
346
359
|
|
347
360
|
# Customize the options with defaults
|
348
361
|
metadata = @config.rpcs.analyze_entity_sentiment.metadata.to_h
|
349
362
|
|
350
363
|
# Set x-goog-api-client and x-goog-user-project headers
|
351
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
364
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
352
365
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
353
366
|
gapic_version: ::Google::Cloud::Language::V1::VERSION
|
354
367
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -363,8 +376,8 @@ module Google
|
|
363
376
|
yield response, operation if block_given?
|
364
377
|
return response
|
365
378
|
end
|
366
|
-
rescue GRPC::BadStatus => e
|
367
|
-
raise Google::Cloud::Error.from_error(e)
|
379
|
+
rescue ::GRPC::BadStatus => e
|
380
|
+
raise ::Google::Cloud::Error.from_error(e)
|
368
381
|
end
|
369
382
|
|
370
383
|
##
|
@@ -373,41 +386,46 @@ module Google
|
|
373
386
|
# properties.
|
374
387
|
#
|
375
388
|
# @overload analyze_syntax(request, options = nil)
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
389
|
+
# Pass arguments to `analyze_syntax` via a request object, either of type
|
390
|
+
# {::Google::Cloud::Language::V1::AnalyzeSyntaxRequest} or an equivalent Hash.
|
391
|
+
#
|
392
|
+
# @param request [::Google::Cloud::Language::V1::AnalyzeSyntaxRequest, ::Hash]
|
393
|
+
# A request object representing the call parameters. Required. To specify no
|
394
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
395
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
381
396
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
382
397
|
#
|
383
398
|
# @overload analyze_syntax(document: nil, encoding_type: nil)
|
384
|
-
#
|
399
|
+
# Pass arguments to `analyze_syntax` via keyword arguments. Note that at
|
400
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
401
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
402
|
+
#
|
403
|
+
# @param document [::Google::Cloud::Language::V1::Document, ::Hash]
|
385
404
|
# Input document.
|
386
|
-
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
405
|
+
# @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
|
387
406
|
# The encoding type used by the API to calculate offsets.
|
388
407
|
#
|
389
|
-
#
|
390
408
|
# @yield [response, operation] Access the result along with the RPC operation
|
391
|
-
# @yieldparam response [Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
|
392
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
409
|
+
# @yieldparam response [::Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
|
410
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
393
411
|
#
|
394
|
-
# @return [Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
|
412
|
+
# @return [::Google::Cloud::Language::V1::AnalyzeSyntaxResponse]
|
395
413
|
#
|
396
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
414
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
397
415
|
#
|
398
416
|
def analyze_syntax request, options = nil
|
399
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
417
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
400
418
|
|
401
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnalyzeSyntaxRequest
|
419
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnalyzeSyntaxRequest
|
402
420
|
|
403
421
|
# Converts hash and nil to an options object
|
404
|
-
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
|
405
423
|
|
406
424
|
# Customize the options with defaults
|
407
425
|
metadata = @config.rpcs.analyze_syntax.metadata.to_h
|
408
426
|
|
409
427
|
# Set x-goog-api-client and x-goog-user-project headers
|
410
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
428
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
411
429
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
412
430
|
gapic_version: ::Google::Cloud::Language::V1::VERSION
|
413
431
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -422,45 +440,52 @@ module Google
|
|
422
440
|
yield response, operation if block_given?
|
423
441
|
return response
|
424
442
|
end
|
425
|
-
rescue GRPC::BadStatus => e
|
426
|
-
raise Google::Cloud::Error.from_error(e)
|
443
|
+
rescue ::GRPC::BadStatus => e
|
444
|
+
raise ::Google::Cloud::Error.from_error(e)
|
427
445
|
end
|
428
446
|
|
429
447
|
##
|
430
448
|
# Classifies a document into categories.
|
431
449
|
#
|
432
450
|
# @overload classify_text(request, options = nil)
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
451
|
+
# Pass arguments to `classify_text` via a request object, either of type
|
452
|
+
# {::Google::Cloud::Language::V1::ClassifyTextRequest} or an equivalent Hash.
|
453
|
+
#
|
454
|
+
# @param request [::Google::Cloud::Language::V1::ClassifyTextRequest, ::Hash]
|
455
|
+
# A request object representing the call parameters. Required. To specify no
|
456
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
457
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
436
458
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
437
459
|
#
|
438
460
|
# @overload classify_text(document: nil)
|
439
|
-
#
|
440
|
-
#
|
461
|
+
# Pass arguments to `classify_text` via keyword arguments. Note that at
|
462
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
463
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
441
464
|
#
|
465
|
+
# @param document [::Google::Cloud::Language::V1::Document, ::Hash]
|
466
|
+
# Input document.
|
442
467
|
#
|
443
468
|
# @yield [response, operation] Access the result along with the RPC operation
|
444
|
-
# @yieldparam response [Google::Cloud::Language::V1::ClassifyTextResponse]
|
445
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
469
|
+
# @yieldparam response [::Google::Cloud::Language::V1::ClassifyTextResponse]
|
470
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
446
471
|
#
|
447
|
-
# @return [Google::Cloud::Language::V1::ClassifyTextResponse]
|
472
|
+
# @return [::Google::Cloud::Language::V1::ClassifyTextResponse]
|
448
473
|
#
|
449
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
474
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
450
475
|
#
|
451
476
|
def classify_text request, options = nil
|
452
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
477
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
453
478
|
|
454
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::ClassifyTextRequest
|
479
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::ClassifyTextRequest
|
455
480
|
|
456
481
|
# Converts hash and nil to an options object
|
457
|
-
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
|
458
483
|
|
459
484
|
# Customize the options with defaults
|
460
485
|
metadata = @config.rpcs.classify_text.metadata.to_h
|
461
486
|
|
462
487
|
# Set x-goog-api-client and x-goog-user-project headers
|
463
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
488
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
464
489
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
465
490
|
gapic_version: ::Google::Cloud::Language::V1::VERSION
|
466
491
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -475,8 +500,8 @@ module Google
|
|
475
500
|
yield response, operation if block_given?
|
476
501
|
return response
|
477
502
|
end
|
478
|
-
rescue GRPC::BadStatus => e
|
479
|
-
raise Google::Cloud::Error.from_error(e)
|
503
|
+
rescue ::GRPC::BadStatus => e
|
504
|
+
raise ::Google::Cloud::Error.from_error(e)
|
480
505
|
end
|
481
506
|
|
482
507
|
##
|
@@ -484,42 +509,48 @@ module Google
|
|
484
509
|
# analyzeEntities, and analyzeSyntax provide in one call.
|
485
510
|
#
|
486
511
|
# @overload annotate_text(request, options = nil)
|
487
|
-
#
|
488
|
-
#
|
489
|
-
#
|
490
|
-
# @param
|
512
|
+
# Pass arguments to `annotate_text` via a request object, either of type
|
513
|
+
# {::Google::Cloud::Language::V1::AnnotateTextRequest} or an equivalent Hash.
|
514
|
+
#
|
515
|
+
# @param request [::Google::Cloud::Language::V1::AnnotateTextRequest, ::Hash]
|
516
|
+
# A request object representing the call parameters. Required. To specify no
|
517
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
518
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
491
519
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
492
520
|
#
|
493
521
|
# @overload annotate_text(document: nil, features: nil, encoding_type: nil)
|
494
|
-
#
|
522
|
+
# Pass arguments to `annotate_text` via keyword arguments. Note that at
|
523
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
524
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
525
|
+
#
|
526
|
+
# @param document [::Google::Cloud::Language::V1::Document, ::Hash]
|
495
527
|
# Input document.
|
496
|
-
# @param features [Google::Cloud::Language::V1::AnnotateTextRequest::Features
|
528
|
+
# @param features [::Google::Cloud::Language::V1::AnnotateTextRequest::Features, ::Hash]
|
497
529
|
# The enabled features.
|
498
|
-
# @param encoding_type [Google::Cloud::Language::V1::EncodingType]
|
530
|
+
# @param encoding_type [::Google::Cloud::Language::V1::EncodingType]
|
499
531
|
# The encoding type used by the API to calculate offsets.
|
500
532
|
#
|
501
|
-
#
|
502
533
|
# @yield [response, operation] Access the result along with the RPC operation
|
503
|
-
# @yieldparam response [Google::Cloud::Language::V1::AnnotateTextResponse]
|
504
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
534
|
+
# @yieldparam response [::Google::Cloud::Language::V1::AnnotateTextResponse]
|
535
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
505
536
|
#
|
506
|
-
# @return [Google::Cloud::Language::V1::AnnotateTextResponse]
|
537
|
+
# @return [::Google::Cloud::Language::V1::AnnotateTextResponse]
|
507
538
|
#
|
508
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
539
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
509
540
|
#
|
510
541
|
def annotate_text request, options = nil
|
511
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
542
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
512
543
|
|
513
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1::AnnotateTextRequest
|
544
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1::AnnotateTextRequest
|
514
545
|
|
515
546
|
# Converts hash and nil to an options object
|
516
|
-
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
|
517
548
|
|
518
549
|
# Customize the options with defaults
|
519
550
|
metadata = @config.rpcs.annotate_text.metadata.to_h
|
520
551
|
|
521
552
|
# Set x-goog-api-client and x-goog-user-project headers
|
522
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
553
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
523
554
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
524
555
|
gapic_version: ::Google::Cloud::Language::V1::VERSION
|
525
556
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -534,8 +565,8 @@ module Google
|
|
534
565
|
yield response, operation if block_given?
|
535
566
|
return response
|
536
567
|
end
|
537
|
-
rescue GRPC::BadStatus => e
|
538
|
-
raise Google::Cloud::Error.from_error(e)
|
568
|
+
rescue ::GRPC::BadStatus => e
|
569
|
+
raise ::Google::Cloud::Error.from_error(e)
|
539
570
|
end
|
540
571
|
|
541
572
|
##
|
@@ -545,7 +576,7 @@ module Google
|
|
545
576
|
# providing control over timeouts, retry behavior, logging, transport
|
546
577
|
# parameters, and other low-level controls. Certain parameters can also be
|
547
578
|
# applied individually to specific RPCs. See
|
548
|
-
# {Google::Cloud::Language::V1::LanguageService::Client::Configuration::Rpcs}
|
579
|
+
# {::Google::Cloud::Language::V1::LanguageService::Client::Configuration::Rpcs}
|
549
580
|
# for a list of RPCs that can be configured independently.
|
550
581
|
#
|
551
582
|
# Configuration can be applied globally to all clients, or to a single client
|
@@ -556,22 +587,22 @@ module Google
|
|
556
587
|
# To modify the global config, setting the timeout for analyze_sentiment
|
557
588
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
558
589
|
#
|
559
|
-
# Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
|
560
|
-
# config.timeout =
|
561
|
-
# config.rpcs.analyze_sentiment.timeout =
|
590
|
+
# ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
|
591
|
+
# config.timeout = 10.0
|
592
|
+
# config.rpcs.analyze_sentiment.timeout = 20.0
|
562
593
|
# end
|
563
594
|
#
|
564
595
|
# To apply the above configuration only to a new client:
|
565
596
|
#
|
566
|
-
# client = Google::Cloud::Language::V1::LanguageService::Client.new do |config|
|
567
|
-
# config.timeout =
|
568
|
-
# config.rpcs.analyze_sentiment.timeout =
|
597
|
+
# client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
|
598
|
+
# config.timeout = 10.0
|
599
|
+
# config.rpcs.analyze_sentiment.timeout = 20.0
|
569
600
|
# end
|
570
601
|
#
|
571
602
|
# @!attribute [rw] endpoint
|
572
603
|
# The hostname or hostname:port of the service endpoint.
|
573
604
|
# Defaults to `"language.googleapis.com"`.
|
574
|
-
# @return [String]
|
605
|
+
# @return [::String]
|
575
606
|
# @!attribute [rw] credentials
|
576
607
|
# Credentials to send with calls. You may provide any of the following types:
|
577
608
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -583,29 +614,29 @@ module Google
|
|
583
614
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
584
615
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
585
616
|
# * (`nil`) indicating no credentials
|
586
|
-
# @return [Object]
|
617
|
+
# @return [::Object]
|
587
618
|
# @!attribute [rw] scope
|
588
619
|
# The OAuth scopes
|
589
|
-
# @return [Array
|
620
|
+
# @return [::Array<::String>]
|
590
621
|
# @!attribute [rw] lib_name
|
591
622
|
# The library name as recorded in instrumentation and logging
|
592
|
-
# @return [String]
|
623
|
+
# @return [::String]
|
593
624
|
# @!attribute [rw] lib_version
|
594
625
|
# The library version as recorded in instrumentation and logging
|
595
|
-
# @return [String]
|
626
|
+
# @return [::String]
|
596
627
|
# @!attribute [rw] channel_args
|
597
628
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
598
629
|
# `GRPC::Core::Channel` object is provided as the credential.
|
599
|
-
# @return [Hash]
|
630
|
+
# @return [::Hash]
|
600
631
|
# @!attribute [rw] interceptors
|
601
632
|
# An array of interceptors that are run before calls are executed.
|
602
|
-
# @return [Array
|
633
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
603
634
|
# @!attribute [rw] timeout
|
604
|
-
# The call timeout in
|
605
|
-
# @return [Numeric]
|
635
|
+
# The call timeout in seconds.
|
636
|
+
# @return [::Numeric]
|
606
637
|
# @!attribute [rw] metadata
|
607
638
|
# Additional gRPC headers to be sent with the call.
|
608
|
-
# @return [Hash{Symbol
|
639
|
+
# @return [::Hash{::Symbol=>::String}]
|
609
640
|
# @!attribute [rw] retry_policy
|
610
641
|
# The retry policy. The value is a hash with the following keys:
|
611
642
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
@@ -613,25 +644,29 @@ module Google
|
|
613
644
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
614
645
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
615
646
|
# trigger a retry.
|
616
|
-
# @return [Hash]
|
647
|
+
# @return [::Hash]
|
648
|
+
# @!attribute [rw] quota_project
|
649
|
+
# A separate project against which to charge quota.
|
650
|
+
# @return [::String]
|
617
651
|
#
|
618
652
|
class Configuration
|
619
|
-
extend Gapic::Config
|
653
|
+
extend ::Gapic::Config
|
620
654
|
|
621
|
-
config_attr :endpoint,
|
622
|
-
config_attr :credentials,
|
655
|
+
config_attr :endpoint, "language.googleapis.com", ::String
|
656
|
+
config_attr :credentials, nil do |value|
|
623
657
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
624
658
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
625
659
|
allowed.any? { |klass| klass === value }
|
626
660
|
end
|
627
|
-
config_attr :scope,
|
628
|
-
config_attr :lib_name,
|
629
|
-
config_attr :lib_version,
|
630
|
-
config_attr(:channel_args,
|
631
|
-
config_attr :interceptors,
|
632
|
-
config_attr :timeout,
|
633
|
-
config_attr :metadata,
|
634
|
-
config_attr :retry_policy,
|
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
|
635
670
|
|
636
671
|
# @private
|
637
672
|
def initialize parent_config = nil
|
@@ -647,7 +682,7 @@ module Google
|
|
647
682
|
def rpcs
|
648
683
|
@rpcs ||= begin
|
649
684
|
parent_rpcs = nil
|
650
|
-
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to?
|
685
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
651
686
|
Rpcs.new parent_rpcs
|
652
687
|
end
|
653
688
|
end
|
@@ -672,49 +707,49 @@ module Google
|
|
672
707
|
class Rpcs
|
673
708
|
##
|
674
709
|
# RPC-specific configuration for `analyze_sentiment`
|
675
|
-
# @return [Gapic::Config::Method]
|
710
|
+
# @return [::Gapic::Config::Method]
|
676
711
|
#
|
677
712
|
attr_reader :analyze_sentiment
|
678
713
|
##
|
679
714
|
# RPC-specific configuration for `analyze_entities`
|
680
|
-
# @return [Gapic::Config::Method]
|
715
|
+
# @return [::Gapic::Config::Method]
|
681
716
|
#
|
682
717
|
attr_reader :analyze_entities
|
683
718
|
##
|
684
719
|
# RPC-specific configuration for `analyze_entity_sentiment`
|
685
|
-
# @return [Gapic::Config::Method]
|
720
|
+
# @return [::Gapic::Config::Method]
|
686
721
|
#
|
687
722
|
attr_reader :analyze_entity_sentiment
|
688
723
|
##
|
689
724
|
# RPC-specific configuration for `analyze_syntax`
|
690
|
-
# @return [Gapic::Config::Method]
|
725
|
+
# @return [::Gapic::Config::Method]
|
691
726
|
#
|
692
727
|
attr_reader :analyze_syntax
|
693
728
|
##
|
694
729
|
# RPC-specific configuration for `classify_text`
|
695
|
-
# @return [Gapic::Config::Method]
|
730
|
+
# @return [::Gapic::Config::Method]
|
696
731
|
#
|
697
732
|
attr_reader :classify_text
|
698
733
|
##
|
699
734
|
# RPC-specific configuration for `annotate_text`
|
700
|
-
# @return [Gapic::Config::Method]
|
735
|
+
# @return [::Gapic::Config::Method]
|
701
736
|
#
|
702
737
|
attr_reader :annotate_text
|
703
738
|
|
704
739
|
# @private
|
705
740
|
def initialize parent_rpcs = nil
|
706
741
|
analyze_sentiment_config = parent_rpcs&.analyze_sentiment if parent_rpcs&.respond_to? :analyze_sentiment
|
707
|
-
@analyze_sentiment = Gapic::Config::Method.new analyze_sentiment_config
|
742
|
+
@analyze_sentiment = ::Gapic::Config::Method.new analyze_sentiment_config
|
708
743
|
analyze_entities_config = parent_rpcs&.analyze_entities if parent_rpcs&.respond_to? :analyze_entities
|
709
|
-
@analyze_entities = Gapic::Config::Method.new analyze_entities_config
|
744
|
+
@analyze_entities = ::Gapic::Config::Method.new analyze_entities_config
|
710
745
|
analyze_entity_sentiment_config = parent_rpcs&.analyze_entity_sentiment if parent_rpcs&.respond_to? :analyze_entity_sentiment
|
711
|
-
@analyze_entity_sentiment = Gapic::Config::Method.new analyze_entity_sentiment_config
|
746
|
+
@analyze_entity_sentiment = ::Gapic::Config::Method.new analyze_entity_sentiment_config
|
712
747
|
analyze_syntax_config = parent_rpcs&.analyze_syntax if parent_rpcs&.respond_to? :analyze_syntax
|
713
|
-
@analyze_syntax = Gapic::Config::Method.new analyze_syntax_config
|
748
|
+
@analyze_syntax = ::Gapic::Config::Method.new analyze_syntax_config
|
714
749
|
classify_text_config = parent_rpcs&.classify_text if parent_rpcs&.respond_to? :classify_text
|
715
|
-
@classify_text = Gapic::Config::Method.new classify_text_config
|
750
|
+
@classify_text = ::Gapic::Config::Method.new classify_text_config
|
716
751
|
annotate_text_config = parent_rpcs&.annotate_text if parent_rpcs&.respond_to? :annotate_text
|
717
|
-
@annotate_text = Gapic::Config::Method.new annotate_text_config
|
752
|
+
@annotate_text = ::Gapic::Config::Method.new annotate_text_config
|
718
753
|
|
719
754
|
yield self if block_given?
|
720
755
|
end
|
@@ -726,13 +761,3 @@ module Google
|
|
726
761
|
end
|
727
762
|
end
|
728
763
|
end
|
729
|
-
|
730
|
-
# rubocop:disable Lint/HandleExceptions
|
731
|
-
|
732
|
-
# Once client is loaded, load helpers.rb if it exists.
|
733
|
-
begin
|
734
|
-
require "google/cloud/language/v1/language_service/helpers"
|
735
|
-
rescue LoadError
|
736
|
-
end
|
737
|
-
|
738
|
-
# rubocop:enable Lint/HandleExceptions
|