google-cloud-vision-v1p3beta1 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +6 -6
- data/README.md +48 -1
- data/lib/google-cloud-vision-v1p3beta1.rb +21 -1
- data/lib/google/cloud/vision/v1p3beta1.rb +16 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator.rb +33 -2
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/client.rb +101 -97
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/credentials.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/operations.rb +139 -127
- data/lib/google/cloud/vision/v1p3beta1/image_annotator/paths.rb +3 -3
- data/lib/google/cloud/vision/v1p3beta1/product_search.rb +44 -2
- data/lib/google/cloud/vision/v1p3beta1/product_search/client.rb +500 -508
- data/lib/google/cloud/vision/v1p3beta1/product_search/credentials.rb +1 -1
- data/lib/google/cloud/vision/v1p3beta1/product_search/operations.rb +139 -127
- data/lib/google/cloud/vision/v1p3beta1/product_search/paths.rb +12 -12
- data/lib/google/cloud/vision/v1p3beta1/version.rb +1 -1
- data/proto_docs/google/api/resource.rb +12 -12
- data/proto_docs/google/cloud/vision/v1p3beta1/geometry.rb +20 -20
- data/proto_docs/google/cloud/vision/v1p3beta1/image_annotator.rb +172 -172
- data/proto_docs/google/cloud/vision/v1p3beta1/product_search.rb +29 -29
- data/proto_docs/google/cloud/vision/v1p3beta1/product_search_service.rb +133 -133
- data/proto_docs/google/cloud/vision/v1p3beta1/text_annotation.rb +49 -49
- data/proto_docs/google/cloud/vision/v1p3beta1/web_detection.rb +28 -28
- data/proto_docs/google/longrunning/operations.rb +30 -30
- data/proto_docs/google/protobuf/any.rb +4 -4
- data/proto_docs/google/protobuf/empty.rb +2 -2
- data/proto_docs/google/protobuf/field_mask.rb +3 -3
- data/proto_docs/google/protobuf/timestamp.rb +4 -4
- data/proto_docs/google/protobuf/wrappers.rb +27 -27
- data/proto_docs/google/rpc/status.rb +6 -6
- data/proto_docs/google/type/color.rb +6 -6
- data/proto_docs/google/type/latlng.rb +4 -4
- metadata +32 -5
- 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: bed8eb28908c3841ce50dfe2d626b437d214adddea0b2ccda921f6fe817f0d38
|
|
4
|
+
data.tar.gz: cf1ca2243e106768e301d541eacb922e28a660376eae64da343c5e666b990577
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32649728fca3d917fb6b91f0e19df61856fe109639e012052e09a5faa6464e2596a17ec2ba9a82fd99705d1c5589eeef0f7ea2906323e57081357b508365b506
|
|
7
|
+
data.tar.gz: 6b6f718c41497a9d56a97c032889f6bc185a609db794aa180212aec71a31e9ceb77eeaf3d225e826919f74b13f6caef857807acf4e678f116aefcf04174c46e3
|
data/AUTHENTICATION.md
CHANGED
|
@@ -27,7 +27,7 @@ export VISION_CREDENTIALS=path/to/keyfile.json
|
|
|
27
27
|
```ruby
|
|
28
28
|
require "google/cloud/vision/v1p3beta1"
|
|
29
29
|
|
|
30
|
-
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
|
|
30
|
+
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::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-vision-v1p3beta1
|
|
66
66
|
checks for credentials are configured on the service Credentials class (such as
|
|
67
|
-
{Google::Cloud::Vision::V1p3beta1::ProductSearch::Credentials}):
|
|
67
|
+
{::Google::Cloud::Vision::V1p3beta1::ProductSearch::Credentials}):
|
|
68
68
|
|
|
69
69
|
1. `VISION_CREDENTIALS` - Path to JSON file, or JSON contents
|
|
70
70
|
2. `VISION_KEYFILE` - Path to JSON file, or JSON contents
|
|
@@ -77,7 +77,7 @@ require "google/cloud/vision/v1p3beta1"
|
|
|
77
77
|
|
|
78
78
|
ENV["VISION_CREDENTIALS"] = "path/to/keyfile.json"
|
|
79
79
|
|
|
80
|
-
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
|
|
80
|
+
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::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/vision/v1p3beta1"
|
|
90
90
|
|
|
91
|
-
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new do |config|
|
|
91
|
+
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::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/vision/v1p3beta1"
|
|
100
100
|
|
|
101
|
-
Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
|
|
101
|
+
::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.configure do |config|
|
|
102
102
|
config.credentials = "path/to/keyfile.json"
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
client = Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
|
|
105
|
+
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
### Cloud SDK
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cloud Vision V1p3beta1
|
|
1
|
+
# Ruby Client for the Cloud Vision V1p3beta1 API
|
|
2
2
|
|
|
3
3
|
API Client library for the Cloud Vision V1p3beta1 API
|
|
4
4
|
|
|
@@ -12,6 +12,53 @@ https://github.com/googleapis/google-cloud-ruby
|
|
|
12
12
|
$ gem install google-cloud-vision-v1p3beta1
|
|
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/vision/v1p3beta1"
|
|
27
|
+
|
|
28
|
+
client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
|
|
29
|
+
request = my_create_request
|
|
30
|
+
response = client.create_product_set request
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-vision-v1p3beta1/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/vision/v1p3beta1"
|
|
@@ -18,3 +18,19 @@
|
|
|
18
18
|
|
|
19
19
|
require "google/cloud/vision/v1p3beta1/product_search"
|
|
20
20
|
require "google/cloud/vision/v1p3beta1/image_annotator"
|
|
21
|
+
require "google/cloud/vision/v1p3beta1/version"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module Vision
|
|
26
|
+
##
|
|
27
|
+
# To load this package, including all its services, and instantiate a client:
|
|
28
|
+
#
|
|
29
|
+
# require "google/cloud/vision/v1p3beta1"
|
|
30
|
+
# client = ::Google::Cloud::Vision::V1p3beta1::ProductSearch::Client.new
|
|
31
|
+
#
|
|
32
|
+
module V1p3beta1
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -16,6 +16,37 @@
|
|
|
16
16
|
|
|
17
17
|
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
18
|
|
|
19
|
-
require "
|
|
20
|
-
require "
|
|
19
|
+
require "gapic/common"
|
|
20
|
+
require "gapic/config"
|
|
21
|
+
require "gapic/config/method"
|
|
22
|
+
|
|
23
|
+
require "google/cloud/vision/v1p3beta1/version"
|
|
24
|
+
|
|
21
25
|
require "google/cloud/vision/v1p3beta1/image_annotator/credentials"
|
|
26
|
+
require "google/cloud/vision/v1p3beta1/image_annotator/paths"
|
|
27
|
+
require "google/cloud/vision/v1p3beta1/image_annotator/operations"
|
|
28
|
+
require "google/cloud/vision/v1p3beta1/image_annotator/client"
|
|
29
|
+
|
|
30
|
+
module Google
|
|
31
|
+
module Cloud
|
|
32
|
+
module Vision
|
|
33
|
+
module V1p3beta1
|
|
34
|
+
##
|
|
35
|
+
# Service that performs Google Cloud Vision API detection tasks over client
|
|
36
|
+
# images, such as face, landmark, logo, label, and text detection. The
|
|
37
|
+
# ImageAnnotator service returns detected entities from the images.
|
|
38
|
+
#
|
|
39
|
+
# To load this service and instantiate a client:
|
|
40
|
+
#
|
|
41
|
+
# require "google/cloud/vision/v1p3beta1/image_annotator"
|
|
42
|
+
# client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new
|
|
43
|
+
#
|
|
44
|
+
module ImageAnnotator
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
helper_path = ::File.join __dir__, "image_annotator", "helpers.rb"
|
|
52
|
+
require "google/cloud/vision/v1p3beta1/image_annotator/helpers" if ::File.file? helper_path
|
|
@@ -16,16 +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/vision/v1p3beta1/version"
|
|
25
20
|
require "google/cloud/vision/v1p3beta1/image_annotator_pb"
|
|
26
|
-
require "google/cloud/vision/v1p3beta1/image_annotator/credentials"
|
|
27
|
-
require "google/cloud/vision/v1p3beta1/image_annotator/paths"
|
|
28
|
-
require "google/cloud/vision/v1p3beta1/image_annotator/operations"
|
|
29
21
|
|
|
30
22
|
module Google
|
|
31
23
|
module Cloud
|
|
@@ -48,15 +40,15 @@ module Google
|
|
|
48
40
|
##
|
|
49
41
|
# Configure the ImageAnnotator Client class.
|
|
50
42
|
#
|
|
51
|
-
# See {Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration}
|
|
43
|
+
# See {::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration}
|
|
52
44
|
# for a description of the configuration fields.
|
|
53
45
|
#
|
|
54
46
|
# ## Example
|
|
55
47
|
#
|
|
56
48
|
# To modify the configuration for all ImageAnnotator clients:
|
|
57
49
|
#
|
|
58
|
-
# Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
|
|
59
|
-
# config.timeout =
|
|
50
|
+
# ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
|
|
51
|
+
# config.timeout = 10.0
|
|
60
52
|
# end
|
|
61
53
|
#
|
|
62
54
|
# @yield [config] Configure the Client client.
|
|
@@ -104,7 +96,7 @@ module Google
|
|
|
104
96
|
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
105
97
|
# should be made on {Client.configure}.
|
|
106
98
|
#
|
|
107
|
-
# See {Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration}
|
|
99
|
+
# See {::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration}
|
|
108
100
|
# for a description of the configuration fields.
|
|
109
101
|
#
|
|
110
102
|
# @yield [config] Configure the Client client.
|
|
@@ -125,13 +117,13 @@ module Google
|
|
|
125
117
|
# To create a new ImageAnnotator client with the default
|
|
126
118
|
# configuration:
|
|
127
119
|
#
|
|
128
|
-
# client = Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new
|
|
120
|
+
# client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new
|
|
129
121
|
#
|
|
130
122
|
# To create a new ImageAnnotator client with a custom
|
|
131
123
|
# configuration:
|
|
132
124
|
#
|
|
133
|
-
# client = Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
|
|
134
|
-
# config.timeout =
|
|
125
|
+
# client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
|
|
126
|
+
# config.timeout = 10.0
|
|
135
127
|
# end
|
|
136
128
|
#
|
|
137
129
|
# @yield [config] Configure the ImageAnnotator client.
|
|
@@ -156,14 +148,16 @@ module Google
|
|
|
156
148
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
|
157
149
|
credentials = Credentials.new credentials, scope: @config.scope
|
|
158
150
|
end
|
|
159
|
-
@quota_project_id =
|
|
151
|
+
@quota_project_id = @config.quota_project
|
|
152
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
160
153
|
|
|
161
154
|
@operations_client = Operations.new do |config|
|
|
162
155
|
config.credentials = credentials
|
|
156
|
+
config.endpoint = @config.endpoint
|
|
163
157
|
end
|
|
164
158
|
|
|
165
|
-
@image_annotator_stub = Gapic::ServiceStub.new(
|
|
166
|
-
Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Stub,
|
|
159
|
+
@image_annotator_stub = ::Gapic::ServiceStub.new(
|
|
160
|
+
::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Stub,
|
|
167
161
|
credentials: credentials,
|
|
168
162
|
endpoint: @config.endpoint,
|
|
169
163
|
channel_args: @config.channel_args,
|
|
@@ -171,43 +165,57 @@ module Google
|
|
|
171
165
|
)
|
|
172
166
|
end
|
|
173
167
|
|
|
168
|
+
##
|
|
169
|
+
# Get the associated client for long-running operations.
|
|
170
|
+
#
|
|
171
|
+
# @return [::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Operations]
|
|
172
|
+
#
|
|
173
|
+
attr_reader :operations_client
|
|
174
|
+
|
|
174
175
|
# Service calls
|
|
175
176
|
|
|
176
177
|
##
|
|
177
178
|
# Run image detection and annotation for a batch of images.
|
|
178
179
|
#
|
|
179
180
|
# @overload batch_annotate_images(request, options = nil)
|
|
180
|
-
#
|
|
181
|
-
#
|
|
182
|
-
#
|
|
181
|
+
# Pass arguments to `batch_annotate_images` via a request object, either of type
|
|
182
|
+
# {::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest} or an equivalent Hash.
|
|
183
|
+
#
|
|
184
|
+
# @param request [::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest, ::Hash]
|
|
185
|
+
# A request object representing the call parameters. Required. To specify no
|
|
186
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
187
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
183
188
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
184
189
|
#
|
|
185
190
|
# @overload batch_annotate_images(requests: nil)
|
|
186
|
-
#
|
|
187
|
-
#
|
|
191
|
+
# Pass arguments to `batch_annotate_images` via keyword arguments. Note that at
|
|
192
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
193
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
188
194
|
#
|
|
195
|
+
# @param requests [::Array<::Google::Cloud::Vision::V1p3beta1::AnnotateImageRequest, ::Hash>]
|
|
196
|
+
# Individual image annotation requests for this batch.
|
|
189
197
|
#
|
|
190
198
|
# @yield [response, operation] Access the result along with the RPC operation
|
|
191
|
-
# @yieldparam response [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
|
192
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
|
199
|
+
# @yieldparam response [::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
|
200
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
193
201
|
#
|
|
194
|
-
# @return [Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
|
202
|
+
# @return [::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesResponse]
|
|
195
203
|
#
|
|
196
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
|
204
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
197
205
|
#
|
|
198
206
|
def batch_annotate_images request, options = nil
|
|
199
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
|
207
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
200
208
|
|
|
201
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest
|
|
209
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::BatchAnnotateImagesRequest
|
|
202
210
|
|
|
203
211
|
# Converts hash and nil to an options object
|
|
204
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
212
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
205
213
|
|
|
206
214
|
# Customize the options with defaults
|
|
207
215
|
metadata = @config.rpcs.batch_annotate_images.metadata.to_h
|
|
208
216
|
|
|
209
217
|
# Set x-goog-api-client and x-goog-user-project headers
|
|
210
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
|
218
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
211
219
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
212
220
|
gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
|
|
213
221
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
@@ -222,8 +230,8 @@ module Google
|
|
|
222
230
|
yield response, operation if block_given?
|
|
223
231
|
return response
|
|
224
232
|
end
|
|
225
|
-
rescue GRPC::BadStatus => e
|
|
226
|
-
raise Google::Cloud::Error.from_error(e)
|
|
233
|
+
rescue ::GRPC::BadStatus => e
|
|
234
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
227
235
|
end
|
|
228
236
|
|
|
229
237
|
##
|
|
@@ -235,42 +243,44 @@ module Google
|
|
|
235
243
|
# `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).
|
|
236
244
|
#
|
|
237
245
|
# @overload async_batch_annotate_files(request, options = nil)
|
|
238
|
-
#
|
|
239
|
-
#
|
|
240
|
-
#
|
|
241
|
-
#
|
|
242
|
-
#
|
|
243
|
-
#
|
|
244
|
-
#
|
|
245
|
-
# @param options [Gapic::CallOptions, Hash]
|
|
246
|
+
# Pass arguments to `async_batch_annotate_files` via a request object, either of type
|
|
247
|
+
# {::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest} or an equivalent Hash.
|
|
248
|
+
#
|
|
249
|
+
# @param request [::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest, ::Hash]
|
|
250
|
+
# A request object representing the call parameters. Required. To specify no
|
|
251
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
252
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
246
253
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
|
247
254
|
#
|
|
248
255
|
# @overload async_batch_annotate_files(requests: nil)
|
|
249
|
-
#
|
|
250
|
-
#
|
|
256
|
+
# Pass arguments to `async_batch_annotate_files` via keyword arguments. Note that at
|
|
257
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
258
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
251
259
|
#
|
|
260
|
+
# @param requests [::Array<::Google::Cloud::Vision::V1p3beta1::AsyncAnnotateFileRequest, ::Hash>]
|
|
261
|
+
# Required. Individual async file annotation requests for this batch.
|
|
252
262
|
#
|
|
253
263
|
# @yield [response, operation] Access the result along with the RPC operation
|
|
254
|
-
# @yieldparam response [Gapic::Operation]
|
|
255
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
|
264
|
+
# @yieldparam response [::Gapic::Operation]
|
|
265
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
256
266
|
#
|
|
257
|
-
# @return [Gapic::Operation]
|
|
267
|
+
# @return [::Gapic::Operation]
|
|
258
268
|
#
|
|
259
|
-
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
|
269
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
260
270
|
#
|
|
261
271
|
def async_batch_annotate_files request, options = nil
|
|
262
|
-
raise ArgumentError, "request must be provided" if request.nil?
|
|
272
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
263
273
|
|
|
264
|
-
request = Gapic::Protobuf.coerce request, to: Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest
|
|
274
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Vision::V1p3beta1::AsyncBatchAnnotateFilesRequest
|
|
265
275
|
|
|
266
276
|
# Converts hash and nil to an options object
|
|
267
|
-
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
277
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
268
278
|
|
|
269
279
|
# Customize the options with defaults
|
|
270
280
|
metadata = @config.rpcs.async_batch_annotate_files.metadata.to_h
|
|
271
281
|
|
|
272
282
|
# Set x-goog-api-client and x-goog-user-project headers
|
|
273
|
-
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
|
283
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
274
284
|
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
275
285
|
gapic_version: ::Google::Cloud::Vision::V1p3beta1::VERSION
|
|
276
286
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
@@ -282,12 +292,12 @@ module Google
|
|
|
282
292
|
retry_policy: @config.retry_policy
|
|
283
293
|
|
|
284
294
|
@image_annotator_stub.call_rpc :async_batch_annotate_files, request, options: options do |response, operation|
|
|
285
|
-
response = Gapic::Operation.new response, @operations_client, options: options
|
|
295
|
+
response = ::Gapic::Operation.new response, @operations_client, options: options
|
|
286
296
|
yield response, operation if block_given?
|
|
287
297
|
return response
|
|
288
298
|
end
|
|
289
|
-
rescue GRPC::BadStatus => e
|
|
290
|
-
raise Google::Cloud::Error.from_error(e)
|
|
299
|
+
rescue ::GRPC::BadStatus => e
|
|
300
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
291
301
|
end
|
|
292
302
|
|
|
293
303
|
##
|
|
@@ -297,7 +307,7 @@ module Google
|
|
|
297
307
|
# providing control over timeouts, retry behavior, logging, transport
|
|
298
308
|
# parameters, and other low-level controls. Certain parameters can also be
|
|
299
309
|
# applied individually to specific RPCs. See
|
|
300
|
-
# {Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration::Rpcs}
|
|
310
|
+
# {::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client::Configuration::Rpcs}
|
|
301
311
|
# for a list of RPCs that can be configured independently.
|
|
302
312
|
#
|
|
303
313
|
# Configuration can be applied globally to all clients, or to a single client
|
|
@@ -308,22 +318,22 @@ module Google
|
|
|
308
318
|
# To modify the global config, setting the timeout for batch_annotate_images
|
|
309
319
|
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
|
310
320
|
#
|
|
311
|
-
# Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
|
|
312
|
-
# config.timeout =
|
|
313
|
-
# config.rpcs.batch_annotate_images.timeout =
|
|
321
|
+
# ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.configure do |config|
|
|
322
|
+
# config.timeout = 10.0
|
|
323
|
+
# config.rpcs.batch_annotate_images.timeout = 20.0
|
|
314
324
|
# end
|
|
315
325
|
#
|
|
316
326
|
# To apply the above configuration only to a new client:
|
|
317
327
|
#
|
|
318
|
-
# client = Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
|
|
319
|
-
# config.timeout =
|
|
320
|
-
# config.rpcs.batch_annotate_images.timeout =
|
|
328
|
+
# client = ::Google::Cloud::Vision::V1p3beta1::ImageAnnotator::Client.new do |config|
|
|
329
|
+
# config.timeout = 10.0
|
|
330
|
+
# config.rpcs.batch_annotate_images.timeout = 20.0
|
|
321
331
|
# end
|
|
322
332
|
#
|
|
323
333
|
# @!attribute [rw] endpoint
|
|
324
334
|
# The hostname or hostname:port of the service endpoint.
|
|
325
335
|
# Defaults to `"vision.googleapis.com"`.
|
|
326
|
-
# @return [String]
|
|
336
|
+
# @return [::String]
|
|
327
337
|
# @!attribute [rw] credentials
|
|
328
338
|
# Credentials to send with calls. You may provide any of the following types:
|
|
329
339
|
# * (`String`) The path to a service account key file in JSON format
|
|
@@ -335,29 +345,29 @@ module Google
|
|
|
335
345
|
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
336
346
|
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
337
347
|
# * (`nil`) indicating no credentials
|
|
338
|
-
# @return [Object]
|
|
348
|
+
# @return [::Object]
|
|
339
349
|
# @!attribute [rw] scope
|
|
340
350
|
# The OAuth scopes
|
|
341
|
-
# @return [Array
|
|
351
|
+
# @return [::Array<::String>]
|
|
342
352
|
# @!attribute [rw] lib_name
|
|
343
353
|
# The library name as recorded in instrumentation and logging
|
|
344
|
-
# @return [String]
|
|
354
|
+
# @return [::String]
|
|
345
355
|
# @!attribute [rw] lib_version
|
|
346
356
|
# The library version as recorded in instrumentation and logging
|
|
347
|
-
# @return [String]
|
|
357
|
+
# @return [::String]
|
|
348
358
|
# @!attribute [rw] channel_args
|
|
349
359
|
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
350
360
|
# `GRPC::Core::Channel` object is provided as the credential.
|
|
351
|
-
# @return [Hash]
|
|
361
|
+
# @return [::Hash]
|
|
352
362
|
# @!attribute [rw] interceptors
|
|
353
363
|
# An array of interceptors that are run before calls are executed.
|
|
354
|
-
# @return [Array
|
|
364
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
355
365
|
# @!attribute [rw] timeout
|
|
356
|
-
# The call timeout in
|
|
357
|
-
# @return [Numeric]
|
|
366
|
+
# The call timeout in seconds.
|
|
367
|
+
# @return [::Numeric]
|
|
358
368
|
# @!attribute [rw] metadata
|
|
359
369
|
# Additional gRPC headers to be sent with the call.
|
|
360
|
-
# @return [Hash{Symbol
|
|
370
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
361
371
|
# @!attribute [rw] retry_policy
|
|
362
372
|
# The retry policy. The value is a hash with the following keys:
|
|
363
373
|
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
@@ -365,25 +375,29 @@ module Google
|
|
|
365
375
|
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
366
376
|
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
367
377
|
# trigger a retry.
|
|
368
|
-
# @return [Hash]
|
|
378
|
+
# @return [::Hash]
|
|
379
|
+
# @!attribute [rw] quota_project
|
|
380
|
+
# A separate project against which to charge quota.
|
|
381
|
+
# @return [::String]
|
|
369
382
|
#
|
|
370
383
|
class Configuration
|
|
371
|
-
extend Gapic::Config
|
|
384
|
+
extend ::Gapic::Config
|
|
372
385
|
|
|
373
|
-
config_attr :endpoint,
|
|
374
|
-
config_attr :credentials,
|
|
386
|
+
config_attr :endpoint, "vision.googleapis.com", ::String
|
|
387
|
+
config_attr :credentials, nil do |value|
|
|
375
388
|
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
|
376
389
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
|
377
390
|
allowed.any? { |klass| klass === value }
|
|
378
391
|
end
|
|
379
|
-
config_attr :scope,
|
|
380
|
-
config_attr :lib_name,
|
|
381
|
-
config_attr :lib_version,
|
|
382
|
-
config_attr(:channel_args,
|
|
383
|
-
config_attr :interceptors,
|
|
384
|
-
config_attr :timeout,
|
|
385
|
-
config_attr :metadata,
|
|
386
|
-
config_attr :retry_policy,
|
|
392
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
393
|
+
config_attr :lib_name, nil, ::String, nil
|
|
394
|
+
config_attr :lib_version, nil, ::String, nil
|
|
395
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
|
396
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
397
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
398
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
399
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
400
|
+
config_attr :quota_project, nil, ::String, nil
|
|
387
401
|
|
|
388
402
|
# @private
|
|
389
403
|
def initialize parent_config = nil
|
|
@@ -424,21 +438,21 @@ module Google
|
|
|
424
438
|
class Rpcs
|
|
425
439
|
##
|
|
426
440
|
# RPC-specific configuration for `batch_annotate_images`
|
|
427
|
-
# @return [Gapic::Config::Method]
|
|
441
|
+
# @return [::Gapic::Config::Method]
|
|
428
442
|
#
|
|
429
443
|
attr_reader :batch_annotate_images
|
|
430
444
|
##
|
|
431
445
|
# RPC-specific configuration for `async_batch_annotate_files`
|
|
432
|
-
# @return [Gapic::Config::Method]
|
|
446
|
+
# @return [::Gapic::Config::Method]
|
|
433
447
|
#
|
|
434
448
|
attr_reader :async_batch_annotate_files
|
|
435
449
|
|
|
436
450
|
# @private
|
|
437
451
|
def initialize parent_rpcs = nil
|
|
438
452
|
batch_annotate_images_config = parent_rpcs&.batch_annotate_images if parent_rpcs&.respond_to? :batch_annotate_images
|
|
439
|
-
@batch_annotate_images = Gapic::Config::Method.new batch_annotate_images_config
|
|
453
|
+
@batch_annotate_images = ::Gapic::Config::Method.new batch_annotate_images_config
|
|
440
454
|
async_batch_annotate_files_config = parent_rpcs&.async_batch_annotate_files if parent_rpcs&.respond_to? :async_batch_annotate_files
|
|
441
|
-
@async_batch_annotate_files = Gapic::Config::Method.new async_batch_annotate_files_config
|
|
455
|
+
@async_batch_annotate_files = ::Gapic::Config::Method.new async_batch_annotate_files_config
|
|
442
456
|
|
|
443
457
|
yield self if block_given?
|
|
444
458
|
end
|
|
@@ -450,13 +464,3 @@ module Google
|
|
|
450
464
|
end
|
|
451
465
|
end
|
|
452
466
|
end
|
|
453
|
-
|
|
454
|
-
# rubocop:disable Lint/HandleExceptions
|
|
455
|
-
|
|
456
|
-
# Once client is loaded, load helpers.rb if it exists.
|
|
457
|
-
begin
|
|
458
|
-
require "google/cloud/vision/v1p3beta1/image_annotator/helpers"
|
|
459
|
-
rescue LoadError
|
|
460
|
-
end
|
|
461
|
-
|
|
462
|
-
# rubocop:enable Lint/HandleExceptions
|