google-cloud-video_intelligence 1.0.0 → 1.1.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +4 -3
  3. data/README.md +39 -2
  4. data/lib/google/cloud/video_intelligence.rb +33 -3
  5. data/lib/google/cloud/video_intelligence/credentials.rb +6 -10
  6. data/lib/google/cloud/video_intelligence/v1.rb +102 -66
  7. data/lib/google/cloud/video_intelligence/v1/credentials.rb +40 -0
  8. data/lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb +1 -12
  9. data/lib/google/cloud/video_intelligence/v1/doc/google/longrunning/operations.rb +92 -0
  10. data/lib/google/cloud/video_intelligence/v1/doc/google/protobuf/any.rb +1 -1
  11. data/lib/google/cloud/video_intelligence/v1/doc/google/protobuf/duration.rb +1 -1
  12. data/lib/google/cloud/video_intelligence/v1/doc/google/rpc/status.rb +1 -1
  13. data/lib/google/cloud/video_intelligence/v1/doc/overview.rb +28 -3
  14. data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client.rb +29 -13
  15. data/lib/google/cloud/video_intelligence/v1beta1.rb +64 -28
  16. data/lib/google/cloud/video_intelligence/v1beta1/credentials.rb +40 -0
  17. data/lib/google/cloud/video_intelligence/v1beta1/doc/google/cloud/videointelligence/v1beta1/video_intelligence.rb +1 -12
  18. data/lib/google/cloud/video_intelligence/v1beta1/doc/google/longrunning/operations.rb +92 -0
  19. data/lib/google/cloud/video_intelligence/v1beta1/doc/google/protobuf/any.rb +1 -1
  20. data/lib/google/cloud/video_intelligence/v1beta1/doc/google/rpc/status.rb +1 -1
  21. data/lib/google/cloud/video_intelligence/v1beta1/doc/overview.rb +28 -3
  22. data/lib/google/cloud/video_intelligence/v1beta1/video_intelligence_service_client.rb +25 -12
  23. data/lib/google/cloud/video_intelligence/v1beta2.rb +64 -28
  24. data/lib/google/cloud/video_intelligence/v1beta2/credentials.rb +40 -0
  25. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/cloud/videointelligence/v1beta2/video_intelligence.rb +1 -12
  26. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/longrunning/operations.rb +92 -0
  27. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/any.rb +1 -1
  28. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/duration.rb +1 -1
  29. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/rpc/status.rb +1 -1
  30. data/lib/google/cloud/video_intelligence/v1beta2/doc/overview.rb +28 -3
  31. data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client.rb +29 -13
  32. data/lib/google/cloud/videointelligence/v1/video_intelligence_services_pb.rb +1 -1
  33. data/lib/google/cloud/videointelligence/v1beta1/video_intelligence_services_pb.rb +1 -1
  34. data/lib/google/cloud/videointelligence/v1beta2/video_intelligence_services_pb.rb +1 -1
  35. metadata +45 -11
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -17,7 +17,7 @@ module Google
17
17
  # rubocop:disable LineLength
18
18
 
19
19
  ##
20
- # # Ruby Client for Google Cloud Video Intelligence API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
20
+ # # Ruby Client for Google Cloud Video Intelligence API ([GA](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
21
21
  #
22
22
  # [Google Cloud Video Intelligence API][Product Documentation]:
23
23
  # Google Cloud Video Intelligence API.
@@ -29,7 +29,7 @@ module Google
29
29
  #
30
30
  # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
31
31
  # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
32
- # 3. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/api/video-intelligence)
32
+ # 3. [Enable the Google Cloud Video Intelligence API.](https://console.cloud.google.com/apis/library/videointelligence.googleapis.com)
33
33
  # 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
34
34
  #
35
35
  # ### Installation
@@ -45,6 +45,31 @@ module Google
45
45
  #
46
46
  # [Product Documentation]: https://cloud.google.com/video-intelligence
47
47
  #
48
+ # ## Enabling Logging
49
+ #
50
+ # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
51
+ # 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,
52
+ # or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
53
+ # 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)
54
+ # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
55
+ #
56
+ # Configuring a Ruby stdlib logger:
57
+ #
58
+ # ```ruby
59
+ # require "logger"
60
+ #
61
+ # module MyLogger
62
+ # LOGGER = Logger.new $stderr, level: Logger::WARN
63
+ # def logger
64
+ # LOGGER
65
+ # end
66
+ # end
67
+ #
68
+ # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
69
+ # module GRPC
70
+ # extend MyLogger
71
+ # end
72
+ # ```
48
73
  #
49
74
  module VideoIntelligence
50
75
  module V1beta2
@@ -1,4 +1,4 @@
1
- # Copyright 2017 Google LLC
1
+ # Copyright 2018 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -18,9 +18,6 @@
18
18
  # and updates to that file get reflected here through a refresh process.
19
19
  # For the short term, the refresh process will only be runnable by Google
20
20
  # engineers.
21
- #
22
- # The only allowed edits are to method and file documentation. A 3-way
23
- # merge preserves those additions if the generated source changes.
24
21
 
25
22
  require "json"
26
23
  require "pathname"
