google-cloud-vision 0.38.0 → 1.0.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 -1
- data/AUTHENTICATION.md +51 -59
- data/LICENSE.md +203 -0
- data/MIGRATING.md +343 -0
- data/README.md +35 -49
- data/lib/{google/cloud/vision/v1/doc/google/protobuf/wrappers.rb → google-cloud-vision.rb} +4 -11
- data/lib/google/cloud/vision.rb +131 -214
- data/lib/google/cloud/vision/version.rb +6 -2
- metadata +73 -101
- data/LICENSE +0 -201
- data/lib/google/cloud/vision/v1.rb +0 -249
- data/lib/google/cloud/vision/v1/credentials.rb +0 -42
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/geometry.rb +0 -66
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/image_annotator.rb +0 -923
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search.rb +0 -115
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/product_search_service.rb +0 -569
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/text_annotation.rb +0 -254
- data/lib/google/cloud/vision/v1/doc/google/cloud/vision/v1/web_detection.rb +0 -102
- data/lib/google/cloud/vision/v1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/vision/v1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/vision/v1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/vision/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/vision/v1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/vision/v1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/vision/v1/doc/google/type/color.rb +0 -161
- data/lib/google/cloud/vision/v1/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/vision/v1/geometry_pb.rb +0 -39
- data/lib/google/cloud/vision/v1/helpers.rb +0 -1154
- data/lib/google/cloud/vision/v1/image_annotator_client.rb +0 -519
- data/lib/google/cloud/vision/v1/image_annotator_client_config.json +0 -46
- data/lib/google/cloud/vision/v1/image_annotator_pb.rb +0 -344
- data/lib/google/cloud/vision/v1/image_annotator_services_pb.rb +0 -74
- data/lib/google/cloud/vision/v1/product_search_client.rb +0 -1493
- data/lib/google/cloud/vision/v1/product_search_client_config.json +0 -121
- data/lib/google/cloud/vision/v1/product_search_pb.rb +0 -54
- data/lib/google/cloud/vision/v1/product_search_service_pb.rb +0 -207
- data/lib/google/cloud/vision/v1/product_search_service_services_pb.rb +0 -233
- data/lib/google/cloud/vision/v1/text_annotation_pb.rb +0 -94
- data/lib/google/cloud/vision/v1/web_detection_pb.rb +0 -51
- data/lib/google/cloud/vision/v1p3beta1.rb +0 -249
- data/lib/google/cloud/vision/v1p3beta1/credentials.rb +0 -42
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/geometry.rb +0 -72
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/image_annotator.rb +0 -763
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search.rb +0 -156
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/product_search_service.rb +0 -536
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/text_annotation.rb +0 -255
- data/lib/google/cloud/vision/v1p3beta1/doc/google/cloud/vision/v1p3beta1/web_detection.rb +0 -101
- data/lib/google/cloud/vision/v1p3beta1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/vision/v1p3beta1/doc/google/protobuf/wrappers.rb +0 -26
- data/lib/google/cloud/vision/v1p3beta1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/color.rb +0 -161
- data/lib/google/cloud/vision/v1p3beta1/doc/google/type/latlng.rb +0 -31
- data/lib/google/cloud/vision/v1p3beta1/geometry_pb.rb +0 -43
- data/lib/google/cloud/vision/v1p3beta1/helpers.rb +0 -1154
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client.rb +0 -315
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_client_config.json +0 -36
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_pb.rb +0 -306
- data/lib/google/cloud/vision/v1p3beta1/image_annotator_services_pb.rb +0 -56
- data/lib/google/cloud/vision/v1p3beta1/product_search_client.rb +0 -1418
- data/lib/google/cloud/vision/v1p3beta1/product_search_client_config.json +0 -116
- data/lib/google/cloud/vision/v1p3beta1/product_search_pb.rb +0 -65
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_pb.rb +0 -194
- data/lib/google/cloud/vision/v1p3beta1/product_search_service_services_pb.rb +0 -223
- data/lib/google/cloud/vision/v1p3beta1/text_annotation_pb.rb +0 -94
- data/lib/google/cloud/vision/v1p3beta1/web_detection_pb.rb +0 -51
@@ -1,94 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# source: google/cloud/vision/v1/text_annotation.proto
|
3
|
-
|
4
|
-
|
5
|
-
require 'google/protobuf'
|
6
|
-
|
7
|
-
require 'google/cloud/vision/v1/geometry_pb'
|
8
|
-
require 'google/api/annotations_pb'
|
9
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
10
|
-
add_message "google.cloud.vision.v1.TextAnnotation" do
|
11
|
-
repeated :pages, :message, 1, "google.cloud.vision.v1.Page"
|
12
|
-
optional :text, :string, 2
|
13
|
-
end
|
14
|
-
add_message "google.cloud.vision.v1.TextAnnotation.DetectedLanguage" do
|
15
|
-
optional :language_code, :string, 1
|
16
|
-
optional :confidence, :float, 2
|
17
|
-
end
|
18
|
-
add_message "google.cloud.vision.v1.TextAnnotation.DetectedBreak" do
|
19
|
-
optional :type, :enum, 1, "google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType"
|
20
|
-
optional :is_prefix, :bool, 2
|
21
|
-
end
|
22
|
-
add_enum "google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType" do
|
23
|
-
value :UNKNOWN, 0
|
24
|
-
value :SPACE, 1
|
25
|
-
value :SURE_SPACE, 2
|
26
|
-
value :EOL_SURE_SPACE, 3
|
27
|
-
value :HYPHEN, 4
|
28
|
-
value :LINE_BREAK, 5
|
29
|
-
end
|
30
|
-
add_message "google.cloud.vision.v1.TextAnnotation.TextProperty" do
|
31
|
-
repeated :detected_languages, :message, 1, "google.cloud.vision.v1.TextAnnotation.DetectedLanguage"
|
32
|
-
optional :detected_break, :message, 2, "google.cloud.vision.v1.TextAnnotation.DetectedBreak"
|
33
|
-
end
|
34
|
-
add_message "google.cloud.vision.v1.Page" do
|
35
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
36
|
-
optional :width, :int32, 2
|
37
|
-
optional :height, :int32, 3
|
38
|
-
repeated :blocks, :message, 4, "google.cloud.vision.v1.Block"
|
39
|
-
optional :confidence, :float, 5
|
40
|
-
end
|
41
|
-
add_message "google.cloud.vision.v1.Block" do
|
42
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
43
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
44
|
-
repeated :paragraphs, :message, 3, "google.cloud.vision.v1.Paragraph"
|
45
|
-
optional :block_type, :enum, 4, "google.cloud.vision.v1.Block.BlockType"
|
46
|
-
optional :confidence, :float, 5
|
47
|
-
end
|
48
|
-
add_enum "google.cloud.vision.v1.Block.BlockType" do
|
49
|
-
value :UNKNOWN, 0
|
50
|
-
value :TEXT, 1
|
51
|
-
value :TABLE, 2
|
52
|
-
value :PICTURE, 3
|
53
|
-
value :RULER, 4
|
54
|
-
value :BARCODE, 5
|
55
|
-
end
|
56
|
-
add_message "google.cloud.vision.v1.Paragraph" do
|
57
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
58
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
59
|
-
repeated :words, :message, 3, "google.cloud.vision.v1.Word"
|
60
|
-
optional :confidence, :float, 4
|
61
|
-
end
|
62
|
-
add_message "google.cloud.vision.v1.Word" do
|
63
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
64
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
65
|
-
repeated :symbols, :message, 3, "google.cloud.vision.v1.Symbol"
|
66
|
-
optional :confidence, :float, 4
|
67
|
-
end
|
68
|
-
add_message "google.cloud.vision.v1.Symbol" do
|
69
|
-
optional :property, :message, 1, "google.cloud.vision.v1.TextAnnotation.TextProperty"
|
70
|
-
optional :bounding_box, :message, 2, "google.cloud.vision.v1.BoundingPoly"
|
71
|
-
optional :text, :string, 3
|
72
|
-
optional :confidence, :float, 4
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
module Google
|
77
|
-
module Cloud
|
78
|
-
module Vision
|
79
|
-
module V1
|
80
|
-
TextAnnotation = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation").msgclass
|
81
|
-
TextAnnotation::DetectedLanguage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedLanguage").msgclass
|
82
|
-
TextAnnotation::DetectedBreak = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedBreak").msgclass
|
83
|
-
TextAnnotation::DetectedBreak::BreakType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType").enummodule
|
84
|
-
TextAnnotation::TextProperty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.TextAnnotation.TextProperty").msgclass
|
85
|
-
Page = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Page").msgclass
|
86
|
-
Block = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Block").msgclass
|
87
|
-
Block::BlockType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Block.BlockType").enummodule
|
88
|
-
Paragraph = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Paragraph").msgclass
|
89
|
-
Word = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Word").msgclass
|
90
|
-
Symbol = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.Symbol").msgclass
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
-
# source: google/cloud/vision/v1/web_detection.proto
|
3
|
-
|
4
|
-
|
5
|
-
require 'google/protobuf'
|
6
|
-
|
7
|
-
require 'google/api/annotations_pb'
|
8
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_message "google.cloud.vision.v1.WebDetection" do
|
10
|
-
repeated :web_entities, :message, 1, "google.cloud.vision.v1.WebDetection.WebEntity"
|
11
|
-
repeated :full_matching_images, :message, 2, "google.cloud.vision.v1.WebDetection.WebImage"
|
12
|
-
repeated :partial_matching_images, :message, 3, "google.cloud.vision.v1.WebDetection.WebImage"
|
13
|
-
repeated :pages_with_matching_images, :message, 4, "google.cloud.vision.v1.WebDetection.WebPage"
|
14
|
-
repeated :visually_similar_images, :message, 6, "google.cloud.vision.v1.WebDetection.WebImage"
|
15
|
-
repeated :best_guess_labels, :message, 8, "google.cloud.vision.v1.WebDetection.WebLabel"
|
16
|
-
end
|
17
|
-
add_message "google.cloud.vision.v1.WebDetection.WebEntity" do
|
18
|
-
optional :entity_id, :string, 1
|
19
|
-
optional :score, :float, 2
|
20
|
-
optional :description, :string, 3
|
21
|
-
end
|
22
|
-
add_message "google.cloud.vision.v1.WebDetection.WebImage" do
|
23
|
-
optional :url, :string, 1
|
24
|
-
optional :score, :float, 2
|
25
|
-
end
|
26
|
-
add_message "google.cloud.vision.v1.WebDetection.WebPage" do
|
27
|
-
optional :url, :string, 1
|
28
|
-
optional :score, :float, 2
|
29
|
-
optional :page_title, :string, 3
|
30
|
-
repeated :full_matching_images, :message, 4, "google.cloud.vision.v1.WebDetection.WebImage"
|
31
|
-
repeated :partial_matching_images, :message, 5, "google.cloud.vision.v1.WebDetection.WebImage"
|
32
|
-
end
|
33
|
-
add_message "google.cloud.vision.v1.WebDetection.WebLabel" do
|
34
|
-
optional :label, :string, 1
|
35
|
-
optional :language_code, :string, 2
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module Google
|
40
|
-
module Cloud
|
41
|
-
module Vision
|
42
|
-
module V1
|
43
|
-
WebDetection = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection").msgclass
|
44
|
-
WebDetection::WebEntity = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebEntity").msgclass
|
45
|
-
WebDetection::WebImage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebImage").msgclass
|
46
|
-
WebDetection::WebPage = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebPage").msgclass
|
47
|
-
WebDetection::WebLabel = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.vision.v1.WebDetection.WebLabel").msgclass
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,249 +0,0 @@
|
|
1
|
-
# Copyright 2020 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/vision/v1p3beta1/product_search_client"
|
17
|
-
require "google/cloud/vision/v1p3beta1/image_annotator_client"
|
18
|
-
require "google/cloud/vision/v1p3beta1/helpers"
|
19
|
-
require "google/cloud/vision/v1p3beta1/image_annotator_pb"
|
20
|
-
require "google/cloud/vision/v1p3beta1/product_search_service_pb"
|
21
|
-
|
22
|
-
module Google
|
23
|
-
module Cloud
|
24
|
-
module Vision
|
25
|
-
# rubocop:disable LineLength
|
26
|
-
|
27
|
-
##
|
28
|
-
# # Ruby Client for Cloud Vision API
|
29
|
-
#
|
30
|
-
# [Cloud Vision API][Product Documentation]:
|
31
|
-
# Integrates Google Vision features, including image labeling, face, logo, and
|
32
|
-
# landmark detection, optical character recognition (OCR), and detection of
|
33
|
-
# explicit content, into applications.
|
34
|
-
# - [Product Documentation][]
|
35
|
-
#
|
36
|
-
# ## Quick Start
|
37
|
-
# In order to use this library, you first need to go through the following
|
38
|
-
# steps:
|
39
|
-
#
|
40
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
41
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
42
|
-
# 3. [Enable the Cloud Vision API.](https://console.cloud.google.com/apis/library/vision.googleapis.com)
|
43
|
-
# 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-vision/latest/file.AUTHENTICATION.html)
|
44
|
-
#
|
45
|
-
# ### Installation
|
46
|
-
# ```
|
47
|
-
# $ gem install google-cloud-vision
|
48
|
-
# ```
|
49
|
-
#
|
50
|
-
# ### Preview
|
51
|
-
# #### ImageAnnotatorClient
|
52
|
-
# ```rb
|
53
|
-
# require "google/cloud/vision"
|
54
|
-
#
|
55
|
-
# image_annotator_client = Google::Cloud::Vision::ImageAnnotator.new(version: :v1p3beta1)
|
56
|
-
# gcs_image_uri = "gs://cloud-samples-data/vision/face_detection/celebrity_recognition/sergey.jpg"
|
57
|
-
# source = { gcs_image_uri: gcs_image_uri }
|
58
|
-
# image = { source: source }
|
59
|
-
# type = :FACE_DETECTION
|
60
|
-
# features_element = { type: type }
|
61
|
-
# features = [features_element]
|
62
|
-
# requests_element = { image: image, features: features }
|
63
|
-
# requests = [requests_element]
|
64
|
-
# response = image_annotator_client.batch_annotate_images(requests)
|
65
|
-
# ```
|
66
|
-
#
|
67
|
-
# ### Next Steps
|
68
|
-
# - Read the [Cloud Vision API Product documentation][Product Documentation]
|
69
|
-
# to learn more about the product and see How-to Guides.
|
70
|
-
# - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
|
71
|
-
# to see the full list of Cloud APIs that we cover.
|
72
|
-
#
|
73
|
-
# [Product Documentation]: https://cloud.google.com/vision
|
74
|
-
#
|
75
|
-
# ## Enabling Logging
|
76
|
-
#
|
77
|
-
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
78
|
-
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
79
|
-
# or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
80
|
-
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
81
|
-
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
82
|
-
#
|
83
|
-
# Configuring a Ruby stdlib logger:
|
84
|
-
#
|
85
|
-
# ```ruby
|
86
|
-
# require "logger"
|
87
|
-
#
|
88
|
-
# module MyLogger
|
89
|
-
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
90
|
-
# def logger
|
91
|
-
# LOGGER
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
#
|
95
|
-
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
96
|
-
# module GRPC
|
97
|
-
# extend MyLogger
|
98
|
-
# end
|
99
|
-
# ```
|
100
|
-
#
|
101
|
-
module V1p3beta1
|
102
|
-
# rubocop:enable LineLength
|
103
|
-
|
104
|
-
module ProductSearch
|
105
|
-
##
|
106
|
-
# Manages Products and ProductSets of reference images for use in product
|
107
|
-
# search. It uses the following resource model:
|
108
|
-
#
|
109
|
-
# * The API has a collection of {Google::Cloud::Vision::V1p3beta1::ProductSet ProductSet} resources, named
|
110
|
-
# `projects/*/locations/*/productSets/*`, which acts as a way to put different
|
111
|
-
# products into groups to limit identification.
|
112
|
-
#
|
113
|
-
# In parallel,
|
114
|
-
#
|
115
|
-
# * The API has a collection of {Google::Cloud::Vision::V1p3beta1::Product Product} resources, named
|
116
|
-
# `projects/*/locations/*/products/*`
|
117
|
-
#
|
118
|
-
# * Each {Google::Cloud::Vision::V1p3beta1::Product Product} has a collection of {Google::Cloud::Vision::V1p3beta1::ReferenceImage ReferenceImage} resources, named
|
119
|
-
# `projects/*/locations/*/products/*/referenceImages/*`
|
120
|
-
#
|
121
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
122
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
123
|
-
# be many types.
|
124
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
125
|
-
# authenticating requests made by this client.
|
126
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
127
|
-
# credentials for this client.
|
128
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
129
|
-
# credentials for this client.
|
130
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
131
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
132
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
133
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
134
|
-
# metadata for requests, generally, to give OAuth credentials.
|
135
|
-
# @param scopes [Array<String>]
|
136
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
137
|
-
# an updater_proc is supplied.
|
138
|
-
# @param client_config [Hash]
|
139
|
-
# A Hash for call options for each method. See
|
140
|
-
# Google::Gax#construct_settings for the structure of
|
141
|
-
# this data. Falls back to the default config if not specified
|
142
|
-
# or the specified config is missing data points.
|
143
|
-
# @param timeout [Numeric]
|
144
|
-
# The default timeout, in seconds, for calls made through this client.
|
145
|
-
# @param metadata [Hash]
|
146
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
147
|
-
# @param service_address [String]
|
148
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
149
|
-
# @param service_port [Integer]
|
150
|
-
# Override for the service port, or `nil` to leave as the default.
|
151
|
-
# @param exception_transformer [Proc]
|
152
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
153
|
-
# custom error handling.
|
154
|
-
def self.new \
|
155
|
-
credentials: nil,
|
156
|
-
scopes: nil,
|
157
|
-
client_config: nil,
|
158
|
-
timeout: nil,
|
159
|
-
metadata: nil,
|
160
|
-
service_address: nil,
|
161
|
-
service_port: nil,
|
162
|
-
exception_transformer: nil,
|
163
|
-
lib_name: nil,
|
164
|
-
lib_version: nil
|
165
|
-
kwargs = {
|
166
|
-
credentials: credentials,
|
167
|
-
scopes: scopes,
|
168
|
-
client_config: client_config,
|
169
|
-
timeout: timeout,
|
170
|
-
metadata: metadata,
|
171
|
-
exception_transformer: exception_transformer,
|
172
|
-
lib_name: lib_name,
|
173
|
-
service_address: service_address,
|
174
|
-
service_port: service_port,
|
175
|
-
lib_version: lib_version
|
176
|
-
}.select { |_, v| v != nil }
|
177
|
-
Google::Cloud::Vision::V1p3beta1::ProductSearchClient.new(**kwargs)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
module ImageAnnotator
|
182
|
-
##
|
183
|
-
# Service that performs Google Cloud Vision API detection tasks over client
|
184
|
-
# images, such as face, landmark, logo, label, and text detection. The
|
185
|
-
# ImageAnnotator service returns detected entities from the images.
|
186
|
-
#
|
187
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
188
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
189
|
-
# be many types.
|
190
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
191
|
-
# authenticating requests made by this client.
|
192
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
193
|
-
# credentials for this client.
|
194
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
195
|
-
# credentials for this client.
|
196
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
197
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
198
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
199
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
200
|
-
# metadata for requests, generally, to give OAuth credentials.
|
201
|
-
# @param scopes [Array<String>]
|
202
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
203
|
-
# an updater_proc is supplied.
|
204
|
-
# @param client_config [Hash]
|
205
|
-
# A Hash for call options for each method. See
|
206
|
-
# Google::Gax#construct_settings for the structure of
|
207
|
-
# this data. Falls back to the default config if not specified
|
208
|
-
# or the specified config is missing data points.
|
209
|
-
# @param timeout [Numeric]
|
210
|
-
# The default timeout, in seconds, for calls made through this client.
|
211
|
-
# @param metadata [Hash]
|
212
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
213
|
-
# @param service_address [String]
|
214
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
215
|
-
# @param service_port [Integer]
|
216
|
-
# Override for the service port, or `nil` to leave as the default.
|
217
|
-
# @param exception_transformer [Proc]
|
218
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
219
|
-
# custom error handling.
|
220
|
-
def self.new \
|
221
|
-
credentials: nil,
|
222
|
-
scopes: nil,
|
223
|
-
client_config: nil,
|
224
|
-
timeout: nil,
|
225
|
-
metadata: nil,
|
226
|
-
service_address: nil,
|
227
|
-
service_port: nil,
|
228
|
-
exception_transformer: nil,
|
229
|
-
lib_name: nil,
|
230
|
-
lib_version: nil
|
231
|
-
kwargs = {
|
232
|
-
credentials: credentials,
|
233
|
-
scopes: scopes,
|
234
|
-
client_config: client_config,
|
235
|
-
timeout: timeout,
|
236
|
-
metadata: metadata,
|
237
|
-
exception_transformer: exception_transformer,
|
238
|
-
lib_name: lib_name,
|
239
|
-
service_address: service_address,
|
240
|
-
service_port: service_port,
|
241
|
-
lib_version: lib_version
|
242
|
-
}.select { |_, v| v != nil }
|
243
|
-
Google::Cloud::Vision::V1p3beta1::ImageAnnotatorClient.new(**kwargs)
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Copyright 2020 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 "googleauth"
|
17
|
-
|
18
|
-
module Google
|
19
|
-
module Cloud
|
20
|
-
module Vision
|
21
|
-
module V1p3beta1
|
22
|
-
class Credentials < Google::Auth::Credentials
|
23
|
-
SCOPE = [
|
24
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
25
|
-
"https://www.googleapis.com/auth/cloud-vision"
|
26
|
-
].freeze
|
27
|
-
PATH_ENV_VARS = %w(VISION_CREDENTIALS
|
28
|
-
VISION_KEYFILE
|
29
|
-
GOOGLE_CLOUD_CREDENTIALS
|
30
|
-
GOOGLE_CLOUD_KEYFILE
|
31
|
-
GCLOUD_KEYFILE)
|
32
|
-
JSON_ENV_VARS = %w(VISION_CREDENTIALS_JSON
|
33
|
-
VISION_KEYFILE_JSON
|
34
|
-
GOOGLE_CLOUD_CREDENTIALS_JSON
|
35
|
-
GOOGLE_CLOUD_KEYFILE_JSON
|
36
|
-
GCLOUD_KEYFILE_JSON)
|
37
|
-
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# Copyright 2020 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
|
-
module Google
|
17
|
-
module Cloud
|
18
|
-
module Vision
|
19
|
-
module V1p3beta1
|
20
|
-
# A vertex represents a 2D point in the image.
|
21
|
-
# NOTE: the vertex coordinates are in the same scale as the original image.
|
22
|
-
# @!attribute [rw] x
|
23
|
-
# @return [Integer]
|
24
|
-
# X coordinate.
|
25
|
-
# @!attribute [rw] y
|
26
|
-
# @return [Integer]
|
27
|
-
# Y coordinate.
|
28
|
-
class Vertex; end
|
29
|
-
|
30
|
-
# A vertex represents a 2D point in the image.
|
31
|
-
# NOTE: the normalized vertex coordinates are relative to the original image
|
32
|
-
# and range from 0 to 1.
|
33
|
-
# @!attribute [rw] x
|
34
|
-
# @return [Float]
|
35
|
-
# X coordinate.
|
36
|
-
# @!attribute [rw] y
|
37
|
-
# @return [Float]
|
38
|
-
# Y coordinate.
|
39
|
-
class NormalizedVertex; end
|
40
|
-
|
41
|
-
# A bounding polygon for the detected image annotation.
|
42
|
-
# @!attribute [rw] vertices
|
43
|
-
# @return [Array<Google::Cloud::Vision::V1p3beta1::Vertex>]
|
44
|
-
# The bounding polygon vertices.
|
45
|
-
# @!attribute [rw] normalized_vertices
|
46
|
-
# @return [Array<Google::Cloud::Vision::V1p3beta1::NormalizedVertex>]
|
47
|
-
# The bounding polygon normalized vertices.
|
48
|
-
class BoundingPoly; end
|
49
|
-
|
50
|
-
# A normalized bounding polygon around a portion of an image.
|
51
|
-
# @!attribute [rw] vertices
|
52
|
-
# @return [Array<Google::Cloud::Vision::V1p3beta1::NormalizedVertex>]
|
53
|
-
# Normalized vertices of the bounding polygon.
|
54
|
-
class NormalizedBoundingPoly; end
|
55
|
-
|
56
|
-
# A 3D position in the image, used primarily for Face detection landmarks.
|
57
|
-
# A valid Position must have both x and y coordinates.
|
58
|
-
# The position coordinates are in the same scale as the original image.
|
59
|
-
# @!attribute [rw] x
|
60
|
-
# @return [Float]
|
61
|
-
# X coordinate.
|
62
|
-
# @!attribute [rw] y
|
63
|
-
# @return [Float]
|
64
|
-
# Y coordinate.
|
65
|
-
# @!attribute [rw] z
|
66
|
-
# @return [Float]
|
67
|
-
# Z coordinate (or depth).
|
68
|
-
class Position; end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|