google-cloud-vision 0.31.0 → 0.32.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -9
- data/LICENSE +1 -1
- data/README.md +94 -0
- data/lib/google/cloud/vision.rb +200 -535
- data/lib/google/cloud/vision/v1.rb +129 -55
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +9 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +88 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +539 -0
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +3 -3
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +2 -1
- data/lib/google/cloud/vision/{version.rb → v1/doc/google/protobuf/empty.rb} +13 -6
- data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +230 -0
- data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/vision/v1/geometry_pb.rb +1 -0
- data/lib/google/cloud/vision/v1/helpers.rb +972 -0
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +4 -4
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +5 -0
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +2 -1
- data/lib/google/cloud/vision/v1/product_search_client.rb +1337 -0
- data/lib/google/cloud/vision/v1/product_search_client_config.json +116 -0
- data/lib/google/cloud/vision/v1/product_search_pb.rb +45 -0
- data/lib/google/cloud/vision/v1/product_search_service_pb.rb +191 -0
- data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +224 -0
- data/lib/google/cloud/vision/v1p3beta1.rb +233 -0
- data/lib/google/cloud/vision/v1p3beta1/credentials.rb +42 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +72 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +763 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +154 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +533 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +254 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +101 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +93 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +130 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +29 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +230 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +109 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +90 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +84 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +156 -0
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +65 -0
- data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +43 -0
- data/lib/google/cloud/vision/v1p3beta1/helpers.rb +972 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +302 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +36 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +304 -0
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +55 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +1351 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +116 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +64 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +191 -0
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +222 -0
- data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +94 -0
- data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +51 -0
- metadata +53 -122
- data/AUTHENTICATION.md +0 -179
- data/CHANGELOG.md +0 -109
- data/CODE_OF_CONDUCT.md +0 -40
- data/CONTRIBUTING.md +0 -188
- data/LOGGING.md +0 -32
- data/OVERVIEW.md +0 -202
- data/TROUBLESHOOTING.md +0 -37
- data/lib/google-cloud-vision.rb +0 -146
- data/lib/google/cloud/vision/annotate.rb +0 -303
- data/lib/google/cloud/vision/annotation.rb +0 -553
- data/lib/google/cloud/vision/annotation/crop_hint.rb +0 -126
- data/lib/google/cloud/vision/annotation/entity.rb +0 -225
- data/lib/google/cloud/vision/annotation/face.rb +0 -1497
- data/lib/google/cloud/vision/annotation/normalized_vertex.rb +0 -76
- data/lib/google/cloud/vision/annotation/object_localization.rb +0 -115
- data/lib/google/cloud/vision/annotation/properties.rb +0 -220
- data/lib/google/cloud/vision/annotation/safe_search.rb +0 -153
- data/lib/google/cloud/vision/annotation/text.rb +0 -1015
- data/lib/google/cloud/vision/annotation/vertex.rb +0 -91
- data/lib/google/cloud/vision/annotation/web.rb +0 -420
- data/lib/google/cloud/vision/credentials.rb +0 -57
- data/lib/google/cloud/vision/image.rb +0 -832
- data/lib/google/cloud/vision/location.rb +0 -98
- data/lib/google/cloud/vision/project.rb +0 -367
- data/lib/google/cloud/vision/service.rb +0 -83
@@ -1,83 +0,0 @@
|
|
1
|
-
# Copyright 2016 Google LLC
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
|
-
|
16
|
-
require "google/cloud/errors"
|
17
|
-
require "google/cloud/vision/version"
|
18
|
-
require "google/cloud/vision/v1"
|
19
|
-
require "google/gax/errors"
|
20
|
-
|
21
|
-
module Google
|
22
|
-
module Cloud
|
23
|
-
module Vision
|
24
|
-
##
|
25
|
-
# @private
|
26
|
-
# Represents the service to Vision, exposing the API calls.
|
27
|
-
class Service
|
28
|
-
attr_accessor :project, :credentials, :timeout, :client_config
|
29
|
-
|
30
|
-
##
|
31
|
-
# Creates a new Service instance.
|
32
|
-
def initialize project, credentials, timeout: nil, client_config: nil
|
33
|
-
@project = project
|
34
|
-
@credentials = credentials
|
35
|
-
@timeout = timeout
|
36
|
-
@client_config = client_config || {}
|
37
|
-
end
|
38
|
-
|
39
|
-
def service
|
40
|
-
return mocked_service if mocked_service
|
41
|
-
@service ||= \
|
42
|
-
V1::ImageAnnotatorClient.new(
|
43
|
-
credentials: credentials,
|
44
|
-
timeout: timeout,
|
45
|
-
client_config: client_config,
|
46
|
-
lib_name: "gccl",
|
47
|
-
lib_version: Google::Cloud::Vision::VERSION
|
48
|
-
)
|
49
|
-
end
|
50
|
-
attr_accessor :mocked_service
|
51
|
-
|
52
|
-
##
|
53
|
-
# Returns API::BatchAnnotateImagesResponse
|
54
|
-
def annotate requests
|
55
|
-
execute do
|
56
|
-
service.batch_annotate_images requests, options: default_options
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def inspect
|
61
|
-
"#{self.class}(#{@project})"
|
62
|
-
end
|
63
|
-
|
64
|
-
protected
|
65
|
-
|
66
|
-
def default_headers
|
67
|
-
{ "google-cloud-resource-prefix" => "projects/#{@project}" }
|
68
|
-
end
|
69
|
-
|
70
|
-
def default_options
|
71
|
-
Google::Gax::CallOptions.new kwargs: default_headers
|
72
|
-
end
|
73
|
-
|
74
|
-
def execute
|
75
|
-
yield
|
76
|
-
rescue Google::Gax::GaxError => e
|
77
|
-
# GaxError wraps BadStatus, but exposes it as #cause
|
78
|
-
raise Google::Cloud::Error.from_error(e.cause)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|