google-cloud-video_intelligence 3.5.1 → 4.0.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/.yardopts +0 -1
- data/README.md +31 -12
- data/lib/google/cloud/video_intelligence/version.rb +1 -1
- data/lib/google/cloud/video_intelligence.rb +36 -0
- metadata +8 -78
- data/MIGRATING.md +0 -274
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c3c6b34d2c24222f209504184370bdecbe159252513d47c14424682c74146a1
|
4
|
+
data.tar.gz: 0c6af1d6bea2bff39b4588f5435cc447b5ad906e7a4843ecae9a23d28e9e3c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34972da33f079c2efd53b7a3bf1de2955fdaca90864a9503b425c9e0ef1d8dc794ec6cc1a3dc09725210835b8d0ef5c19b30ccb2c40122dc58cf022769cd7d21
|
7
|
+
data.tar.gz: 11db4c5e79dca79474a568581ccf08819f40733c7f31540682810036b48b0fb6976ddf51bedccf516c8c75e0ef70de372f0f06fc3afb2675c1b54f6e8ba65b60
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -16,10 +16,7 @@ for this library, google-cloud-video_intelligence, to see the convenience method
|
|
16
16
|
constructing client objects. Reference documentation for the client objects
|
17
17
|
themselves can be found in the client library documentation for the versioned
|
18
18
|
client gems:
|
19
|
-
[google-cloud-video_intelligence-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1/latest)
|
20
|
-
[google-cloud-video_intelligence-v1beta2](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1beta2/latest),
|
21
|
-
[google-cloud-video_intelligence-v1p1beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1p1beta1/latest),
|
22
|
-
[google-cloud-video_intelligence-v1p2beta1](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1p2beta1/latest).
|
19
|
+
[google-cloud-video_intelligence-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1/latest).
|
23
20
|
|
24
21
|
See also the [Product Documentation](https://cloud.google.com/video-intelligence)
|
25
22
|
for more usage information.
|
@@ -37,17 +34,39 @@ In order to use this library, you first need to go through the following steps:
|
|
37
34
|
1. [Enable the API.](https://console.cloud.google.com/apis/library/videointelligence.googleapis.com)
|
38
35
|
1. {file:AUTHENTICATION.md Set up authentication.}
|
39
36
|
|
40
|
-
##
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
## Debug Logging
|
38
|
+
|
39
|
+
This library comes with opt-in Debug Logging that can help you troubleshoot
|
40
|
+
your application's integration with the API. When logging is activated, key
|
41
|
+
events such as requests and responses, along with data payloads and metadata
|
42
|
+
such as headers and client configuration, are logged to the standard error
|
43
|
+
stream.
|
44
|
+
|
45
|
+
**WARNING:** Client Library Debug Logging includes your data payloads in
|
46
|
+
plaintext, which could include sensitive data such as PII for yourself or your
|
47
|
+
customers, private keys, or other security data that could be compromising if
|
48
|
+
leaked. Always practice good data hygiene with your application logs, and follow
|
49
|
+
the principle of least access. Google also recommends that Client Library Debug
|
50
|
+
Logging be enabled only temporarily during active debugging, and not used
|
51
|
+
permanently in production.
|
52
|
+
|
53
|
+
To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
|
54
|
+
to the value `all`. Alternatively, you can set the value to a comma-delimited
|
55
|
+
list of client library gem names. This will select the default logging behavior,
|
56
|
+
which writes logs to the standard error stream. On a local workstation, this may
|
57
|
+
result in logs appearing on the console. When running on a Google Cloud hosting
|
58
|
+
service such as [Google Cloud Run](https://cloud.google.com/run), this generally
|
59
|
+
results in logs appearing alongside your application logs in the
|
60
|
+
[Google Cloud Logging](https://cloud.google.com/logging/) service.
|
61
|
+
|
62
|
+
Debug logging also requires that the versioned clients for this service be
|
63
|
+
sufficiently recent, released after about Dec 10, 2024. If logging is not
|
64
|
+
working, try updating the versioned clients in your bundle or installed gems:
|
65
|
+
[google-cloud-video_intelligence-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-video_intelligence-v1/latest).
|
47
66
|
|
48
67
|
## Supported Ruby Versions
|
49
68
|
|
50
|
-
This library is supported on Ruby
|
69
|
+
This library is supported on Ruby 3.0+.
|
51
70
|
|
52
71
|
Google provides official support for Ruby versions that are actively supported
|
53
72
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
@@ -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 VideoIntelligenceService service.
|
63
|
+
# You can determine whether the method will succeed by calling
|
64
|
+
# {Google::Cloud::VideoIntelligence.video_intelligence_service_available?}.
|
65
|
+
#
|
61
66
|
# ## About VideoIntelligenceService
|
62
67
|
#
|
63
68
|
# Service that implements the Video Intelligence API.
|
@@ -79,6 +84,37 @@ module Google
|
|
79
84
|
service_module.const_get(:Client).new(&block)
|
80
85
|
end
|
81
86
|
|
87
|
+
##
|
88
|
+
# Determines whether the VideoIntelligenceService service is supported by the current client.
|
89
|
+
# If true, you can retrieve a client object by calling {Google::Cloud::VideoIntelligence.video_intelligence_service}.
|
90
|
+
# If false, that method will raise an exception. This could happen if the given
|
91
|
+
# API version does not exist or does not support the VideoIntelligenceService service,
|
92
|
+
# or if the versioned client gem needs an update to support the VideoIntelligenceService service.
|
93
|
+
#
|
94
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
95
|
+
# Defaults to `:v1`.
|
96
|
+
# @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
|
97
|
+
# @return [boolean] Whether the service is available.
|
98
|
+
#
|
99
|
+
def self.video_intelligence_service_available? version: :v1, transport: :grpc
|
100
|
+
require "google/cloud/video_intelligence/#{version.to_s.downcase}"
|
101
|
+
package_name = Google::Cloud::VideoIntelligence
|
102
|
+
.constants
|
103
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
104
|
+
.first
|
105
|
+
return false unless package_name
|
106
|
+
service_module = Google::Cloud::VideoIntelligence.const_get package_name
|
107
|
+
return false unless service_module.const_defined? :VideoIntelligenceService
|
108
|
+
service_module = service_module.const_get :VideoIntelligenceService
|
109
|
+
if transport == :rest
|
110
|
+
return false unless service_module.const_defined? :Rest
|
111
|
+
service_module = service_module.const_get :Rest
|
112
|
+
end
|
113
|
+
service_module.const_defined? :Client
|
114
|
+
rescue ::LoadError
|
115
|
+
false
|
116
|
+
end
|
117
|
+
|
82
118
|
##
|
83
119
|
# Configure the google-cloud-video_intelligence library.
|
84
120
|
#
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-video_intelligence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.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-02-13 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: google-cloud-core
|
@@ -28,82 +27,16 @@ dependencies:
|
|
28
27
|
name: google-cloud-video_intelligence-v1
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
|
-
- - "
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.11'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 2.a
|
37
|
-
type: :runtime
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '0.11'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 2.a
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: google-cloud-video_intelligence-v1beta2
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0.9'
|
54
|
-
- - "<"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: 2.a
|
57
|
-
type: :runtime
|
58
|
-
prerelease: false
|
59
|
-
version_requirements: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0.9'
|
64
|
-
- - "<"
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: 2.a
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
name: google-cloud-video_intelligence-v1p1beta1
|
69
|
-
requirement: !ruby/object:Gem::Requirement
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
version: '0.9'
|
74
|
-
- - "<"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: 2.a
|
77
|
-
type: :runtime
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ">="
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0.9'
|
84
|
-
- - "<"
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: 2.a
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
name: google-cloud-video_intelligence-v1p2beta1
|
89
|
-
requirement: !ruby/object:Gem::Requirement
|
90
|
-
requirements:
|
91
|
-
- - ">="
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0.10'
|
94
|
-
- - "<"
|
30
|
+
- - "~>"
|
95
31
|
- !ruby/object:Gem::Version
|
96
|
-
version: 2
|
32
|
+
version: '1.2'
|
97
33
|
type: :runtime
|
98
34
|
prerelease: false
|
99
35
|
version_requirements: !ruby/object:Gem::Requirement
|
100
36
|
requirements:
|
101
|
-
- - "
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.10'
|
104
|
-
- - "<"
|
37
|
+
- - "~>"
|
105
38
|
- !ruby/object:Gem::Version
|
106
|
-
version: 2
|
39
|
+
version: '1.2'
|
107
40
|
description: Detects objects, explicit content, and scene changes in videos. It also
|
108
41
|
specifies the region for annotation and transcribes speech to text. Supports both
|
109
42
|
asynchronous API and streaming API.
|
@@ -115,7 +48,6 @@ files:
|
|
115
48
|
- ".yardopts"
|
116
49
|
- AUTHENTICATION.md
|
117
50
|
- LICENSE.md
|
118
|
-
- MIGRATING.md
|
119
51
|
- README.md
|
120
52
|
- lib/google-cloud-video_intelligence.rb
|
121
53
|
- lib/google/cloud/video_intelligence.rb
|
@@ -124,7 +56,6 @@ homepage: https://github.com/googleapis/google-cloud-ruby
|
|
124
56
|
licenses:
|
125
57
|
- Apache-2.0
|
126
58
|
metadata: {}
|
127
|
-
post_install_message:
|
128
59
|
rdoc_options: []
|
129
60
|
require_paths:
|
130
61
|
- lib
|
@@ -132,15 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
63
|
requirements:
|
133
64
|
- - ">="
|
134
65
|
- !ruby/object:Gem::Version
|
135
|
-
version: '
|
66
|
+
version: '3.0'
|
136
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
68
|
requirements:
|
138
69
|
- - ">="
|
139
70
|
- !ruby/object:Gem::Version
|
140
71
|
version: '0'
|
141
72
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
143
|
-
signing_key:
|
73
|
+
rubygems_version: 3.6.3
|
144
74
|
specification_version: 4
|
145
75
|
summary: API Client library for the Cloud Video Intelligence API
|
146
76
|
test_files: []
|
data/MIGRATING.md
DELETED
@@ -1,274 +0,0 @@
|
|
1
|
-
## Migrating to google-cloud-video_intelligence 3.0
|
2
|
-
|
3
|
-
The 3.0 release of the google-cloud-video_intelligence client is a significant upgrade
|
4
|
-
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
5
|
-
and includes substantial interface changes. Existing code written for earlier
|
6
|
-
versions of this library will likely require updates to use this version.
|
7
|
-
This document describes the changes that have been made, and what you need to
|
8
|
-
do to update your usage.
|
9
|
-
|
10
|
-
To summarize:
|
11
|
-
|
12
|
-
* The library has been broken out into multiple libraries. The new gems
|
13
|
-
`google-cloud-video_intelligence-v1`, `google-cloud-video_intelligence-v1beta2`,
|
14
|
-
`google-cloud-video_intelligence-v1p1beta1`, and
|
15
|
-
`google-cloud-video_intelligence-v1p2beta1` contain the
|
16
|
-
actual client classes for the various versions of the VideoIntelligence service,
|
17
|
-
and the gem `google-cloud-video_intelligence` now simply provides a convenience wrapper.
|
18
|
-
See [Library Structure](#library-structure) for more info.
|
19
|
-
* The library uses a new configuration mechanism giving you closer control
|
20
|
-
over endpoint address, network timeouts, and retry. See
|
21
|
-
[Client Configuration](#client-configuration) for more info. Furthermore,
|
22
|
-
when creating a client object, you can customize its configuration in a
|
23
|
-
block rather than passing arguments to the constructor. See
|
24
|
-
[Creating Clients](#creating-clients) for more info.
|
25
|
-
* Previously, positional arguments were used to indicate required arguments.
|
26
|
-
Now, all method arguments are keyword arguments, with documentation that
|
27
|
-
specifies whether they are required or optional. Additionally, you can pass
|
28
|
-
a proto request object instead of separate arguments. See
|
29
|
-
[Passing Arguments](#passing-arguments) for more info.
|
30
|
-
* Previously, clients reported RPC errors by raising instances of
|
31
|
-
`Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
|
32
|
-
`Google::Cloud::Error` and its subclasses. See
|
33
|
-
[Handling Errors](#handling-errors) for more info.
|
34
|
-
* Some classes have moved into different namespaces. See
|
35
|
-
[Class Namespaces](#class-namespaces) for more info.
|
36
|
-
|
37
|
-
### Library Structure
|
38
|
-
|
39
|
-
Older releases of the `google-cloud-video_intelligence` gem were all-in-one gems
|
40
|
-
that included potentially multiple clients for multiple versions of the Video Intelligence
|
41
|
-
service. The `Google::Cloud::VideoIntelligence.new` factory method would
|
42
|
-
return you an instance of a `Google::Cloud::VideoIntelligence::V1::VideoIntelligenceServiceClient`
|
43
|
-
object for the V1 version of the service, (or other corresponding classes for
|
44
|
-
other versions of the service). All these classes were defined in the same gem.
|
45
|
-
|
46
|
-
With the 3.0 release, the `google-cloud-video_intelligence` gem still provides factory
|
47
|
-
methods for obtaining clients. (The method signatures will have changed. See
|
48
|
-
[Creating Clients](#creating-clients) for details.) However, the actual client
|
49
|
-
classes have been moved into separate gems, one per service version. The
|
50
|
-
`Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Client` class, along with its
|
51
|
-
helpers and data types, is now part of the `google-cloud-video_intelligence-v1` gem.
|
52
|
-
Corresponding classes for other versions of the service are similarly moved to
|
53
|
-
other gems with the version in the gem name.
|
54
|
-
|
55
|
-
For normal usage, you can continue to install the `google-cloud-video_intelligence` gem
|
56
|
-
(which will bring in the versioned client gems as dependencies) and continue to
|
57
|
-
use factory methods to create clients. However, you may alternatively choose to
|
58
|
-
install only one of the versioned gems. For example, if you know you will only
|
59
|
-
use `V1` of the service, you can install `google-cloud-video_intelligence-v1` by
|
60
|
-
itself, and construct instances of the
|
61
|
-
`Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Client` client class directly.
|
62
|
-
|
63
|
-
### Client Configuration
|
64
|
-
|
65
|
-
In older releases, if you wanted to customize performance parameters or
|
66
|
-
low-level behavior of the client (such as credentials, timeouts, or
|
67
|
-
instrumentation), you would pass a variety of keyword arguments to the client
|
68
|
-
constructor. It was also extremely difficult to customize the default settings.
|
69
|
-
|
70
|
-
With the 3.0 release, a configuration interface provides control over these
|
71
|
-
parameters, including defaults for all instances of a client, and settings for
|
72
|
-
each specific client instance. For example, to set default credentials and
|
73
|
-
timeout for all Speech V1 clients:
|
74
|
-
|
75
|
-
```
|
76
|
-
Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Client.configure do |config|
|
77
|
-
config.credentials = "/path/to/credentials.json"
|
78
|
-
config.timeout = 10.0
|
79
|
-
end
|
80
|
-
```
|
81
|
-
|
82
|
-
Individual RPCs can also be configured independently. For example, to set the
|
83
|
-
timeout for the `annotate_video` call:
|
84
|
-
|
85
|
-
```
|
86
|
-
Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Client.configure do |config|
|
87
|
-
config.rpcs.annotate_video.timeout = 20.0
|
88
|
-
end
|
89
|
-
```
|
90
|
-
|
91
|
-
Defaults for certain configurations can be set for all Video Intelligence versions and
|
92
|
-
services globally:
|
93
|
-
|
94
|
-
```
|
95
|
-
Google::Cloud::VideoIntelligence.configure do |config|
|
96
|
-
config.credentials = "/path/to/credentials.json"
|
97
|
-
config.timeout = 10.0
|
98
|
-
end
|
99
|
-
```
|
100
|
-
|
101
|
-
Finally, you can override the configuration for each client instance. See the
|
102
|
-
next section on [Creating Clients](#creating-clients) for details.
|
103
|
-
|
104
|
-
### Creating Clients
|
105
|
-
|
106
|
-
In older releases, to create a client object, you would use the
|
107
|
-
`Google::Cloud::VideoIntelligence.new` class method. Keyword arguments were available to
|
108
|
-
select a service version and to configure parameters such as credentials and
|
109
|
-
timeouts.
|
110
|
-
|
111
|
-
With the 3.0 release, use the `Google::Cloud::VideoIntelligence.video_intelligence_service` class
|
112
|
-
method to create a client object. You may select a service version using the
|
113
|
-
`:version` keyword argument. However, other configuration parameters should be
|
114
|
-
set in a configuration block when you create the client.
|
115
|
-
|
116
|
-
Old:
|
117
|
-
```
|
118
|
-
client = Google::Cloud::VideoIntelligence.new credentials: "/path/to/credentials.json"
|
119
|
-
```
|
120
|
-
|
121
|
-
New:
|
122
|
-
```
|
123
|
-
client = Google::Cloud::VideoIntelligence.video_intelligence_service do |config|
|
124
|
-
config.credentials = "/path/to/credentials.json"
|
125
|
-
end
|
126
|
-
```
|
127
|
-
|
128
|
-
The configuration block is optional. If you do not provide it, or you do not
|
129
|
-
set some configuration parameters, then the default configuration is used. See
|
130
|
-
[Client Configuration](#client-configuration).
|
131
|
-
|
132
|
-
### Passing Arguments
|
133
|
-
|
134
|
-
In older releases, required arguments would be passed as positional method
|
135
|
-
arguments, while most optional arguments would be passed as keyword arguments.
|
136
|
-
|
137
|
-
With the 3.0 release, all RPC arguments are passed as keyword arguments,
|
138
|
-
regardless of whether they are required or optional. For example:
|
139
|
-
|
140
|
-
Old:
|
141
|
-
```
|
142
|
-
client = Google::Cloud::VideoIntelligence.new
|
143
|
-
|
144
|
-
features = [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION]
|
145
|
-
input_uri = "gs://my-bucket/my-video"
|
146
|
-
|
147
|
-
# features is a positional argument, but input_uri is a keyword argument
|
148
|
-
response = client.annotate_video features, input_uri: input_uri
|
149
|
-
```
|
150
|
-
|
151
|
-
New:
|
152
|
-
```
|
153
|
-
client = Google::Cloud::VideoIntelligence.video_intelligence_service
|
154
|
-
|
155
|
-
features = [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION]
|
156
|
-
input_uri = "gs://my-bucket/my-video"
|
157
|
-
|
158
|
-
# features and input_uri are both keyword arguments
|
159
|
-
response = client.annotate_video features: features, input_uri: input_uri
|
160
|
-
```
|
161
|
-
|
162
|
-
In the 3.0 release, it is also possible to pass a request object, either
|
163
|
-
as a hash or as a protocol buffer.
|
164
|
-
|
165
|
-
New:
|
166
|
-
```
|
167
|
-
client = Google::Cloud::VideoIntelligence.video_intelligence_service
|
168
|
-
|
169
|
-
request = Google::Cloud::VideoIntelligence::V1::AnnotateVideoRequest.new(
|
170
|
-
features: [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION],
|
171
|
-
input_uri: "gs://my-bucket/my-video"
|
172
|
-
)
|
173
|
-
|
174
|
-
# Pass a request object as a positional argument:
|
175
|
-
response = client.annotate_video request
|
176
|
-
```
|
177
|
-
|
178
|
-
Finally, in older releases, to provide call options, you would pass a
|
179
|
-
`Google::Gax::CallOptions` object with the `:options` keyword argument. In the
|
180
|
-
3.0 release, pass call options using a _second set_ of keyword arguments.
|
181
|
-
|
182
|
-
Old:
|
183
|
-
```
|
184
|
-
client = Google::Cloud::VideoIntelligence.new
|
185
|
-
|
186
|
-
features = [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION]
|
187
|
-
input_uri = "gs://my-bucket/my-video"
|
188
|
-
|
189
|
-
options = Google::Gax::CallOptions.new timeout: 10.0
|
190
|
-
|
191
|
-
response = client.annotate_video features, input_uri: input_uri, options: options
|
192
|
-
```
|
193
|
-
|
194
|
-
New:
|
195
|
-
```
|
196
|
-
client = Google::Cloud::VideoIntelligence.video_intelligence_service
|
197
|
-
|
198
|
-
features = [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION]
|
199
|
-
input_uri = "gs://my-bucket/my-video"
|
200
|
-
|
201
|
-
# Use a hash to wrap the normal call arguments (or pass a request object), and
|
202
|
-
# then add further keyword arguments for the call options.
|
203
|
-
response = client.annotate_video(
|
204
|
-
{ features: features, input_uri: input_uri },
|
205
|
-
timeout: 10.0)
|
206
|
-
```
|
207
|
-
|
208
|
-
### Handling Errors
|
209
|
-
|
210
|
-
The client reports standard
|
211
|
-
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
212
|
-
by raising exceptions. In older releases, these exceptions were located in the
|
213
|
-
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
214
|
-
exception class, defined in the `google-gax` gem. However, these classes were
|
215
|
-
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
216
|
-
thrown by other client libraries such as `google-cloud-storage`.
|
217
|
-
|
218
|
-
The 3.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
|
219
|
-
for consistency across all the Google Cloud client libraries. In general, these
|
220
|
-
exceptions have the same name as their counterparts from older releases, but
|
221
|
-
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
222
|
-
namespace.
|
223
|
-
|
224
|
-
Old:
|
225
|
-
```
|
226
|
-
client = Google::Cloud::VideoIntelligence.new
|
227
|
-
|
228
|
-
features = [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION]
|
229
|
-
input_uri = "gs://my-bucket/my-video"
|
230
|
-
|
231
|
-
begin
|
232
|
-
response = client.annotate_video features, input_uri: input_uri
|
233
|
-
rescue Google::Gax::Error => e
|
234
|
-
# Handle exceptions that subclass Google::Gax::Error
|
235
|
-
end
|
236
|
-
```
|
237
|
-
|
238
|
-
New:
|
239
|
-
```
|
240
|
-
client = Google::Cloud::VideoIntelligence.video_intelligence_service
|
241
|
-
|
242
|
-
features = [Google::Cloud::VideoIntelligence::V1::Feature::FACE_DETECTION]
|
243
|
-
input_uri = "gs://my-bucket/my-video"
|
244
|
-
|
245
|
-
begin
|
246
|
-
response = client.annotate_video features: features, input_uri: input_uri
|
247
|
-
rescue Google::Cloud::Error => e
|
248
|
-
# Handle exceptions that subclass Google::Cloud::Error
|
249
|
-
end
|
250
|
-
```
|
251
|
-
|
252
|
-
### Class Namespaces
|
253
|
-
|
254
|
-
In some significantly older releases, (protobuf) data type classes were located
|
255
|
-
in the namespace `Google::Cloud::Videointelligence::V1` (note the lower-case "i".)
|
256
|
-
In more recent releases, these were moved into `Google::Cloud::VideoIntelligence::V1`
|
257
|
-
(with an upper-case "I"), but the older namespace also continued to work.
|
258
|
-
In the 3.0 release, the old namespace with a lower-case "i" has been dropped.
|
259
|
-
|
260
|
-
In older releases, the client object was of classes with names like:
|
261
|
-
`Google::Cloud::VideoIntelligence::V1::VideoIntelligenceServiceClient`.
|
262
|
-
In the 3.0 release, the client object is of a different class:
|
263
|
-
`Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Client`.
|
264
|
-
Note that most users will use the factory methods such as
|
265
|
-
`Google::Cloud::VideoIntelligence.video_intelligence_service` to create instances of the client object,
|
266
|
-
so you may not need to reference the actual class directly.
|
267
|
-
See [Creating Clients](#creating-clients).
|
268
|
-
|
269
|
-
In older releases, the credentials object was of class
|
270
|
-
`Google::Cloud::VideoIntelligence::V1::Credentials`.
|
271
|
-
In the 3.0 release, each service has its own credentials class, e.g.
|
272
|
-
`Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Credentials`.
|
273
|
-
Again, most users will not need to reference this class directly.
|
274
|
-
See [Client Configuration](#client-configuration).
|