@@ -30,7 +27,7 @@ require "google/gax/operation"
30
27
  require "google/longrunning/operations_client"
31
28
 
32
29
  require "google/cloud/videointelligence/v1beta2/video_intelligence_pb"
33
- require "google/cloud/video_intelligence/credentials"
30
+ require "google/cloud/video_intelligence/v1beta2/credentials"
34
31
 
35
32
  module Google
36
33
  module Cloud
@@ -49,6 +46,9 @@ module Google
49
46
  # The default port of the service.
50
47
  DEFAULT_SERVICE_PORT = 443
51
48
 
49
+ # The default set of gRPC interceptors.
50
+ GRPC_INTERCEPTORS = []
51
+
52
52
  DEFAULT_TIMEOUT = 30
53
53
 
54
54
  # The scopes needed to make gRPC calls to all of the methods defined in
@@ -57,8 +57,10 @@ module Google
57
57
  "https://www.googleapis.com/auth/cloud-platform"
58
58
  ].freeze
59
59
 
60
+ # @private
60
61
  class OperationsClient < Google::Longrunning::OperationsClient
61
- SERVICE_ADDRESS = SERVICE_ADDRESS
62
+ self::SERVICE_ADDRESS = VideoIntelligenceServiceClient::SERVICE_ADDRESS
63
+ self::GRPC_INTERCEPTORS = VideoIntelligenceServiceClient::GRPC_INTERCEPTORS
62
64
  end
63
65
 
64
66
  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
@@ -85,11 +87,18 @@ module Google
85
87
  # or the specified config is missing data points.
86
88
  # @param timeout [Numeric]
87
89
  # The default timeout, in seconds, for calls made through this client.
90
+ # @param metadata [Hash]
91
+ # Default metadata to be sent with each request. This can be overridden on a per call basis.
92
+ # @param exception_transformer [Proc]
93
+ # An optional proc that intercepts any exceptions raised during an API call to inject
94
+ # custom error handling.
88
95
  def initialize \
89
96
  credentials: nil,
90
97
  scopes: ALL_SCOPES,
91
98
  client_config: {},
92
99
  timeout: DEFAULT_TIMEOUT,
100
+ metadata: nil,
101
+ exception_transformer: nil,
93
102
  lib_name: nil,
94
103
  lib_version: ""
95
104
  # These require statements are intentionally placed here to initialize
@@ -98,7 +107,7 @@ module Google
98
107
  require "google/gax/grpc"
99
108
  require "google/cloud/videointelligence/v1beta2/video_intelligence_services_pb"
100
109
 
101
- credentials ||= Google::Cloud::VideoIntelligence::Credentials.default
110
+ credentials ||= Google::Cloud::VideoIntelligence::V1beta2::Credentials.default
102
111
 
103
112
  @operations_client = OperationsClient.new(
104
113
  credentials: credentials,
@@ -110,7 +119,7 @@ module Google
110
119
  )
111
120
 
112
121
  if credentials.is_a?(String) || credentials.is_a?(Hash)
113
- updater_proc = Google::Cloud::VideoIntelligence::Credentials.new(credentials).updater_proc
122
+ updater_proc = Google::Cloud::VideoIntelligence::V1beta2::Credentials.new(credentials).updater_proc
114
123
  end
115
124
  if credentials.is_a?(GRPC::Core::Channel)
116
125
  channel = credentials
@@ -134,6 +143,7 @@ module Google
134
143
  google_api_client.freeze
135
144
 
136
145
  headers = { :"x-goog-api-client" => google_api_client }
146
+ headers.merge!(metadata) unless metadata.nil?
137
147
  client_config_file = Pathname.new(__dir__).join(
138
148
  "video_intelligence_service_client_config.json"
139
149
  )
@@ -145,13 +155,14 @@ module Google
145
155
  Google::Gax::Grpc::STATUS_CODE_NAMES,
146
156
  timeout,
147
157
  errors: Google::Gax::Grpc::API_ERRORS,
148
- kwargs: headers
158
+ metadata: headers
149
159
  )
150
160
  end
151
161
 
152
162
  # Allow overriding the service path/port in subclasses.
153
163
  service_path = self.class::SERVICE_ADDRESS
154
164
  port = self.class::DEFAULT_SERVICE_PORT
165
+ interceptors = self.class::GRPC_INTERCEPTORS
155
166
  @video_intelligence_service_stub = Google::Gax::Grpc.create_stub(
156
167
  service_path,
157
168
  port,
@@ -159,12 +170,14 @@ module Google
159
170
  channel: channel,
160
171
  updater_proc: updater_proc,
161
172
  scopes: scopes,
173
+ interceptors: interceptors,
162
174
  &Google::Cloud::Videointelligence::V1beta2::VideoIntelligenceService::Stub.method(:new)
163
175
  )
164
176
 
165
177
  @annotate_video = Google::Gax.create_api_call(
166
178
  @video_intelligence_service_stub.method(:annotate_video),
167
- defaults["annotate_video"]
179
+ defaults["annotate_video"],
180
+ exception_transformer: exception_transformer
168
181
  )
169
182
  end
170
183
 
