google-cloud-vision 1.5.1 → 1.6.0
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/README.md +32 -1
- data/lib/google/cloud/vision/version.rb +1 -1
- data/lib/google/cloud/vision.rb +72 -0
- metadata +4 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b36262ed11dfac90f242e54b105fd6d3c5a3e5a5a544ba19b3c9a391374d913f
|
4
|
+
data.tar.gz: 93a6e6b795a68a6c1eca98af19397ee8ac503ee6e03614bbc947bfc06e5a3e80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce1096ba3ca0763570677e86d28d7d08590f0688df6e77ef20c8edb5ae0123af338d780027c8bc267eacb5ab351ed49f103c73d02d3f0dc7cb58c81666f610dd
|
7
|
+
data.tar.gz: d7e6cf7ae8c426b94f411305721fcb83bec6616b01a064d8e65361e9ac729bb27cd35b7549081819e2287fbdf6b89b165b1495f4f60848f5f3bed08ff3f0e6f2
|
data/README.md
CHANGED
@@ -43,9 +43,40 @@ and includes substantial interface changes. Existing code written for earlier
|
|
43
43
|
versions of this library will likely require updates to use this version.
|
44
44
|
See the {file:MIGRATING.md MIGRATING.md} document for more information.
|
45
45
|
|
46
|
+
## Debug Logging
|
47
|
+
|
48
|
+
This library comes with opt-in Debug Logging that can help you troubleshoot
|
49
|
+
your application's integration with the API. When logging is activated, key
|
50
|
+
events such as requests and responses, along with data payloads and metadata
|
51
|
+
such as headers and client configuration, are logged to the standard error
|
52
|
+
stream.
|
53
|
+
|
54
|
+
**WARNING:** Client Library Debug Logging includes your data payloads in
|
55
|
+
plaintext, which could include sensitive data such as PII for yourself or your
|
56
|
+
customers, private keys, or other security data that could be compromising if
|
57
|
+
leaked. Always practice good data hygiene with your application logs, and follow
|
58
|
+
the principle of least access. Google also recommends that Client Library Debug
|
59
|
+
Logging be enabled only temporarily during active debugging, and not used
|
60
|
+
permanently in production.
|
61
|
+
|
62
|
+
To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
|
63
|
+
to the value `all`. Alternatively, you can set the value to a comma-delimited
|
64
|
+
list of client library gem names. This will select the default logging behavior,
|
65
|
+
which writes logs to the standard error stream. On a local workstation, this may
|
66
|
+
result in logs appearing on the console. When running on a Google Cloud hosting
|
67
|
+
service such as [Google Cloud Run](https://cloud.google.com/run), this generally
|
68
|
+
results in logs appearing alongside your application logs in the
|
69
|
+
[Google Cloud Logging](https://cloud.google.com/logging/) service.
|
70
|
+
|
71
|
+
Debug logging also requires that the versioned clients for this service be
|
72
|
+
sufficiently recent, released after about Dec 10, 2024. If logging is not
|
73
|
+
working, try updating the versioned clients in your bundle or installed gems:
|
74
|
+
[google-cloud-vision-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-vision-v1/latest),
|
75
|
+
[google-cloud-vision-v1p3beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-vision-v1p3beta1/latest).
|
76
|
+
|
46
77
|
## Supported Ruby Versions
|
47
78
|
|
48
|
-
This library is supported on Ruby
|
79
|
+
This library is supported on Ruby 3.0+.
|
49
80
|
|
50
81
|
Google provides official support for Ruby versions that are actively supported
|
51
82
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
data/lib/google/cloud/vision.rb
CHANGED
@@ -58,6 +58,11 @@ module Google
|
|
58
58
|
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
59
59
|
# the `transport` parameter.
|
60
60
|
#
|
61
|
+
# Raises an exception if the currently installed versioned client gem for the
|
62
|
+
# given API version does not support the given transport of the ProductSearch service.
|
63
|
+
# You can determine whether the method will succeed by calling
|
64
|
+
# {Google::Cloud::Vision.product_search_available?}.
|
65
|
+
#
|
61
66
|
# ## About ProductSearch
|
62
67
|
#
|
63
68
|
# Manages Products and ProductSets of reference images for use in product
|
@@ -94,6 +99,37 @@ module Google
|
|
94
99
|
service_module.const_get(:Client).new(&block)
|
95
100
|
end
|
96
101
|
|
102
|
+
##
|
103
|
+
# Determines whether the ProductSearch service is supported by the current client.
|
104
|
+
# If true, you can retrieve a client object by calling {Google::Cloud::Vision.product_search}.
|
105
|
+
# If false, that method will raise an exception. This could happen if the given
|
106
|
+
# API version does not exist or does not support the ProductSearch service,
|
107
|
+
# or if the versioned client gem needs an update to support the ProductSearch service.
|
108
|
+
#
|
109
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
110
|
+
# Defaults to `:v1`.
|
111
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
112
|
+
# @return [boolean] Whether the service is available.
|
113
|
+
#
|
114
|
+
def self.product_search_available? version: :v1, transport: :grpc
|
115
|
+
require "google/cloud/vision/#{version.to_s.downcase}"
|
116
|
+
package_name = Google::Cloud::Vision
|
117
|
+
.constants
|
118
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
119
|
+
.first
|
120
|
+
return false unless package_name
|
121
|
+
service_module = Google::Cloud::Vision.const_get package_name
|
122
|
+
return false unless service_module.const_defined? :ProductSearch
|
123
|
+
service_module = service_module.const_get :ProductSearch
|
124
|
+
if transport == :rest
|
125
|
+
return false unless service_module.const_defined? :Rest
|
126
|
+
service_module = service_module.const_get :Rest
|
127
|
+
end
|
128
|
+
service_module.const_defined? :Client
|
129
|
+
rescue ::LoadError
|
130
|
+
false
|
131
|
+
end
|
132
|
+
|
97
133
|
##
|
98
134
|
# Create a new client object for ImageAnnotator.
|
99
135
|
#
|
@@ -107,6 +143,11 @@ module Google
|
|
107
143
|
# You can also specify a different transport by passing `:rest` or `:grpc` in
|
108
144
|
# the `transport` parameter.
|
109
145
|
#
|
146
|
+
# Raises an exception if the currently installed versioned client gem for the
|
147
|
+
# given API version does not support the given transport of the ImageAnnotator service.
|
148
|
+
# You can determine whether the method will succeed by calling
|
149
|
+
# {Google::Cloud::Vision.image_annotator_available?}.
|
150
|
+
#
|
110
151
|
# ## About ImageAnnotator
|
111
152
|
#
|
112
153
|
# Service that performs Google Cloud Vision API detection tasks over client
|
@@ -130,6 +171,37 @@ module Google
|
|
130
171
|
service_module.const_get(:Client).new(&block)
|
131
172
|
end
|
132
173
|
|
174
|
+
##
|
175
|
+
# Determines whether the ImageAnnotator service is supported by the current client.
|
176
|
+
# If true, you can retrieve a client object by calling {Google::Cloud::Vision.image_annotator}.
|
177
|
+
# If false, that method will raise an exception. This could happen if the given
|
178
|
+
# API version does not exist or does not support the ImageAnnotator service,
|
179
|
+
# or if the versioned client gem needs an update to support the ImageAnnotator service.
|
180
|
+
#
|
181
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
182
|
+
# Defaults to `:v1`.
|
183
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
184
|
+
# @return [boolean] Whether the service is available.
|
185
|
+
#
|
186
|
+
def self.image_annotator_available? version: :v1, transport: :grpc
|
187
|
+
require "google/cloud/vision/#{version.to_s.downcase}"
|
188
|
+
package_name = Google::Cloud::Vision
|
189
|
+
.constants
|
190
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
191
|
+
.first
|
192
|
+
return false unless package_name
|
193
|
+
service_module = Google::Cloud::Vision.const_get package_name
|
194
|
+
return false unless service_module.const_defined? :ImageAnnotator
|
195
|
+
service_module = service_module.const_get :ImageAnnotator
|
196
|
+
if transport == :rest
|
197
|
+
return false unless service_module.const_defined? :Rest
|
198
|
+
service_module = service_module.const_get :Rest
|
199
|
+
end
|
200
|
+
service_module.const_defined? :Client
|
201
|
+
rescue ::LoadError
|
202
|
+
false
|
203
|
+
end
|
204
|
+
|
133
205
|
##
|
134
206
|
# Configure the google-cloud-vision library.
|
135
207
|
#
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-vision
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: google-cloud-core
|
@@ -84,7 +83,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
|
|
84
83
|
licenses:
|
85
84
|
- Apache-2.0
|
86
85
|
metadata: {}
|
87
|
-
post_install_message:
|
88
86
|
rdoc_options: []
|
89
87
|
require_paths:
|
90
88
|
- lib
|
@@ -92,15 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
90
|
requirements:
|
93
91
|
- - ">="
|
94
92
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
93
|
+
version: '3.0'
|
96
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
95
|
requirements:
|
98
96
|
- - ">="
|
99
97
|
- !ruby/object:Gem::Version
|
100
98
|
version: '0'
|
101
99
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
100
|
+
rubygems_version: 3.6.2
|
104
101
|
specification_version: 4
|
105
102
|
summary: API Client library for the Cloud Vision API
|
106
103
|
test_files: []
|