google-cloud-language-v1beta2 0.1.3 → 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-v1beta2.rb +21 -1
- data/lib/google/cloud/language/v1beta2.rb +16 -0
- data/lib/google/cloud/language/v1beta2/language_service.rb +30 -1
- data/lib/google/cloud/language/v1beta2/language_service/client.rb +196 -171
- data/lib/google/cloud/language/v1beta2/language_service/credentials.rb +1 -1
- data/lib/google/cloud/language/v1beta2/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/language/v1beta2/language_service.rb +136 -136
- data/proto_docs/google/protobuf/timestamp.rb +4 -4
- 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: c16f5acce31fabbbc4dac36eabf3004b9016a9ffcedbfdd1434fe46576164677
|
4
|
+
data.tar.gz: ee32dc3f2a70c0a6b2469b5af9298da82c83ede79780903cdf182be99d4bc33b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18034c98eb61a06cd670dd268051a332220f333f3ee9774d2380e709b9a30194a4fb3be03bbdfe1249a80509d35a82262c59041daf18b1b6fc4321a7ca0efdf
|
7
|
+
data.tar.gz: 37eed126c9ad1784868d8e18e03595f6ad0861a13f7a2ee0856c608232c29888c9948ae811733347c67f3d81e61c178eb9edcfeb6cc8dc07681bfdbd69df86e2
|
data/AUTHENTICATION.md
CHANGED
@@ -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
@@ -1,4 +1,4 @@
|
|
1
|
-
# Natural Language V1beta2
|
1
|
+
# Ruby Client for the Natural Language V1beta2 API
|
2
2
|
|
3
3
|
API Client library for the Natural Language V1beta2 API
|
4
4
|
|
@@ -12,6 +12,53 @@ https://github.com/googleapis/google-cloud-ruby
|
|
12
12
|
$ gem install google-cloud-language-v1beta2
|
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/v1beta2"
|
27
|
+
|
28
|
+
client = ::Google::Cloud::Language::V1beta2::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-v1beta2/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/v1beta2"
|
@@ -17,3 +17,19 @@
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
18
|
|
19
19
|
require "google/cloud/language/v1beta2/language_service"
|
20
|
+
require "google/cloud/language/v1beta2/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/v1beta2"
|
29
|
+
# client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new
|
30
|
+
#
|
31
|
+
module V1beta2
|
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/v1beta2/version"
|
24
|
+
|
20
25
|
require "google/cloud/language/v1beta2/language_service/credentials"
|
26
|
+
require "google/cloud/language/v1beta2/language_service/client"
|
27
|
+
|
28
|
+
module Google
|
29
|
+
module Cloud
|
30
|
+
module Language
|
31
|
+
module V1beta2
|
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/v1beta2/language_service"
|
39
|
+
# client = ::Google::Cloud::Language::V1beta2::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/v1beta2/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/v1beta2/version"
|
25
20
|
require "google/cloud/language/v1beta2/language_service_pb"
|
26
|
-
require "google/cloud/language/v1beta2/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::V1beta2::LanguageService::Client::Configuration}
|
40
|
+
# See {::Google::Cloud::Language::V1beta2::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::V1beta2::LanguageService::Client.configure do |config|
|
54
|
-
# config.timeout =
|
47
|
+
# ::Google::Cloud::Language::V1beta2::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::V1beta2::LanguageService::Client::Configuration}
|
128
|
+
# See {::Google::Cloud::Language::V1beta2::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::V1beta2::LanguageService::Client.new
|
149
|
+
# client = ::Google::Cloud::Language::V1beta2::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::V1beta2::LanguageService::Client.new do |config|
|
161
|
-
# config.timeout =
|
154
|
+
# client = ::Google::Cloud::Language::V1beta2::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::V1beta2::LanguageService::Stub,
|
183
|
+
@language_service_stub = ::Gapic::ServiceStub.new(
|
184
|
+
::Google::Cloud::Language::V1beta2::LanguageService::Stub,
|
190
185
|
credentials: credentials,
|
191
186
|
endpoint: @config.endpoint,
|
192
187
|
channel_args: @config.channel_args,
|
@@ -200,40 +195,47 @@ 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::V1beta2::AnalyzeSentimentRequest} or an equivalent Hash.
|
200
|
+
#
|
201
|
+
# @param request [::Google::Cloud::Language::V1beta2::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::V1beta2::Document, ::Hash]
|
210
213
|
# Required. Input document.
|
211
|
-
# @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
|
214
|
+
# @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
|
212
215
|
# The encoding type used by the API to calculate sentence offsets for the
|
213
216
|
# sentence sentiment.
|
214
217
|
#
|
215
|
-
#
|
216
218
|
# @yield [response, operation] Access the result along with the RPC operation
|
217
|
-
# @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
|
218
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
219
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
|
220
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
219
221
|
#
|
220
|
-
# @return [Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
|
222
|
+
# @return [::Google::Cloud::Language::V1beta2::AnalyzeSentimentResponse]
|
221
223
|
#
|
222
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
224
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
223
225
|
#
|
224
226
|
def analyze_sentiment request, options = nil
|
225
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
227
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
226
228
|
|
227
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest
|
229
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeSentimentRequest
|
228
230
|
|
229
231
|
# Converts hash and nil to an options object
|
230
|
-
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
|
231
233
|
|
232
234
|
# Customize the options with defaults
|
233
235
|
metadata = @config.rpcs.analyze_sentiment.metadata.to_h
|
234
236
|
|
235
237
|
# Set x-goog-api-client and x-goog-user-project headers
|
236
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
238
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
237
239
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
238
240
|
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
239
241
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -248,8 +250,8 @@ module Google
|
|
248
250
|
yield response, operation if block_given?
|
249
251
|
return response
|
250
252
|
end
|
251
|
-
rescue GRPC::BadStatus => e
|
252
|
-
raise Google::Cloud::Error.from_error(e)
|
253
|
+
rescue ::GRPC::BadStatus => e
|
254
|
+
raise ::Google::Cloud::Error.from_error(e)
|
253
255
|
end
|
254
256
|
|
255
257
|
##
|
@@ -258,41 +260,46 @@ module Google
|
|
258
260
|
# other properties.
|
259
261
|
#
|
260
262
|
# @overload analyze_entities(request, options = nil)
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
#
|
265
|
-
#
|
263
|
+
# Pass arguments to `analyze_entities` via a request object, either of type
|
264
|
+
# {::Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest} or an equivalent Hash.
|
265
|
+
#
|
266
|
+
# @param request [::Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest, ::Hash]
|
267
|
+
# A request object representing the call parameters. Required. To specify no
|
268
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
269
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
266
270
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
267
271
|
#
|
268
272
|
# @overload analyze_entities(document: nil, encoding_type: nil)
|
269
|
-
#
|
273
|
+
# Pass arguments to `analyze_entities` via keyword arguments. Note that at
|
274
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
275
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
276
|
+
#
|
277
|
+
# @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
|
270
278
|
# Required. Input document.
|
271
|
-
# @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
|
279
|
+
# @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
|
272
280
|
# The encoding type used by the API to calculate offsets.
|
273
281
|
#
|
274
|
-
#
|
275
282
|
# @yield [response, operation] Access the result along with the RPC operation
|
276
|
-
# @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
|
277
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
283
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
|
284
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
278
285
|
#
|
279
|
-
# @return [Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
|
286
|
+
# @return [::Google::Cloud::Language::V1beta2::AnalyzeEntitiesResponse]
|
280
287
|
#
|
281
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
288
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
282
289
|
#
|
283
290
|
def analyze_entities request, options = nil
|
284
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
291
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
285
292
|
|
286
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest
|
293
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeEntitiesRequest
|
287
294
|
|
288
295
|
# Converts hash and nil to an options object
|
289
|
-
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
|
290
297
|
|
291
298
|
# Customize the options with defaults
|
292
299
|
metadata = @config.rpcs.analyze_entities.metadata.to_h
|
293
300
|
|
294
301
|
# Set x-goog-api-client and x-goog-user-project headers
|
295
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
302
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
296
303
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
297
304
|
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
298
305
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -307,49 +314,55 @@ module Google
|
|
307
314
|
yield response, operation if block_given?
|
308
315
|
return response
|
309
316
|
end
|
310
|
-
rescue GRPC::BadStatus => e
|
311
|
-
raise Google::Cloud::Error.from_error(e)
|
317
|
+
rescue ::GRPC::BadStatus => e
|
318
|
+
raise ::Google::Cloud::Error.from_error(e)
|
312
319
|
end
|
313
320
|
|
314
321
|
##
|
315
|
-
# 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
|
316
323
|
# sentiment associated with each entity and its mentions.
|
317
324
|
#
|
318
325
|
# @overload analyze_entity_sentiment(request, options = nil)
|
319
|
-
#
|
320
|
-
#
|
321
|
-
#
|
322
|
-
# @param
|
326
|
+
# Pass arguments to `analyze_entity_sentiment` via a request object, either of type
|
327
|
+
# {::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest} or an equivalent Hash.
|
328
|
+
#
|
329
|
+
# @param request [::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest, ::Hash]
|
330
|
+
# A request object representing the call parameters. Required. To specify no
|
331
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
332
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
323
333
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
324
334
|
#
|
325
335
|
# @overload analyze_entity_sentiment(document: nil, encoding_type: nil)
|
326
|
-
#
|
336
|
+
# Pass arguments to `analyze_entity_sentiment` via keyword arguments. Note that at
|
337
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
338
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
339
|
+
#
|
340
|
+
# @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
|
327
341
|
# Required. Input document.
|
328
|
-
# @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
|
342
|
+
# @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
|
329
343
|
# The encoding type used by the API to calculate offsets.
|
330
344
|
#
|
331
|
-
#
|
332
345
|
# @yield [response, operation] Access the result along with the RPC operation
|
333
|
-
# @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
|
334
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
346
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
|
347
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
335
348
|
#
|
336
|
-
# @return [Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
|
349
|
+
# @return [::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentResponse]
|
337
350
|
#
|
338
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
351
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
339
352
|
#
|
340
353
|
def analyze_entity_sentiment request, options = nil
|
341
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
354
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
342
355
|
|
343
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest
|
356
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeEntitySentimentRequest
|
344
357
|
|
345
358
|
# Converts hash and nil to an options object
|
346
|
-
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
|
347
360
|
|
348
361
|
# Customize the options with defaults
|
349
362
|
metadata = @config.rpcs.analyze_entity_sentiment.metadata.to_h
|
350
363
|
|
351
364
|
# Set x-goog-api-client and x-goog-user-project headers
|
352
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
365
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
353
366
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
354
367
|
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
355
368
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -364,8 +377,8 @@ module Google
|
|
364
377
|
yield response, operation if block_given?
|
365
378
|
return response
|
366
379
|
end
|
367
|
-
rescue GRPC::BadStatus => e
|
368
|
-
raise Google::Cloud::Error.from_error(e)
|
380
|
+
rescue ::GRPC::BadStatus => e
|
381
|
+
raise ::Google::Cloud::Error.from_error(e)
|
369
382
|
end
|
370
383
|
|
371
384
|
##
|
@@ -374,41 +387,46 @@ module Google
|
|
374
387
|
# properties.
|
375
388
|
#
|
376
389
|
# @overload analyze_syntax(request, options = nil)
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
381
|
-
#
|
390
|
+
# Pass arguments to `analyze_syntax` via a request object, either of type
|
391
|
+
# {::Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest} or an equivalent Hash.
|
392
|
+
#
|
393
|
+
# @param request [::Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest, ::Hash]
|
394
|
+
# A request object representing the call parameters. Required. To specify no
|
395
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
396
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
382
397
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
383
398
|
#
|
384
399
|
# @overload analyze_syntax(document: nil, encoding_type: nil)
|
385
|
-
#
|
400
|
+
# Pass arguments to `analyze_syntax` via keyword arguments. Note that at
|
401
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
402
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
403
|
+
#
|
404
|
+
# @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
|
386
405
|
# Required. Input document.
|
387
|
-
# @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
|
406
|
+
# @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
|
388
407
|
# The encoding type used by the API to calculate offsets.
|
389
408
|
#
|
390
|
-
#
|
391
409
|
# @yield [response, operation] Access the result along with the RPC operation
|
392
|
-
# @yieldparam response [Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
|
393
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
410
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
|
411
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
394
412
|
#
|
395
|
-
# @return [Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
|
413
|
+
# @return [::Google::Cloud::Language::V1beta2::AnalyzeSyntaxResponse]
|
396
414
|
#
|
397
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
415
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
398
416
|
#
|
399
417
|
def analyze_syntax request, options = nil
|
400
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
418
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
401
419
|
|
402
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest
|
420
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnalyzeSyntaxRequest
|
403
421
|
|
404
422
|
# Converts hash and nil to an options object
|
405
|
-
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
|
406
424
|
|
407
425
|
# Customize the options with defaults
|
408
426
|
metadata = @config.rpcs.analyze_syntax.metadata.to_h
|
409
427
|
|
410
428
|
# Set x-goog-api-client and x-goog-user-project headers
|
411
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
429
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
412
430
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
413
431
|
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
414
432
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -423,45 +441,52 @@ module Google
|
|
423
441
|
yield response, operation if block_given?
|
424
442
|
return response
|
425
443
|
end
|
426
|
-
rescue GRPC::BadStatus => e
|
427
|
-
raise Google::Cloud::Error.from_error(e)
|
444
|
+
rescue ::GRPC::BadStatus => e
|
445
|
+
raise ::Google::Cloud::Error.from_error(e)
|
428
446
|
end
|
429
447
|
|
430
448
|
##
|
431
449
|
# Classifies a document into categories.
|
432
450
|
#
|
433
451
|
# @overload classify_text(request, options = nil)
|
434
|
-
#
|
435
|
-
#
|
436
|
-
#
|
452
|
+
# Pass arguments to `classify_text` via a request object, either of type
|
453
|
+
# {::Google::Cloud::Language::V1beta2::ClassifyTextRequest} or an equivalent Hash.
|
454
|
+
#
|
455
|
+
# @param request [::Google::Cloud::Language::V1beta2::ClassifyTextRequest, ::Hash]
|
456
|
+
# A request object representing the call parameters. Required. To specify no
|
457
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
458
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
437
459
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
438
460
|
#
|
439
461
|
# @overload classify_text(document: nil)
|
440
|
-
#
|
441
|
-
#
|
462
|
+
# Pass arguments to `classify_text` via keyword arguments. Note that at
|
463
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
464
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
442
465
|
#
|
466
|
+
# @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
|
467
|
+
# Required. Input document.
|
443
468
|
#
|
444
469
|
# @yield [response, operation] Access the result along with the RPC operation
|
445
|
-
# @yieldparam response [Google::Cloud::Language::V1beta2::ClassifyTextResponse]
|
446
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
470
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::ClassifyTextResponse]
|
471
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
447
472
|
#
|
448
|
-
# @return [Google::Cloud::Language::V1beta2::ClassifyTextResponse]
|
473
|
+
# @return [::Google::Cloud::Language::V1beta2::ClassifyTextResponse]
|
449
474
|
#
|
450
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
475
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
451
476
|
#
|
452
477
|
def classify_text request, options = nil
|
453
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
478
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
454
479
|
|
455
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::ClassifyTextRequest
|
480
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::ClassifyTextRequest
|
456
481
|
|
457
482
|
# Converts hash and nil to an options object
|
458
|
-
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
|
459
484
|
|
460
485
|
# Customize the options with defaults
|
461
486
|
metadata = @config.rpcs.classify_text.metadata.to_h
|
462
487
|
|
463
488
|
# Set x-goog-api-client and x-goog-user-project headers
|
464
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
489
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
465
490
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
466
491
|
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
467
492
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -476,8 +501,8 @@ module Google
|
|
476
501
|
yield response, operation if block_given?
|
477
502
|
return response
|
478
503
|
end
|
479
|
-
rescue GRPC::BadStatus => e
|
480
|
-
raise Google::Cloud::Error.from_error(e)
|
504
|
+
rescue ::GRPC::BadStatus => e
|
505
|
+
raise ::Google::Cloud::Error.from_error(e)
|
481
506
|
end
|
482
507
|
|
483
508
|
##
|
@@ -485,42 +510,48 @@ module Google
|
|
485
510
|
# classification features in one call.
|
486
511
|
#
|
487
512
|
# @overload annotate_text(request, options = nil)
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
# @param
|
513
|
+
# Pass arguments to `annotate_text` via a request object, either of type
|
514
|
+
# {::Google::Cloud::Language::V1beta2::AnnotateTextRequest} or an equivalent Hash.
|
515
|
+
#
|
516
|
+
# @param request [::Google::Cloud::Language::V1beta2::AnnotateTextRequest, ::Hash]
|
517
|
+
# A request object representing the call parameters. Required. To specify no
|
518
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
519
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
492
520
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
493
521
|
#
|
494
522
|
# @overload annotate_text(document: nil, features: nil, encoding_type: nil)
|
495
|
-
#
|
523
|
+
# Pass arguments to `annotate_text` via keyword arguments. Note that at
|
524
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
525
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
526
|
+
#
|
527
|
+
# @param document [::Google::Cloud::Language::V1beta2::Document, ::Hash]
|
496
528
|
# Required. Input document.
|
497
|
-
# @param features [Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features
|
529
|
+
# @param features [::Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features, ::Hash]
|
498
530
|
# Required. The enabled features.
|
499
|
-
# @param encoding_type [Google::Cloud::Language::V1beta2::EncodingType]
|
531
|
+
# @param encoding_type [::Google::Cloud::Language::V1beta2::EncodingType]
|
500
532
|
# The encoding type used by the API to calculate offsets.
|
501
533
|
#
|
502
|
-
#
|
503
534
|
# @yield [response, operation] Access the result along with the RPC operation
|
504
|
-
# @yieldparam response [Google::Cloud::Language::V1beta2::AnnotateTextResponse]
|
505
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
535
|
+
# @yieldparam response [::Google::Cloud::Language::V1beta2::AnnotateTextResponse]
|
536
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
506
537
|
#
|
507
|
-
# @return [Google::Cloud::Language::V1beta2::AnnotateTextResponse]
|
538
|
+
# @return [::Google::Cloud::Language::V1beta2::AnnotateTextResponse]
|
508
539
|
#
|
509
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
540
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
510
541
|
#
|
511
542
|
def annotate_text request, options = nil
|
512
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
543
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
513
544
|
|
514
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Language::V1beta2::AnnotateTextRequest
|
545
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Language::V1beta2::AnnotateTextRequest
|
515
546
|
|
516
547
|
# Converts hash and nil to an options object
|
517
|
-
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
|
518
549
|
|
519
550
|
# Customize the options with defaults
|
520
551
|
metadata = @config.rpcs.annotate_text.metadata.to_h
|
521
552
|
|
522
553
|
# Set x-goog-api-client and x-goog-user-project headers
|
523
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
554
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
524
555
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
525
556
|
gapic_version: ::Google::Cloud::Language::V1beta2::VERSION
|
526
557
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
@@ -535,8 +566,8 @@ module Google
|
|
535
566
|
yield response, operation if block_given?
|
536
567
|
return response
|
537
568
|
end
|
538
|
-
rescue GRPC::BadStatus => e
|
539
|
-
raise Google::Cloud::Error.from_error(e)
|
569
|
+
rescue ::GRPC::BadStatus => e
|
570
|
+
raise ::Google::Cloud::Error.from_error(e)
|
540
571
|
end
|
541
572
|
|
542
573
|
##
|
@@ -546,7 +577,7 @@ module Google
|
|
546
577
|
# providing control over timeouts, retry behavior, logging, transport
|
547
578
|
# parameters, and other low-level controls. Certain parameters can also be
|
548
579
|
# applied individually to specific RPCs. See
|
549
|
-
# {Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration::Rpcs}
|
580
|
+
# {::Google::Cloud::Language::V1beta2::LanguageService::Client::Configuration::Rpcs}
|
550
581
|
# for a list of RPCs that can be configured independently.
|
551
582
|
#
|
552
583
|
# Configuration can be applied globally to all clients, or to a single client
|
@@ -557,22 +588,22 @@ module Google
|
|
557
588
|
# To modify the global config, setting the timeout for analyze_sentiment
|
558
589
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
559
590
|
#
|
560
|
-
# Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
|
561
|
-
# config.timeout =
|
562
|
-
# config.rpcs.analyze_sentiment.timeout =
|
591
|
+
# ::Google::Cloud::Language::V1beta2::LanguageService::Client.configure do |config|
|
592
|
+
# config.timeout = 10.0
|
593
|
+
# config.rpcs.analyze_sentiment.timeout = 20.0
|
563
594
|
# end
|
564
595
|
#
|
565
596
|
# To apply the above configuration only to a new client:
|
566
597
|
#
|
567
|
-
# client = Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
|
568
|
-
# config.timeout =
|
569
|
-
# config.rpcs.analyze_sentiment.timeout =
|
598
|
+
# client = ::Google::Cloud::Language::V1beta2::LanguageService::Client.new do |config|
|
599
|
+
# config.timeout = 10.0
|
600
|
+
# config.rpcs.analyze_sentiment.timeout = 20.0
|
570
601
|
# end
|
571
602
|
#
|
572
603
|
# @!attribute [rw] endpoint
|
573
604
|
# The hostname or hostname:port of the service endpoint.
|
574
605
|
# Defaults to `"language.googleapis.com"`.
|
575
|
-
# @return [String]
|
606
|
+
# @return [::String]
|
576
607
|
# @!attribute [rw] credentials
|
577
608
|
# Credentials to send with calls. You may provide any of the following types:
|
578
609
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -584,29 +615,29 @@ module Google
|
|
584
615
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
585
616
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
586
617
|
# * (`nil`) indicating no credentials
|
587
|
-
# @return [Object]
|
618
|
+
# @return [::Object]
|
588
619
|
# @!attribute [rw] scope
|
589
620
|
# The OAuth scopes
|
590
|
-
# @return [Array
|
621
|
+
# @return [::Array<::String>]
|
591
622
|
# @!attribute [rw] lib_name
|
592
623
|
# The library name as recorded in instrumentation and logging
|
593
|
-
# @return [String]
|
624
|
+
# @return [::String]
|
594
625
|
# @!attribute [rw] lib_version
|
595
626
|
# The library version as recorded in instrumentation and logging
|
596
|
-
# @return [String]
|
627
|
+
# @return [::String]
|
597
628
|
# @!attribute [rw] channel_args
|
598
629
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
599
630
|
# `GRPC::Core::Channel` object is provided as the credential.
|
600
|
-
# @return [Hash]
|
631
|
+
# @return [::Hash]
|
601
632
|
# @!attribute [rw] interceptors
|
602
633
|
# An array of interceptors that are run before calls are executed.
|
603
|
-
# @return [Array
|
634
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
604
635
|
# @!attribute [rw] timeout
|
605
|
-
# The call timeout in
|
606
|
-
# @return [Numeric]
|
636
|
+
# The call timeout in seconds.
|
637
|
+
# @return [::Numeric]
|
607
638
|
# @!attribute [rw] metadata
|
608
639
|
# Additional gRPC headers to be sent with the call.
|
609
|
-
# @return [Hash{Symbol
|
640
|
+
# @return [::Hash{::Symbol=>::String}]
|
610
641
|
# @!attribute [rw] retry_policy
|
611
642
|
# The retry policy. The value is a hash with the following keys:
|
612
643
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
@@ -614,25 +645,29 @@ module Google
|
|
614
645
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
615
646
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
616
647
|
# trigger a retry.
|
617
|
-
# @return [Hash]
|
648
|
+
# @return [::Hash]
|
649
|
+
# @!attribute [rw] quota_project
|
650
|
+
# A separate project against which to charge quota.
|
651
|
+
# @return [::String]
|
618
652
|
#
|
619
653
|
class Configuration
|
620
|
-
extend Gapic::Config
|
654
|
+
extend ::Gapic::Config
|
621
655
|
|
622
|
-
config_attr :endpoint,
|
623
|
-
config_attr :credentials,
|
656
|
+
config_attr :endpoint, "language.googleapis.com", ::String
|
657
|
+
config_attr :credentials, nil do |value|
|
624
658
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
625
659
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
626
660
|
allowed.any? { |klass| klass === value }
|
627
661
|
end
|
628
|
-
config_attr :scope,
|
629
|
-
config_attr :lib_name,
|
630
|
-
config_attr :lib_version,
|
631
|
-
config_attr(:channel_args,
|
632
|
-
config_attr :interceptors,
|
633
|
-
config_attr :timeout,
|
634
|
-
config_attr :metadata,
|
635
|
-
config_attr :retry_policy,
|
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
|
636
671
|
|
637
672
|
# @private
|
638
673
|
def initialize parent_config = nil
|
@@ -648,7 +683,7 @@ module Google
|
|
648
683
|
def rpcs
|
649
684
|
@rpcs ||= begin
|
650
685
|
parent_rpcs = nil
|
651
|
-
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to?
|
686
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
|
652
687
|
Rpcs.new parent_rpcs
|
653
688
|
end
|
654
689
|
end
|
@@ -673,49 +708,49 @@ module Google
|
|
673
708
|
class Rpcs
|
674
709
|
##
|
675
710
|
# RPC-specific configuration for `analyze_sentiment`
|
676
|
-
# @return [Gapic::Config::Method]
|
711
|
+
# @return [::Gapic::Config::Method]
|
677
712
|
#
|
678
713
|
attr_reader :analyze_sentiment
|
679
714
|
##
|
680
715
|
# RPC-specific configuration for `analyze_entities`
|
681
|
-
# @return [Gapic::Config::Method]
|
716
|
+
# @return [::Gapic::Config::Method]
|
682
717
|
#
|
683
718
|
attr_reader :analyze_entities
|
684
719
|
##
|
685
720
|
# RPC-specific configuration for `analyze_entity_sentiment`
|
686
|
-
# @return [Gapic::Config::Method]
|
721
|
+
# @return [::Gapic::Config::Method]
|
687
722
|
#
|
688
723
|
attr_reader :analyze_entity_sentiment
|
689
724
|
##
|
690
725
|
# RPC-specific configuration for `analyze_syntax`
|
691
|
-
# @return [Gapic::Config::Method]
|
726
|
+
# @return [::Gapic::Config::Method]
|
692
727
|
#
|
693
728
|
attr_reader :analyze_syntax
|
694
729
|
##
|
695
730
|
# RPC-specific configuration for `classify_text`
|
696
|
-
# @return [Gapic::Config::Method]
|
731
|
+
# @return [::Gapic::Config::Method]
|
697
732
|
#
|
698
733
|
attr_reader :classify_text
|
699
734
|
##
|
700
735
|
# RPC-specific configuration for `annotate_text`
|
701
|
-
# @return [Gapic::Config::Method]
|
736
|
+
# @return [::Gapic::Config::Method]
|
702
737
|
#
|
703
738
|
attr_reader :annotate_text
|
704
739
|
|
705
740
|
# @private
|
706
741
|
def initialize parent_rpcs = nil
|
707
742
|
analyze_sentiment_config = parent_rpcs&.analyze_sentiment if parent_rpcs&.respond_to? :analyze_sentiment
|
708
|
-
@analyze_sentiment = Gapic::Config::Method.new analyze_sentiment_config
|
743
|
+
@analyze_sentiment = ::Gapic::Config::Method.new analyze_sentiment_config
|
709
744
|
analyze_entities_config = parent_rpcs&.analyze_entities if parent_rpcs&.respond_to? :analyze_entities
|
710
|
-
@analyze_entities = Gapic::Config::Method.new analyze_entities_config
|
745
|
+
@analyze_entities = ::Gapic::Config::Method.new analyze_entities_config
|
711
746
|
analyze_entity_sentiment_config = parent_rpcs&.analyze_entity_sentiment if parent_rpcs&.respond_to? :analyze_entity_sentiment
|
712
|
-
@analyze_entity_sentiment = Gapic::Config::Method.new analyze_entity_sentiment_config
|
747
|
+
@analyze_entity_sentiment = ::Gapic::Config::Method.new analyze_entity_sentiment_config
|
713
748
|
analyze_syntax_config = parent_rpcs&.analyze_syntax if parent_rpcs&.respond_to? :analyze_syntax
|
714
|
-
@analyze_syntax = Gapic::Config::Method.new analyze_syntax_config
|
749
|
+
@analyze_syntax = ::Gapic::Config::Method.new analyze_syntax_config
|
715
750
|
classify_text_config = parent_rpcs&.classify_text if parent_rpcs&.respond_to? :classify_text
|
716
|
-
@classify_text = Gapic::Config::Method.new classify_text_config
|
751
|
+
@classify_text = ::Gapic::Config::Method.new classify_text_config
|
717
752
|
annotate_text_config = parent_rpcs&.annotate_text if parent_rpcs&.respond_to? :annotate_text
|
718
|
-
@annotate_text = Gapic::Config::Method.new annotate_text_config
|
753
|
+
@annotate_text = ::Gapic::Config::Method.new annotate_text_config
|
719
754
|
|
720
755
|
yield self if block_given?
|
721
756
|
end
|
@@ -727,13 +762,3 @@ module Google
|
|
727
762
|
end
|
728
763
|
end
|
729
764
|
end
|
730
|
-
|
731
|
-
# rubocop:disable Lint/HandleExceptions
|
732
|
-
|
733
|
-
# Once client is loaded, load helpers.rb if it exists.
|
734
|
-
begin
|
735
|
-
require "google/cloud/language/v1beta2/language_service/helpers"
|
736
|
-
rescue LoadError
|
737
|
-
end
|
738
|
-
|
739
|
-
# rubocop:enable Lint/HandleExceptions
|