@@ -213,12 +226,15 @@ module Google
213
226
  # @return [Google::Gax::Operation]
214
227
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
215
228
  # @example
216
- # require "google/cloud/video_intelligence/v1beta2"
229
+ # require "google/cloud/video_intelligence"
217
230
  #
218
- # video_intelligence_service_client = Google::Cloud::VideoIntelligence::V1beta2.new
231
+ # video_intelligence_service_client = Google::Cloud::VideoIntelligence.new(version: :v1beta2)
232
+ # input_uri = "gs://demomaker/cat.mp4"
233
+ # features_element = :LABEL_DETECTION
234
+ # features = [features_element]
219
235
  #
220
236
  # # Register a callback during the method call.
221
- # operation = video_intelligence_service_client.annotate_video do |op|
237
+ # operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
222
238
  # raise op.results.message if op.error?
223
239
  # op_results = op.results
224
240
  # # Process the results.
@@ -7,7 +7,7 @@
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
9
  #
10
- # https://www.apache.org/licenses/LICENSE-2.0
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
11
  #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -7,7 +7,7 @@
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
9
  #
10
- # https://www.apache.org/licenses/LICENSE-2.0
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
11
  #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
@@ -7,7 +7,7 @@
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
9
  #
10
- # https://www.apache.org/licenses/LICENSE-2.0
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
11
  #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - Google Inc
7
+ - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-19 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,20 +38,34 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rubocop
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "<="
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 0.35.1
61
+ version: 0.50.0
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - "<="
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 0.35.1
68
+ version: 0.50.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: simplecov
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0.9'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
69
97
  description: google-cloud-video_intelligence is the official library for Cloud Video
70
98
  Intelligence API.
71
99
  email: googleapis-packages@google.com
@@ -79,7 +107,9 @@ files:
79
107
  - lib/google/cloud/video_intelligence.rb
80
108
  - lib/google/cloud/video_intelligence/credentials.rb
81
109
  - lib/google/cloud/video_intelligence/v1.rb
110
+ - lib/google/cloud/video_intelligence/v1/credentials.rb
82
111
  - lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb
112
+ - lib/google/cloud/video_intelligence/v1/doc/google/longrunning/operations.rb
83
113
  - lib/google/cloud/video_intelligence/v1/doc/google/protobuf/any.rb
84
114
  - lib/google/cloud/video_intelligence/v1/doc/google/protobuf/duration.rb
85
115
  - lib/google/cloud/video_intelligence/v1/doc/google/rpc/status.rb
@@ -87,14 +117,18 @@ files:
87
117
  - lib/google/cloud/video_intelligence/v1/video_intelligence_service_client.rb
88
118
  - lib/google/cloud/video_intelligence/v1/video_intelligence_service_client_config.json
89
119
  - lib/google/cloud/video_intelligence/v1beta1.rb
120
+ - lib/google/cloud/video_intelligence/v1beta1/credentials.rb
90
121
  - lib/google/cloud/video_intelligence/v1beta1/doc/google/cloud/videointelligence/v1beta1/video_intelligence.rb
122
+ - lib/google/cloud/video_intelligence/v1beta1/doc/google/longrunning/operations.rb
91
123
  - lib/google/cloud/video_intelligence/v1beta1/doc/google/protobuf/any.rb
92
124
  - lib/google/cloud/video_intelligence/v1beta1/doc/google/rpc/status.rb
93
125
  - lib/google/cloud/video_intelligence/v1beta1/doc/overview.rb
94
126
  - lib/google/cloud/video_intelligence/v1beta1/video_intelligence_service_client.rb
95
127
  - lib/google/cloud/video_intelligence/v1beta1/video_intelligence_service_client_config.json
96
128
  - lib/google/cloud/video_intelligence/v1beta2.rb
129
+ - lib/google/cloud/video_intelligence/v1beta2/credentials.rb
97
130
  - lib/google/cloud/video_intelligence/v1beta2/doc/google/cloud/videointelligence/v1beta2/video_intelligence.rb
131
+ - lib/google/cloud/video_intelligence/v1beta2/doc/google/longrunning/operations.rb
98
132
  - lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/any.rb
99
133
  - lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/duration.rb
100
134
  - lib/google/cloud/video_intelligence/v1beta2/doc/google/rpc/status.rb
@@ -107,7 +141,7 @@ files:
107
141
  - lib/google/cloud/videointelligence/v1beta1/video_intelligence_services_pb.rb
108
142
  - lib/google/cloud/videointelligence/v1beta2/video_intelligence_pb.rb
109
143
  - lib/google/cloud/videointelligence/v1beta2/video_intelligence_services_pb.rb
110
- homepage: https://github.com/googleapis/googleapis
144
+ homepage: https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/master/google-cloud-video_intelligence
111
145
  licenses:
112
146
  - Apache-2.0
113
147
  metadata: {}
@@ -127,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
161
  version: '0'
128
162
  requirements: []
129
163
  rubyforge_project:
130
- rubygems_version: 2.7.3
164
+ rubygems_version: 2.7.7
131
165
  signing_key:
132
166
  specification_version: 4
133
167
  summary: API Client library for Cloud Video Intelligence API