google-cloud-video_intelligence 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -0
- data/lib/google/cloud/video_intelligence.rb +45 -13
- data/lib/google/cloud/video_intelligence/v1beta1.rb +97 -0
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/cloud/videointelligence/v1beta1/video_intelligence.rb +19 -8
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/protobuf/any.rb +12 -2
- data/lib/google/cloud/video_intelligence/v1beta1/doc/google/rpc/status.rb +8 -8
- data/lib/google/cloud/video_intelligence/v1beta1/video_intelligence_service_client.rb +57 -31
- data/lib/google/cloud/video_intelligence/v1beta2.rb +86 -42
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/cloud/videointelligence/v1beta2/video_intelligence.rb +11 -0
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/any.rb +10 -0
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/duration.rb +14 -1
- data/lib/google/cloud/video_intelligence/v1beta2/doc/google/rpc/status.rb +4 -4
- data/lib/google/cloud/video_intelligence/v1beta2/doc/overview.rb +91 -0
- data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client.rb +8 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a19ec0a75a0302b5f7117fc05bbffa67fe0d732a
|
4
|
+
data.tar.gz: ee059f64f413d6752ac91db1ddef5fa4920de100
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f41f0ce2b8399dba88a0e7cdd0a3d5dfa4dce673c677d68acfbcb2f14b4b01bc3ca3d6fde1c9b0a9c59c46db84476d90aa1e0f74c75746dd2f56af94bceb1c
|
7
|
+
data.tar.gz: 1c6bde9c9911eca52d74fc57dd9d4e12e878991f10ec52b81224bbd19c49485956fe3f28e04df67ab8e7832f2d4f55464c7fb55c0863a593486ebedf7a48c46b
|
data/README.md
CHANGED
@@ -18,6 +18,44 @@ steps:
|
|
18
18
|
$ gem install google-cloud-video_intelligence
|
19
19
|
```
|
20
20
|
|
21
|
+
### Preview
|
22
|
+
#### VideoIntelligenceServiceClient
|
23
|
+
```rb
|
24
|
+
require "google/cloud/video_intelligence/v1beta2"
|
25
|
+
|
26
|
+
video_intelligence_service_client = Google::Cloud::VideoIntelligence.new
|
27
|
+
input_uri = "gs://cloud-ml-sandbox/video/chicago.mp4"
|
28
|
+
features_element = :LABEL_DETECTION
|
29
|
+
features = [features_element]
|
30
|
+
|
31
|
+
# Register a callback during the method call.
|
32
|
+
operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
|
33
|
+
raise op.results.message if op.error?
|
34
|
+
op_results = op.results
|
35
|
+
# Process the results.
|
36
|
+
|
37
|
+
metadata = op.metadata
|
38
|
+
# Process the metadata.
|
39
|
+
end
|
40
|
+
|
41
|
+
# Or use the return value to register a callback.
|
42
|
+
operation.on_done do |op|
|
43
|
+
raise op.results.message if op.error?
|
44
|
+
op_results = op.results
|
45
|
+
# Process the results.
|
46
|
+
|
47
|
+
metadata = op.metadata
|
48
|
+
# Process the metadata.
|
49
|
+
end
|
50
|
+
|
51
|
+
# Manually reload the operation.
|
52
|
+
operation.reload!
|
53
|
+
|
54
|
+
# Or block until the operation completes, triggering callbacks on
|
55
|
+
# completion.
|
56
|
+
operation.wait_until_done!
|
57
|
+
```
|
58
|
+
|
21
59
|
### Next Steps
|
22
60
|
- Read the [Client Library Documentation][] for Google Cloud Video Intelligence API
|
23
61
|
to see other available methods on the client.
|
@@ -34,9 +34,42 @@ module Google
|
|
34
34
|
# 2. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence)
|
35
35
|
# 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
36
36
|
#
|
37
|
-
# ###
|
38
|
-
#
|
39
|
-
#
|
37
|
+
# ### Preview
|
38
|
+
# #### VideoIntelligenceServiceClient
|
39
|
+
# ```rb
|
40
|
+
# require "google/cloud/video_intelligence"
|
41
|
+
#
|
42
|
+
# video_intelligence_service_client = Google::Cloud::VideoIntelligence.new
|
43
|
+
# input_uri = "gs://cloud-ml-sandbox/video/chicago.mp4"
|
44
|
+
# features_element = :LABEL_DETECTION
|
45
|
+
# features = [features_element]
|
46
|
+
#
|
47
|
+
# # Register a callback during the method call.
|
48
|
+
# operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
|
49
|
+
# raise op.results.message if op.error?
|
50
|
+
# op_results = op.results
|
51
|
+
# # Process the results.
|
52
|
+
#
|
53
|
+
# metadata = op.metadata
|
54
|
+
# # Process the metadata.
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# # Or use the return value to register a callback.
|
58
|
+
# operation.on_done do |op|
|
59
|
+
# raise op.results.message if op.error?
|
60
|
+
# op_results = op.results
|
61
|
+
# # Process the results.
|
62
|
+
#
|
63
|
+
# metadata = op.metadata
|
64
|
+
# # Process the metadata.
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# # Manually reload the operation.
|
68
|
+
# operation.reload!
|
69
|
+
#
|
70
|
+
# # Or block until the operation completes, triggering callbacks on
|
71
|
+
# # completion.
|
72
|
+
# operation.wait_until_done!
|
40
73
|
# ```
|
41
74
|
#
|
42
75
|
# ### Next Steps
|
@@ -54,20 +87,19 @@ module Google
|
|
54
87
|
FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("video_intelligence"))
|
55
88
|
|
56
89
|
AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
|
57
|
-
.select {|file| File.directory?(file)}
|
58
|
-
.select {|dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir))}
|
59
|
-
.select {|dir| File.exist?(dir + ".rb")}
|
60
|
-
.map {|dir| File.basename(dir)}
|
90
|
+
.select { |file| File.directory?(file) }
|
91
|
+
.select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
|
92
|
+
.select { |dir| File.exist?(dir + ".rb") }
|
93
|
+
.map { |dir| File.basename(dir) }
|
61
94
|
|
62
95
|
##
|
63
96
|
# Service that implements Google Cloud Video Intelligence API.
|
64
97
|
#
|
65
|
-
# @
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# @param credentials
|
70
|
-
# [Google::Gax::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
98
|
+
# @param version [Symbol, String]
|
99
|
+
# The major version of the service to be used. By default :v1beta2
|
100
|
+
# is used.
|
101
|
+
# @overload
|
102
|
+
# @param credentials [Google::Gax::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
71
103
|
# Provides the means for authenticating requests made by the client. This parameter can
|
72
104
|
# be many types.
|
73
105
|
# A `Google::Gax::Credentials` uses a the properties of its represented keyfile for
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# Copyright 2017, Google Inc. All rights reserved.
|
2
|
+
#
|
2
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
3
4
|
# you may not use this file except in compliance with the License.
|
4
5
|
# You may obtain a copy of the License at
|
@@ -12,3 +13,99 @@
|
|
12
13
|
# limitations under the License.
|
13
14
|
|
14
15
|
require "google/cloud/video_intelligence/v1beta1/video_intelligence_service_client"
|
16
|
+
|
17
|
+
module Google
|
18
|
+
module Cloud
|
19
|
+
# rubocop:disable LineLength
|
20
|
+
|
21
|
+
##
|
22
|
+
# # Ruby Client for Google Cloud Video Intelligence API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
23
|
+
#
|
24
|
+
# [Google Cloud Video Intelligence API][Product Documentation]:
|
25
|
+
# Google Cloud Video Intelligence API.
|
26
|
+
# - [Product Documentation][]
|
27
|
+
#
|
28
|
+
# ## Quick Start
|
29
|
+
# In order to use this library, you first need to go through the following
|
30
|
+
# steps:
|
31
|
+
#
|
32
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
33
|
+
# 2. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence)
|
34
|
+
# 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
35
|
+
#
|
36
|
+
# ### Installation
|
37
|
+
# ```
|
38
|
+
# $ gem install google-cloud-video_intelligence
|
39
|
+
# ```
|
40
|
+
#
|
41
|
+
# ### Next Steps
|
42
|
+
# - Read the [Google Cloud Video Intelligence API Product documentation][Product Documentation]
|
43
|
+
# to learn more about the product and see How-to Guides.
|
44
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
45
|
+
# to see the full list of Cloud APIs that we cover.
|
46
|
+
#
|
47
|
+
# [Product Documentation]: https://cloud.google.com/video-intelligence
|
48
|
+
#
|
49
|
+
#
|
50
|
+
module VideoIntelligence
|
51
|
+
module V1beta1
|
52
|
+
# rubocop:enable LineLength
|
53
|
+
|
54
|
+
##
|
55
|
+
# Service that implements Google Cloud Video Intelligence API.
|
56
|
+
#
|
57
|
+
# @param credentials [Google::Gax::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
58
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
59
|
+
# be many types.
|
60
|
+
# A `Google::Gax::Credentials` uses a the properties of its represented keyfile for
|
61
|
+
# authenticating requests made by this client.
|
62
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
63
|
+
# credentials for this client.
|
64
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
65
|
+
# credentials for this client.
|
66
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
67
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
68
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
69
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
70
|
+
# metadata for requests, generally, to give OAuth credentials.
|
71
|
+
# @param scopes [Array<String>]
|
72
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
73
|
+
# an updater_proc is supplied.
|
74
|
+
# @param client_config [Hash]
|
75
|
+
# A Hash for call options for each method. See
|
76
|
+
# Google::Gax#construct_settings for the structure of
|
77
|
+
# this data. Falls back to the default config if not specified
|
78
|
+
# or the specified config is missing data points.
|
79
|
+
# @param timeout [Numeric]
|
80
|
+
# The default timeout, in seconds, for calls made through this client.
|
81
|
+
def self.new \
|
82
|
+
service_path: nil,
|
83
|
+
port: nil,
|
84
|
+
channel: nil,
|
85
|
+
chan_creds: nil,
|
86
|
+
updater_proc: nil,
|
87
|
+
credentials: nil,
|
88
|
+
scopes: nil,
|
89
|
+
client_config: nil,
|
90
|
+
timeout: nil,
|
91
|
+
lib_name: nil,
|
92
|
+
lib_version: nil
|
93
|
+
kwargs = {
|
94
|
+
service_path: service_path,
|
95
|
+
port: port,
|
96
|
+
channel: channel,
|
97
|
+
chan_creds: chan_creds,
|
98
|
+
updater_proc: updater_proc,
|
99
|
+
credentials: credentials,
|
100
|
+
scopes: scopes,
|
101
|
+
client_config: client_config,
|
102
|
+
timeout: timeout,
|
103
|
+
lib_name: lib_name,
|
104
|
+
lib_version: lib_version
|
105
|
+
}.select { |_, v| v != nil }
|
106
|
+
Google::Cloud::VideoIntelligence::V1beta1::VideoIntelligenceServiceClient.new(**kwargs)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -15,16 +15,27 @@
|
|
15
15
|
module Google
|
16
16
|
module Cloud
|
17
17
|
module Videointelligence
|
18
|
+
##
|
19
|
+
# # Google Cloud Video Intelligence API Contents
|
20
|
+
#
|
21
|
+
# | Class | Description |
|
22
|
+
# | ----- | ----------- |
|
23
|
+
# | [VideoIntelligenceServiceClient][] | Google Cloud Video Intelligence API. |
|
24
|
+
# | [Data Types][] | Data types for Google::Cloud::VideoIntelligence::V1beta1 |
|
25
|
+
#
|
26
|
+
# [VideoIntelligenceServiceClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-video_intelligence/latest/google/cloud/videointelligence/v1beta1/videointelligenceserviceclient
|
27
|
+
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-video_intelligence/latest/google/cloud/videointelligence/v1beta1/datatypes
|
28
|
+
#
|
18
29
|
module V1beta1
|
19
30
|
# Video annotation request.
|
20
31
|
# @!attribute [rw] input_uri
|
21
32
|
# @return [String]
|
22
33
|
# Input video location. Currently, only
|
23
|
-
#
|
34
|
+
# [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
|
24
35
|
# supported, which must be specified in the following format:
|
25
36
|
# +gs://bucket-id/object-id+ (other URI formats return
|
26
|
-
# Google::Rpc::Code::INVALID_ARGUMENT). For more information, see
|
27
|
-
#
|
37
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
38
|
+
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
28
39
|
# A video URI may include wildcards in +object-id+, and thus identify
|
29
40
|
# multiple videos. Supported wildcards: '*' to match 0 or more characters;
|
30
41
|
# '?' to match 1 character. If unset, the input video should be embedded
|
@@ -42,11 +53,11 @@ module Google
|
|
42
53
|
# @!attribute [rw] output_uri
|
43
54
|
# @return [String]
|
44
55
|
# Optional location where the output (in JSON format) should be stored.
|
45
|
-
# Currently, only
|
56
|
+
# Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
|
46
57
|
# URIs are supported, which must be specified in the following format:
|
47
58
|
# +gs://bucket-id/object-id+ (other URI formats return
|
48
|
-
# Google::Rpc::Code::INVALID_ARGUMENT). For more information, see
|
49
|
-
#
|
59
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
60
|
+
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
50
61
|
# @!attribute [rw] location_id
|
51
62
|
# @return [String]
|
52
63
|
# Optional cloud region where annotation should take place. Supported cloud
|
@@ -191,7 +202,7 @@ module Google
|
|
191
202
|
# @!attribute [rw] input_uri
|
192
203
|
# @return [String]
|
193
204
|
# Video file location in
|
194
|
-
#
|
205
|
+
# [Google Cloud Storage](https://cloud.google.com/storage/).
|
195
206
|
# @!attribute [rw] label_annotations
|
196
207
|
# @return [Array<Google::Cloud::Videointelligence::V1beta1::LabelAnnotation>]
|
197
208
|
# Label annotations. There is exactly one element for each unique label.
|
@@ -222,7 +233,7 @@ module Google
|
|
222
233
|
# @!attribute [rw] input_uri
|
223
234
|
# @return [String]
|
224
235
|
# Video file location in
|
225
|
-
#
|
236
|
+
# [Google Cloud Storage](https://cloud.google.com/storage/).
|
226
237
|
# @!attribute [rw] progress_percent
|
227
238
|
# @return [Integer]
|
228
239
|
# Approximate percentage processed thus far.
|
@@ -49,6 +49,16 @@ module Google
|
|
49
49
|
# any.Unpack(foo)
|
50
50
|
# ...
|
51
51
|
#
|
52
|
+
# Example 4: Pack and unpack a message in Go
|
53
|
+
#
|
54
|
+
# foo := &pb.Foo{...}
|
55
|
+
# any, err := ptypes.MarshalAny(foo)
|
56
|
+
# ...
|
57
|
+
# foo := &pb.Foo{}
|
58
|
+
# if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
59
|
+
# ...
|
60
|
+
# }
|
61
|
+
#
|
52
62
|
# The pack methods provided by protobuf library will by default use
|
53
63
|
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
54
64
|
# methods only use the fully qualified type name after the last '/'
|
@@ -77,7 +87,7 @@ module Google
|
|
77
87
|
# If the embedded message type is well-known and has a custom JSON
|
78
88
|
# representation, that representation will be embedded adding a field
|
79
89
|
# +value+ which holds the custom JSON in addition to the +@type+
|
80
|
-
# field. Example (for message Google::Protobuf::Duration):
|
90
|
+
# field. Example (for message {Google::Protobuf::Duration}):
|
81
91
|
#
|
82
92
|
# {
|
83
93
|
# "@type": "type.googleapis.com/google.protobuf.Duration",
|
@@ -96,7 +106,7 @@ module Google
|
|
96
106
|
# qualified name of the type (as in +path/google.protobuf.Duration+).
|
97
107
|
# The name should be in a canonical form (e.g., leading "." is
|
98
108
|
# not accepted).
|
99
|
-
# * An HTTP GET on the URL must yield a Google::Protobuf::Type
|
109
|
+
# * An HTTP GET on the URL must yield a {Google::Protobuf::Type}
|
100
110
|
# value in binary format, or produce an error.
|
101
111
|
# * Applications are allowed to cache lookup results based on the
|
102
112
|
# URL, or have them precompiled into a binary to avoid any
|
@@ -16,7 +16,7 @@ module Google
|
|
16
16
|
module Rpc
|
17
17
|
# The +Status+ type defines a logical error model that is suitable for different
|
18
18
|
# programming environments, including REST APIs and RPC APIs. It is used by
|
19
|
-
#
|
19
|
+
# [gRPC](https://github.com/grpc). The error model is designed to be:
|
20
20
|
#
|
21
21
|
# * Simple to use and understand for most users
|
22
22
|
# * Flexible enough to meet unexpected needs
|
@@ -25,13 +25,13 @@ module Google
|
|
25
25
|
#
|
26
26
|
# The +Status+ message contains three pieces of data: error code, error message,
|
27
27
|
# and error details. The error code should be an enum value of
|
28
|
-
# Google::Rpc::Code, but it may accept additional error codes if needed. The
|
28
|
+
# {Google::Rpc::Code}, but it may accept additional error codes if needed. The
|
29
29
|
# error message should be a developer-facing English message that helps
|
30
30
|
# developers *understand* and *resolve* the error. If a localized user-facing
|
31
31
|
# error message is needed, put the localized message in the error details or
|
32
32
|
# localize it in the client. The optional error details may contain arbitrary
|
33
33
|
# information about the error. There is a predefined set of error detail types
|
34
|
-
# in the package +google.rpc+
|
34
|
+
# in the package +google.rpc+ that can be used for common error conditions.
|
35
35
|
#
|
36
36
|
# = Language mapping
|
37
37
|
#
|
@@ -54,7 +54,7 @@ module Google
|
|
54
54
|
# errors.
|
55
55
|
#
|
56
56
|
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
57
|
-
# have a +Status+ message for error reporting
|
57
|
+
# have a +Status+ message for error reporting.
|
58
58
|
#
|
59
59
|
# * Batch operations. If a client uses batch request and batch response, the
|
60
60
|
# +Status+ message should be used directly inside batch response, one for
|
@@ -68,16 +68,16 @@ module Google
|
|
68
68
|
# be used directly after any stripping needed for security/privacy reasons.
|
69
69
|
# @!attribute [rw] code
|
70
70
|
# @return [Integer]
|
71
|
-
# The status code, which should be an enum value of Google::Rpc::Code.
|
71
|
+
# The status code, which should be an enum value of {Google::Rpc::Code}.
|
72
72
|
# @!attribute [rw] message
|
73
73
|
# @return [String]
|
74
74
|
# A developer-facing error message, which should be in English. Any
|
75
75
|
# user-facing error message should be localized and sent in the
|
76
|
-
# Google::Rpc::Status#details field, or localized by the client.
|
76
|
+
# {Google::Rpc::Status#details} field, or localized by the client.
|
77
77
|
# @!attribute [rw] details
|
78
78
|
# @return [Array<Google::Protobuf::Any>]
|
79
|
-
# A list of messages that carry the error details. There
|
80
|
-
#
|
79
|
+
# A list of messages that carry the error details. There is a common set of
|
80
|
+
# message types for APIs to use.
|
81
81
|
class Status; end
|
82
82
|
end
|
83
83
|
end
|
@@ -30,6 +30,7 @@ require "google/gax/operation"
|
|
30
30
|
require "google/longrunning/operations_client"
|
31
31
|
|
32
32
|
require "google/cloud/videointelligence/v1beta1/video_intelligence_pb"
|
33
|
+
require "google/cloud/video_intelligence/credentials"
|
33
34
|
|
34
35
|
module Google
|
35
36
|
module Cloud
|
@@ -56,17 +57,20 @@ module Google
|
|
56
57
|
"https://www.googleapis.com/auth/cloud-platform"
|
57
58
|
].freeze
|
58
59
|
|
59
|
-
# @param
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
# A
|
65
|
-
#
|
66
|
-
# A
|
67
|
-
#
|
68
|
-
# A
|
69
|
-
#
|
60
|
+
# @param credentials [Google::Gax::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
61
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
62
|
+
# be many types.
|
63
|
+
# A `Google::Gax::Credentials` uses a the properties of its represented keyfile for
|
64
|
+
# authenticating requests made by this client.
|
65
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
66
|
+
# credentials for this client.
|
67
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
68
|
+
# credentials for this client.
|
69
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
70
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
71
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
72
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
73
|
+
# metadata for requests, generally, to give OAuth credentials.
|
70
74
|
# @param scopes [Array<String>]
|
71
75
|
# The OAuth scopes for this service. This parameter is ignored if
|
72
76
|
# an updater_proc is supplied.
|
@@ -83,11 +87,10 @@ module Google
|
|
83
87
|
channel: nil,
|
84
88
|
chan_creds: nil,
|
85
89
|
updater_proc: nil,
|
90
|
+
credentials: nil,
|
86
91
|
scopes: ALL_SCOPES,
|
87
92
|
client_config: {},
|
88
93
|
timeout: DEFAULT_TIMEOUT,
|
89
|
-
app_name: nil,
|
90
|
-
app_version: nil,
|
91
94
|
lib_name: nil,
|
92
95
|
lib_version: ""
|
93
96
|
# These require statements are intentionally placed here to initialize
|
@@ -96,23 +99,43 @@ module Google
|
|
96
99
|
require "google/gax/grpc"
|
97
100
|
require "google/cloud/videointelligence/v1beta1/video_intelligence_services_pb"
|
98
101
|
|
102
|
+
if channel || chan_creds || updater_proc
|
103
|
+
warn "The `channel`, `chan_creds`, and `updater_proc` parameters will be removed " \
|
104
|
+
"on 2017/09/08"
|
105
|
+
credentials ||= channel
|
106
|
+
credentials ||= chan_creds
|
107
|
+
credentials ||= updater_proc
|
108
|
+
end
|
109
|
+
if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
|
110
|
+
warn "`service_path` and `port` parameters are deprecated and will be removed"
|
111
|
+
end
|
112
|
+
|
113
|
+
credentials ||= Google::Cloud::VideoIntelligence::Credentials.default
|
114
|
+
|
99
115
|
@operations_client = Google::Longrunning::OperationsClient.new(
|
100
116
|
service_path: service_path,
|
101
|
-
|
102
|
-
channel: channel,
|
103
|
-
chan_creds: chan_creds,
|
104
|
-
updater_proc: updater_proc,
|
117
|
+
credentials: credentials,
|
105
118
|
scopes: scopes,
|
106
119
|
client_config: client_config,
|
107
120
|
timeout: timeout,
|
108
|
-
app_name: app_name,
|
109
|
-
app_version: app_version,
|
110
121
|
lib_name: lib_name,
|
111
122
|
lib_version: lib_version,
|
112
123
|
)
|
113
124
|
|
114
|
-
if
|
115
|
-
|
125
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
126
|
+
updater_proc = Google::Cloud::VideoIntelligence::Credentials.new(credentials).updater_proc
|
127
|
+
end
|
128
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
129
|
+
channel = credentials
|
130
|
+
end
|
131
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
132
|
+
chan_creds = credentials
|
133
|
+
end
|
134
|
+
if credentials.is_a?(Proc)
|
135
|
+
updater_proc = credentials
|
136
|
+
end
|
137
|
+
if credentials.is_a?(Google::Gax::Credentials)
|
138
|
+
updater_proc = credentials.updater_proc
|
116
139
|
end
|
117
140
|
|
118
141
|
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
@@ -161,11 +184,11 @@ module Google
|
|
161
184
|
#
|
162
185
|
# @param input_uri [String]
|
163
186
|
# Input video location. Currently, only
|
164
|
-
#
|
187
|
+
# [Google Cloud Storage](https://cloud.google.com/storage/) URIs are
|
165
188
|
# supported, which must be specified in the following format:
|
166
189
|
# +gs://bucket-id/object-id+ (other URI formats return
|
167
|
-
# Google::Rpc::Code::INVALID_ARGUMENT). For more information, see
|
168
|
-
#
|
190
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
191
|
+
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
169
192
|
# A video URI may include wildcards in +object-id+, and thus identify
|
170
193
|
# multiple videos. Supported wildcards: '*' to match 0 or more characters;
|
171
194
|
# '?' to match 1 character. If unset, the input video should be embedded
|
@@ -175,15 +198,17 @@ module Google
|
|
175
198
|
# @param input_content [String]
|
176
199
|
# The video data bytes. Encoding: base64. If unset, the input video(s)
|
177
200
|
# should be specified via +input_uri+. If set, +input_uri+ should be unset.
|
178
|
-
# @param video_context [Google::Cloud::Videointelligence::V1beta1::VideoContext]
|
201
|
+
# @param video_context [Google::Cloud::Videointelligence::V1beta1::VideoContext | Hash]
|
179
202
|
# Additional video context and/or feature-specific parameters.
|
203
|
+
# A hash of the same form as `Google::Cloud::Videointelligence::V1beta1::VideoContext`
|
204
|
+
# can also be provided.
|
180
205
|
# @param output_uri [String]
|
181
206
|
# Optional location where the output (in JSON format) should be stored.
|
182
|
-
# Currently, only
|
207
|
+
# Currently, only [Google Cloud Storage](https://cloud.google.com/storage/)
|
183
208
|
# URIs are supported, which must be specified in the following format:
|
184
209
|
# +gs://bucket-id/object-id+ (other URI formats return
|
185
|
-
# Google::Rpc::Code::INVALID_ARGUMENT). For more information, see
|
186
|
-
#
|
210
|
+
# {Google::Rpc::Code::INVALID_ARGUMENT}). For more information, see
|
211
|
+
# [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
|
187
212
|
# @param location_id [String]
|
188
213
|
# Optional cloud region where annotation should take place. Supported cloud
|
189
214
|
# regions: +us-east1+, +us-west1+, +europe-west1+, +asia-east1+. If no region
|
@@ -196,7 +221,7 @@ module Google
|
|
196
221
|
# @example
|
197
222
|
# require "google/cloud/video_intelligence/v1beta1"
|
198
223
|
#
|
199
|
-
# video_intelligence_service_client = Google::Cloud::VideoIntelligence::V1beta1
|
224
|
+
# video_intelligence_service_client = Google::Cloud::VideoIntelligence::V1beta1.new
|
200
225
|
# input_uri = ''
|
201
226
|
# features = []
|
202
227
|
#
|
@@ -235,14 +260,15 @@ module Google
|
|
235
260
|
output_uri: nil,
|
236
261
|
location_id: nil,
|
237
262
|
options: nil
|
238
|
-
req =
|
263
|
+
req = {
|
239
264
|
input_uri: input_uri,
|
240
265
|
features: features,
|
241
266
|
input_content: input_content,
|
242
267
|
video_context: video_context,
|
243
268
|
output_uri: output_uri,
|
244
269
|
location_id: location_id
|
245
|
-
}.delete_if { |_, v| v.nil? }
|
270
|
+
}.delete_if { |_, v| v.nil? }
|
271
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Videointelligence::V1beta1::AnnotateVideoRequest)
|
246
272
|
operation = Google::Gax::Operation.new(
|
247
273
|
@annotate_video.call(req, options),
|
248
274
|
@operations_client,
|
@@ -33,9 +33,42 @@ module Google
|
|
33
33
|
# 2. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence)
|
34
34
|
# 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
35
35
|
#
|
36
|
-
# ###
|
37
|
-
#
|
38
|
-
#
|
36
|
+
# ### Preview
|
37
|
+
# #### VideoIntelligenceServiceClient
|
38
|
+
# ```rb
|
39
|
+
# require "google/cloud/video_intelligence/v1beta2"
|
40
|
+
#
|
41
|
+
# video_intelligence_service_client = Google::Cloud::VideoIntelligence.new
|
42
|
+
# input_uri = "gs://cloud-ml-sandbox/video/chicago.mp4"
|
43
|
+
# features_element = :LABEL_DETECTION
|
44
|
+
# features = [features_element]
|
45
|
+
#
|
46
|
+
# # Register a callback during the method call.
|
47
|
+
# operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
|
48
|
+
# raise op.results.message if op.error?
|
49
|
+
# op_results = op.results
|
50
|
+
# # Process the results.
|
51
|
+
#
|
52
|
+
# metadata = op.metadata
|
53
|
+
# # Process the metadata.
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# # Or use the return value to register a callback.
|
57
|
+
# operation.on_done do |op|
|
58
|
+
# raise op.results.message if op.error?
|
59
|
+
# op_results = op.results
|
60
|
+
# # Process the results.
|
61
|
+
#
|
62
|
+
# metadata = op.metadata
|
63
|
+
# # Process the metadata.
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# # Manually reload the operation.
|
67
|
+
# operation.reload!
|
68
|
+
#
|
69
|
+
# # Or block until the operation completes, triggering callbacks on
|
70
|
+
# # completion.
|
71
|
+
# operation.wait_until_done!
|
39
72
|
# ```
|
40
73
|
#
|
41
74
|
# ### Next Steps
|
@@ -48,51 +81,62 @@ module Google
|
|
48
81
|
#
|
49
82
|
#
|
50
83
|
module VideoIntelligence
|
51
|
-
##
|
52
|
-
# # Google Cloud Video Intelligence API Contents
|
53
|
-
#
|
54
|
-
# | Class | Description |
|
55
|
-
# | ----- | ----------- |
|
56
|
-
# | [VideoIntelligenceServiceClient][] | Google Cloud Video Intelligence API. |
|
57
|
-
# | [Data Types][] | Data types for Google::Cloud::VideoIntelligence::V1beta2 |
|
58
|
-
#
|
59
|
-
# [VideoIntelligenceServiceClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-video_intelligence/latest/google/cloud/videointelligence/v1beta2/v1beta2/videointelligenceserviceclient
|
60
|
-
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-video_intelligence/latest/google/cloud/videointelligence/v1beta2/v1beta2/datatypes
|
61
|
-
#
|
62
84
|
module V1beta2
|
63
85
|
# rubocop:enable LineLength
|
64
86
|
|
65
87
|
##
|
66
88
|
# Service that implements Google Cloud Video Intelligence API.
|
67
89
|
#
|
68
|
-
# @
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
90
|
+
# @param credentials [Google::Gax::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
91
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
92
|
+
# be many types.
|
93
|
+
# A `Google::Gax::Credentials` uses a the properties of its represented keyfile for
|
94
|
+
# authenticating requests made by this client.
|
95
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
96
|
+
# credentials for this client.
|
97
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
98
|
+
# credentials for this client.
|
99
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
100
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
101
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
102
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
103
|
+
# metadata for requests, generally, to give OAuth credentials.
|
104
|
+
# @param scopes [Array<String>]
|
105
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
106
|
+
# an updater_proc is supplied.
|
107
|
+
# @param client_config [Hash]
|
108
|
+
# A Hash for call options for each method. See
|
109
|
+
# Google::Gax#construct_settings for the structure of
|
110
|
+
# this data. Falls back to the default config if not specified
|
111
|
+
# or the specified config is missing data points.
|
112
|
+
# @param timeout [Numeric]
|
113
|
+
# The default timeout, in seconds, for calls made through this client.
|
114
|
+
def self.new \
|
115
|
+
service_path: nil,
|
116
|
+
port: nil,
|
117
|
+
channel: nil,
|
118
|
+
chan_creds: nil,
|
119
|
+
updater_proc: nil,
|
120
|
+
credentials: nil,
|
121
|
+
scopes: nil,
|
122
|
+
client_config: nil,
|
123
|
+
timeout: nil,
|
124
|
+
lib_name: nil,
|
125
|
+
lib_version: nil
|
126
|
+
kwargs = {
|
127
|
+
service_path: service_path,
|
128
|
+
port: port,
|
129
|
+
channel: channel,
|
130
|
+
chan_creds: chan_creds,
|
131
|
+
updater_proc: updater_proc,
|
132
|
+
credentials: credentials,
|
133
|
+
scopes: scopes,
|
134
|
+
client_config: client_config,
|
135
|
+
timeout: timeout,
|
136
|
+
lib_name: lib_name,
|
137
|
+
lib_version: lib_version
|
138
|
+
}.select { |_, v| v != nil }
|
139
|
+
Google::Cloud::VideoIntelligence::V1beta2::VideoIntelligenceServiceClient.new(**kwargs)
|
96
140
|
end
|
97
141
|
end
|
98
142
|
end
|
@@ -15,6 +15,17 @@
|
|
15
15
|
module Google
|
16
16
|
module Cloud
|
17
17
|
module Videointelligence
|
18
|
+
##
|
19
|
+
# # Google Cloud Video Intelligence API Contents
|
20
|
+
#
|
21
|
+
# | Class | Description |
|
22
|
+
# | ----- | ----------- |
|
23
|
+
# | [VideoIntelligenceServiceClient][] | Google Cloud Video Intelligence API. |
|
24
|
+
# | [Data Types][] | Data types for Google::Cloud::VideoIntelligence::V1beta2 |
|
25
|
+
#
|
26
|
+
# [VideoIntelligenceServiceClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-video_intelligence/latest/google/cloud/videointelligence/v1beta2/videointelligenceserviceclient
|
27
|
+
# [Data Types]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-video_intelligence/latest/google/cloud/videointelligence/v1beta2/datatypes
|
28
|
+
#
|
18
29
|
module V1beta2
|
19
30
|
# Video annotation request.
|
20
31
|
# @!attribute [rw] input_uri
|
@@ -49,6 +49,16 @@ module Google
|
|
49
49
|
# any.Unpack(foo)
|
50
50
|
# ...
|
51
51
|
#
|
52
|
+
# Example 4: Pack and unpack a message in Go
|
53
|
+
#
|
54
|
+
# foo := &pb.Foo{...}
|
55
|
+
# any, err := ptypes.MarshalAny(foo)
|
56
|
+
# ...
|
57
|
+
# foo := &pb.Foo{}
|
58
|
+
# if err := ptypes.UnmarshalAny(any, foo); err != nil {
|
59
|
+
# ...
|
60
|
+
# }
|
61
|
+
#
|
52
62
|
# The pack methods provided by protobuf library will by default use
|
53
63
|
# 'type.googleapis.com/full.type.name' as the type URL and the unpack
|
54
64
|
# methods only use the fully qualified type name after the last '/'
|
@@ -21,6 +21,8 @@ module Google
|
|
21
21
|
# two Timestamp values is a Duration and it can be added or subtracted
|
22
22
|
# from a Timestamp. Range is approximately +-10,000 years.
|
23
23
|
#
|
24
|
+
# = Examples
|
25
|
+
#
|
24
26
|
# Example 1: Compute Duration from two Timestamps in pseudo code.
|
25
27
|
#
|
26
28
|
# Timestamp start = ...;
|
@@ -60,10 +62,21 @@ module Google
|
|
60
62
|
# td = datetime.timedelta(days=3, minutes=10)
|
61
63
|
# duration = Duration()
|
62
64
|
# duration.FromTimedelta(td)
|
65
|
+
#
|
66
|
+
# = JSON Mapping
|
67
|
+
#
|
68
|
+
# In JSON format, the Duration type is encoded as a string rather than an
|
69
|
+
# object, where the string ends in the suffix "s" (indicating seconds) and
|
70
|
+
# is preceded by the number of seconds, with nanoseconds expressed as
|
71
|
+
# fractional seconds. For example, 3 seconds with 0 nanoseconds should be
|
72
|
+
# encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
|
73
|
+
# be expressed in JSON format as "3.000000001s", and 3 seconds and 1
|
74
|
+
# microsecond should be expressed in JSON format as "3.000001s".
|
63
75
|
# @!attribute [rw] seconds
|
64
76
|
# @return [Integer]
|
65
77
|
# Signed seconds of the span of time. Must be from -315,576,000,000
|
66
|
-
# to +315,576,000,000 inclusive.
|
78
|
+
# to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
79
|
+
# 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
67
80
|
# @!attribute [rw] nanos
|
68
81
|
# @return [Integer]
|
69
82
|
# Signed fractions of a second at nanosecond resolution of the span
|
@@ -31,7 +31,7 @@ module Google
|
|
31
31
|
# error message is needed, put the localized message in the error details or
|
32
32
|
# localize it in the client. The optional error details may contain arbitrary
|
33
33
|
# information about the error. There is a predefined set of error detail types
|
34
|
-
# in the package +google.rpc+
|
34
|
+
# in the package +google.rpc+ that can be used for common error conditions.
|
35
35
|
#
|
36
36
|
# = Language mapping
|
37
37
|
#
|
@@ -54,7 +54,7 @@ module Google
|
|
54
54
|
# errors.
|
55
55
|
#
|
56
56
|
# * Workflow errors. A typical workflow has multiple steps. Each step may
|
57
|
-
# have a +Status+ message for error reporting
|
57
|
+
# have a +Status+ message for error reporting.
|
58
58
|
#
|
59
59
|
# * Batch operations. If a client uses batch request and batch response, the
|
60
60
|
# +Status+ message should be used directly inside batch response, one for
|
@@ -76,8 +76,8 @@ module Google
|
|
76
76
|
# {Google::Rpc::Status#details} field, or localized by the client.
|
77
77
|
# @!attribute [rw] details
|
78
78
|
# @return [Array<Google::Protobuf::Any>]
|
79
|
-
# A list of messages that carry the error details. There
|
80
|
-
#
|
79
|
+
# A list of messages that carry the error details. There is a common set of
|
80
|
+
# message types for APIs to use.
|
81
81
|
class Status; end
|
82
82
|
end
|
83
83
|
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Copyright 2017, Google Inc. All rights reserved.
|
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
|
+
# http://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
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
# rubocop:disable LineLength
|
18
|
+
|
19
|
+
##
|
20
|
+
# # Ruby Client for Google Cloud Video Intelligence API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
21
|
+
#
|
22
|
+
# [Google Cloud Video Intelligence API][Product Documentation]:
|
23
|
+
# Google Cloud Video Intelligence API.
|
24
|
+
# - [Product Documentation][]
|
25
|
+
#
|
26
|
+
# ## Quick Start
|
27
|
+
# In order to use this library, you first need to go through the following
|
28
|
+
# steps:
|
29
|
+
#
|
30
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
31
|
+
# 2. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence)
|
32
|
+
# 3. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
33
|
+
#
|
34
|
+
# ### Installation
|
35
|
+
# ```
|
36
|
+
# $ gem install google-cloud-video_intelligence
|
37
|
+
# ```
|
38
|
+
#
|
39
|
+
# ### Preview
|
40
|
+
# #### VideoIntelligenceServiceClient
|
41
|
+
# ```rb
|
42
|
+
# require "google/cloud/video_intelligence"
|
43
|
+
#
|
44
|
+
# video_intelligence_service_client = Google::Cloud::VideoIntelligence.new
|
45
|
+
# input_uri = "gs://cloud-ml-sandbox/video/chicago.mp4"
|
46
|
+
# features_element = :LABEL_DETECTION
|
47
|
+
# features = [features_element]
|
48
|
+
#
|
49
|
+
# # Register a callback during the method call.
|
50
|
+
# operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
|
51
|
+
# raise op.results.message if op.error?
|
52
|
+
# op_results = op.results
|
53
|
+
# # Process the results.
|
54
|
+
#
|
55
|
+
# metadata = op.metadata
|
56
|
+
# # Process the metadata.
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# # Or use the return value to register a callback.
|
60
|
+
# operation.on_done do |op|
|
61
|
+
# raise op.results.message if op.error?
|
62
|
+
# op_results = op.results
|
63
|
+
# # Process the results.
|
64
|
+
#
|
65
|
+
# metadata = op.metadata
|
66
|
+
# # Process the metadata.
|
67
|
+
# end
|
68
|
+
#
|
69
|
+
# # Manually reload the operation.
|
70
|
+
# operation.reload!
|
71
|
+
#
|
72
|
+
# # Or block until the operation completes, triggering callbacks on
|
73
|
+
# # completion.
|
74
|
+
# operation.wait_until_done!
|
75
|
+
# ```
|
76
|
+
#
|
77
|
+
# ### Next Steps
|
78
|
+
# - Read the [Google Cloud Video Intelligence API Product documentation][Product Documentation]
|
79
|
+
# to learn more about the product and see How-to Guides.
|
80
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
81
|
+
# to see the full list of Cloud APIs that we cover.
|
82
|
+
#
|
83
|
+
# [Product Documentation]: https://cloud.google.com/video-intelligence
|
84
|
+
#
|
85
|
+
#
|
86
|
+
module VideoIntelligence
|
87
|
+
module V1beta2
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -106,13 +106,14 @@ module Google
|
|
106
106
|
credentials ||= chan_creds
|
107
107
|
credentials ||= updater_proc
|
108
108
|
end
|
109
|
-
if service_path || port
|
109
|
+
if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
|
110
110
|
warn "`service_path` and `port` parameters are deprecated and will be removed"
|
111
111
|
end
|
112
112
|
|
113
113
|
credentials ||= Google::Cloud::VideoIntelligence::Credentials.default
|
114
114
|
|
115
115
|
@operations_client = Google::Longrunning::OperationsClient.new(
|
116
|
+
service_path: service_path,
|
116
117
|
credentials: credentials,
|
117
118
|
scopes: scopes,
|
118
119
|
client_config: client_config,
|
@@ -192,11 +193,11 @@ module Google
|
|
192
193
|
# multiple videos. Supported wildcards: '*' to match 0 or more characters;
|
193
194
|
# '?' to match 1 character. If unset, the input video should be embedded
|
194
195
|
# in the request as +input_content+. If set, +input_content+ should be unset.
|
195
|
-
# @param features [Array<Google::Cloud::Videointelligence::V1beta2::Feature>]
|
196
|
-
# Requested video annotation features.
|
197
196
|
# @param input_content [String]
|
198
197
|
# The video data bytes. Encoding: base64. If unset, the input video(s)
|
199
198
|
# should be specified via +input_uri+. If set, +input_uri+ should be unset.
|
199
|
+
# @param features [Array<Google::Cloud::Videointelligence::V1beta2::Feature>]
|
200
|
+
# Requested video annotation features.
|
200
201
|
# @param video_context [Google::Cloud::Videointelligence::V1beta2::VideoContext | Hash]
|
201
202
|
# Additional video context and/or feature-specific parameters.
|
202
203
|
# A hash of the same form as `Google::Cloud::Videointelligence::V1beta2::VideoContext`
|
@@ -221,11 +222,9 @@ module Google
|
|
221
222
|
# require "google/cloud/video_intelligence/v1beta2"
|
222
223
|
#
|
223
224
|
# video_intelligence_service_client = Google::Cloud::VideoIntelligence::V1beta2.new
|
224
|
-
# input_uri = ''
|
225
|
-
# features = []
|
226
225
|
#
|
227
226
|
# # Register a callback during the method call.
|
228
|
-
# operation = video_intelligence_service_client.annotate_video
|
227
|
+
# operation = video_intelligence_service_client.annotate_video do |op|
|
229
228
|
# raise op.results.message if op.error?
|
230
229
|
# op_results = op.results
|
231
230
|
# # Process the results.
|
@@ -252,17 +251,17 @@ module Google
|
|
252
251
|
# operation.wait_until_done!
|
253
252
|
|
254
253
|
def annotate_video \
|
255
|
-
input_uri,
|
256
|
-
features,
|
254
|
+
input_uri: nil,
|
257
255
|
input_content: nil,
|
256
|
+
features: nil,
|
258
257
|
video_context: nil,
|
259
258
|
output_uri: nil,
|
260
259
|
location_id: nil,
|
261
260
|
options: nil
|
262
261
|
req = {
|
263
262
|
input_uri: input_uri,
|
264
|
-
features: features,
|
265
263
|
input_content: input_content,
|
264
|
+
features: features,
|
266
265
|
video_context: video_context,
|
267
266
|
output_uri: output_uri,
|
268
267
|
location_id: location_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-video_intelligence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-gax
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/any.rb
|
132
132
|
- lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/duration.rb
|
133
133
|
- lib/google/cloud/video_intelligence/v1beta2/doc/google/rpc/status.rb
|
134
|
+
- lib/google/cloud/video_intelligence/v1beta2/doc/overview.rb
|
134
135
|
- lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client.rb
|
135
136
|
- lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client_config.json
|
136
137
|
- lib/google/cloud/videointelligence/v1beta1/video_intelligence_pb.rb
|