google-cloud-video_intelligence 2.1.0 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +274 -0
  6. data/README.md +95 -62
  7. data/lib/{google/cloud/video_intelligence/credentials.rb → google-cloud-video_intelligence.rb} +5 -13
  8. data/lib/google/cloud/video_intelligence.rb +87 -156
  9. data/lib/google/cloud/video_intelligence/version.rb +6 -2
  10. metadata +99 -83
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/video_intelligence/v1.rb +0 -186
  13. data/lib/google/cloud/video_intelligence/v1/credentials.rb +0 -41
  14. data/lib/google/cloud/video_intelligence/v1/doc/google/cloud/videointelligence/v1/video_intelligence.rb +0 -789
  15. data/lib/google/cloud/video_intelligence/v1/doc/google/longrunning/operations.rb +0 -51
  16. data/lib/google/cloud/video_intelligence/v1/doc/google/protobuf/any.rb +0 -131
  17. data/lib/google/cloud/video_intelligence/v1/doc/google/protobuf/duration.rb +0 -91
  18. data/lib/google/cloud/video_intelligence/v1/doc/google/rpc/status.rb +0 -39
  19. data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client.rb +0 -309
  20. data/lib/google/cloud/video_intelligence/v1/video_intelligence_service_client_config.json +0 -31
  21. data/lib/google/cloud/video_intelligence/v1beta2.rb +0 -149
  22. data/lib/google/cloud/video_intelligence/v1beta2/credentials.rb +0 -41
  23. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/cloud/videointelligence/v1beta2/video_intelligence.rb +0 -372
  24. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/longrunning/operations.rb +0 -51
  25. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/any.rb +0 -131
  26. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/protobuf/duration.rb +0 -91
  27. data/lib/google/cloud/video_intelligence/v1beta2/doc/google/rpc/status.rb +0 -39
  28. data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client.rb +0 -309
  29. data/lib/google/cloud/video_intelligence/v1beta2/video_intelligence_service_client_config.json +0 -31
  30. data/lib/google/cloud/video_intelligence/v1p1beta1.rb +0 -187
  31. data/lib/google/cloud/video_intelligence/v1p1beta1/credentials.rb +0 -41
  32. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/cloud/videointelligence/v1p1beta1/video_intelligence.rb +0 -410
  33. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/longrunning/operations.rb +0 -51
  34. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/any.rb +0 -131
  35. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/protobuf/duration.rb +0 -91
  36. data/lib/google/cloud/video_intelligence/v1p1beta1/doc/google/rpc/status.rb +0 -39
  37. data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client.rb +0 -309
  38. data/lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client_config.json +0 -31
  39. data/lib/google/cloud/video_intelligence/v1p2beta1.rb +0 -187
  40. data/lib/google/cloud/video_intelligence/v1p2beta1/credentials.rb +0 -41
  41. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/cloud/videointelligence/v1p2beta1/video_intelligence.rb +0 -442
  42. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/longrunning/operations.rb +0 -51
  43. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/any.rb +0 -131
  44. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/protobuf/duration.rb +0 -91
  45. data/lib/google/cloud/video_intelligence/v1p2beta1/doc/google/rpc/status.rb +0 -39
  46. data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client.rb +0 -309
  47. data/lib/google/cloud/video_intelligence/v1p2beta1/video_intelligence_service_client_config.json +0 -31
  48. data/lib/google/cloud/videointelligence/v1/video_intelligence_pb.rb +0 -304
  49. data/lib/google/cloud/videointelligence/v1/video_intelligence_services_pb.rb +0 -50
  50. data/lib/google/cloud/videointelligence/v1beta2/video_intelligence_pb.rb +0 -170
  51. data/lib/google/cloud/videointelligence/v1beta2/video_intelligence_services_pb.rb +0 -51
  52. data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_pb.rb +0 -172
  53. data/lib/google/cloud/videointelligence/v1p1beta1/video_intelligence_services_pb.rb +0 -51
  54. data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_pb.rb +0 -193
  55. data/lib/google/cloud/videointelligence/v1p2beta1/video_intelligence_services_pb.rb +0 -51
data/README.md CHANGED
@@ -1,81 +1,56 @@
1
- # Ruby Client for Cloud Video Intelligence API
1
+ # Ruby Client for the Cloud Video Intelligence API
2
2
 
3
- [Cloud Video Intelligence API][Product Documentation]:
4
- Detects objects, explicit content, and scene changes in videos. It also
5
- specifies the region for annotation and transcribes speech to text.
6
- Supports both asynchronous API and streaming API.
7
- - [Client Library Documentation][]
8
- - [Product Documentation][]
3
+ API Client library for the Cloud Video Intelligence API
9
4
 
10
- ## Quick Start
11
- In order to use this library, you first need to go through the following
12
- steps:
5
+ Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.
13
6
 
14
- 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
15
- 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
16
- 3. [Enable the Cloud Video Intelligence API.](https://console.cloud.google.com/apis/library/videointelligence.googleapis.com)
17
- 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-video_intelligence/latest/file.AUTHENTICATION.html)
7
+ Actual client classes for the various versions of this API are defined in
8
+ _versioned_ client gems, with names of the form `google-cloud-video_intelligence-v*`.
9
+ The gem `google-cloud-video_intelligence` is the main client library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients. More information on versioned clients can be found below
12
+ in the section titled *Which client should I use?*.
18
13
 
19
- ### Installation
20
- ```
21
- $ gem install google-cloud-video_intelligence
22
- ```
14
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-video_intelligence/latest)
15
+ for this library, google-cloud-video_intelligence, to see the convenience methods for
16
+ constructing client objects. Reference documentation for the client objects
17
+ themselves can be found in the client library documentation for the versioned
18
+ client gems:
19
+ [google-cloud-video_intelligence-v1](https://googleapis.dev/ruby/google-cloud-video_intelligence-v1/latest),
20
+ [google-cloud-video_intelligence-v1beta2](https://googleapis.dev/ruby/google-cloud-video_intelligence-v1beta2/latest),
21
+ [google-cloud-video_intelligence-v1p1beta1](https://googleapis.dev/ruby/google-cloud-video_intelligence-v1p1beta1/latest),
22
+ [google-cloud-video_intelligence-v1p2beta1](https://googleapis.dev/ruby/google-cloud-video_intelligence-v1p2beta1/latest).
23
23
 
24
- ### Preview
25
- #### VideoIntelligenceServiceClient
26
- ```rb
27
- require "google/cloud/video_intelligence"
28
-
29
- video_intelligence_client = Google::Cloud::VideoIntelligence.new
30
- input_uri = "gs://cloud-samples-data/video/cat.mp4"
31
- features_element = :LABEL_DETECTION
32
- features = [features_element]
33
-
34
- # Register a callback during the method call.
35
- operation = video_intelligence_client.annotate_video(features, input_uri: input_uri) do |op|
36
- raise op.results.message if op.error?
37
- op_results = op.results
38
- # Process the results.
39
-
40
- metadata = op.metadata
41
- # Process the metadata.
42
- end
24
+ See also the [Product Documentation](https://cloud.google.com/video-intelligence)
25
+ for more usage information.
43
26
 
44
- # Or use the return value to register a callback.
45
- operation.on_done do |op|
46
- raise op.results.message if op.error?
47
- op_results = op.results
48
- # Process the results.
27
+ ## Quick Start
49
28
 
50
- metadata = op.metadata
51
- # Process the metadata.
52
- end
29
+ ```
30
+ $ gem install google-cloud-video_intelligence
31
+ ```
53
32
 
54
- # Manually reload the operation.
55
- operation.reload!
33
+ In order to use this library, you first need to go through the following steps:
56
34
 
57
- # Or block until the operation completes, triggering callbacks on
58
- # completion.
59
- operation.wait_until_done!
60
- ```
35
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/videointelligence.googleapis.com)
38
+ 1. {file:AUTHENTICATION.md Set up authentication.}
61
39
 
62
- ### Next Steps
63
- - Read the [Client Library Documentation][] for Cloud Video Intelligence API
64
- to see other available methods on the client.
65
- - Read the [Cloud Video Intelligence API Product documentation][Product Documentation]
66
- to learn more about the product and see How-to Guides.
67
- - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
68
- to see the full list of Cloud APIs that we cover.
40
+ ## Migrating from 2.x versions
69
41
 
70
- [Client Library Documentation]: https://googleapis.dev/ruby/google-cloud-video_intelligence/latest
71
- [Product Documentation]: https://cloud.google.com/video-intelligence
42
+ The 3.0 release of the google-cloud-video_intelligence client is a significant upgrade
43
+ based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
44
+ and includes substantial interface changes. Existing code written for earlier
45
+ versions of this library will likely require updates to use this version.
46
+ See the {file:MIGRATING.md MIGRATING.md} document for more information.
72
47
 
73
48
  ## Enabling Logging
74
49
 
75
50
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
76
- 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,
51
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
77
52
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
78
- 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)
53
+ that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
79
54
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
80
55
 
81
56
  Configuring a Ruby stdlib logger:
@@ -106,3 +81,61 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
106
81
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
107
82
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
108
83
  about the Ruby support schedule.
84
+
85
+ ## Which client should I use?
86
+
87
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
88
+ client library with a name such as `google-cloud-video_intelligence`,
89
+ and lower-level _versioned_ client libraries with names such as
90
+ `google-cloud-video_intelligence-v1`.
91
+ _In most cases, you should install the main client._
92
+
93
+ ### What's the difference between the main client and a versioned client?
94
+
95
+ A _versioned client_ provides a basic set of data types and client classes for
96
+ a _single version_ of a specific service. (That is, for a service with multiple
97
+ versions, there might be a separate versioned client for each service version.)
98
+ Most versioned clients are written and maintained by a code generator.
99
+
100
+ The _main client_ is designed to provide you with the _recommended_ client
101
+ interfaces for the service. There will be only one main client for any given
102
+ service, even a service with multiple versions. The main client includes
103
+ factory methods for constructing the client objects we recommend for most
104
+ users. In some cases, those will be classes provided by an underlying versioned
105
+ client; in other cases, they will be handwritten higher-level client objects
106
+ with additional capabilities, convenience methods, or best practices built in.
107
+ Generally, the main client will default to a recommended service version,
108
+ although in some cases you can override this if you need to talk to a specific
109
+ service version.
110
+
111
+ ### Why would I want to use the main client?
112
+
113
+ We recommend that most users install the main client gem for a service. You can
114
+ identify this gem as the one _without_ a version in its name, e.g.
115
+ `google-cloud-video_intelligence`.
116
+ The main client is recommended because it will embody the best practices for
117
+ accessing the service, and may also provide more convenient interfaces or
118
+ tighter integration into frameworks and third-party libraries. In addition, the
119
+ documentation and samples published by Google will generally demonstrate use of
120
+ the main client.
121
+
122
+ ### Why would I want to use a versioned client?
123
+
124
+ You can use a versioned client if you are content with a possibly lower-level
125
+ class interface, you explicitly want to avoid features provided by the main
126
+ client, or you want to access a specific service version not be covered by the
127
+ main client. You can identify versioned client gems because the service version
128
+ is part of the name, e.g. `google-cloud-video_intelligence-v1`.
129
+
130
+ ### What about the google-apis-<name> clients?
131
+
132
+ Client library gems with names that begin with `google-apis-` are based on an
133
+ older code generation technology. They talk to a REST/JSON backend (whereas
134
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
135
+ not offer the same performance, features, and ease of use provided by more
136
+ modern clients.
137
+
138
+ The `google-apis-` clients have wide coverage across Google services, so you
139
+ might need to use one if there is no modern client available for the service.
140
+ However, if a modern client is available, we generally recommend it over the
141
+ older `google-apis-` clients.
@@ -1,4 +1,6 @@
1
- # Copyright 2018 Google LLC
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
4
6
  # you may not use this file except in compliance with the License.
@@ -12,16 +14,6 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
15
18
 
16
- require "google/cloud/video_intelligence/v1/credentials"
17
-
18
- module Google
19
- module Cloud
20
- module VideoIntelligence
21
- ##
22
- # @deprecated Use version-specific credentials classes
23
- #
24
- Credentials = Google::Cloud::VideoIntelligence::V1::Credentials
25
- end
26
- end
27
- end
19
+ require "google/cloud/video_intelligence" unless defined? Google::Cloud::VideoIntelligence::VERSION
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,173 +14,102 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # Require this file early so that the version constant gets defined before
20
+ # requiring "google/cloud". This is because google-cloud-core will load the
21
+ # entrypoint (gem name) file, which in turn re-requires this file (hence
22
+ # causing a require cycle) unless the version constant is already defined.
23
+ require "google/cloud/video_intelligence/version"
15
24
 
16
- require "google/gax"
17
- require "pathname"
25
+ require "googleauth"
26
+ gem "google-cloud-core"
27
+ require "google/cloud" unless defined? ::Google::Cloud.new
28
+ require "google/cloud/config"
29
+
30
+ # Set the default configuration
31
+ ::Google::Cloud.configure.add_config! :video_intelligence do |config|
32
+ config.add_field! :endpoint, "videointelligence.googleapis.com", match: ::String
33
+ config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
34
+ config.add_field! :scope, nil, match: [::Array, ::String]
35
+ config.add_field! :lib_name, nil, match: ::String
36
+ config.add_field! :lib_version, nil, match: ::String
37
+ config.add_field! :interceptors, nil, match: ::Array
38
+ config.add_field! :timeout, nil, match: ::Numeric
39
+ config.add_field! :metadata, nil, match: ::Hash
40
+ config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
41
+ config.add_field! :quota_project, nil, match: ::String
42
+ end
18
43
 
19
44
  module Google
20
45
  module Cloud
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Cloud Video Intelligence API
25
- #
26
- # [Cloud Video Intelligence API][Product Documentation]:
27
- # Detects objects, explicit content, and scene changes in videos. It also
28
- # specifies the region for annotation and transcribes speech to text.
29
- # Supports both asynchronous API and streaming API.
30
- # - [Product Documentation][]
31
- #
32
- # ## Quick Start
33
- # In order to use this library, you first need to go through the following
34
- # steps:
35
- #
36
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
37
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
38
- # 3. [Enable the Cloud Video Intelligence API.](https://console.cloud.google.com/apis/library/videointelligence.googleapis.com)
39
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-video_intelligence/latest/file.AUTHENTICATION.html)
40
- #
41
- # ### Installation
42
- # ```
43
- # $ gem install google-cloud-video_intelligence
44
- # ```
45
- #
46
- # ### Preview
47
- # #### VideoIntelligenceServiceClient
48
- # ```rb
49
- # require "google/cloud/video_intelligence"
50
- #
51
- # video_intelligence_client = Google::Cloud::VideoIntelligence.new
52
- # input_uri = "gs://cloud-samples-data/video/cat.mp4"
53
- # features_element = :LABEL_DETECTION
54
- # features = [features_element]
55
- #
56
- # # Register a callback during the method call.
57
- # operation = video_intelligence_client.annotate_video(features, input_uri: input_uri) 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
- # # Or use the return value to register a callback.
67
- # operation.on_done do |op|
68
- # raise op.results.message if op.error?
69
- # op_results = op.results
70
- # # Process the results.
71
- #
72
- # metadata = op.metadata
73
- # # Process the metadata.
74
- # end
75
- #
76
- # # Manually reload the operation.
77
- # operation.reload!
78
- #
79
- # # Or block until the operation completes, triggering callbacks on
80
- # # completion.
81
- # operation.wait_until_done!
82
- # ```
83
- #
84
- # ### Next Steps
85
- # - Read the [Cloud Video Intelligence API Product documentation][Product Documentation]
86
- # to learn more about the product and see How-to Guides.
87
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
88
- # to see the full list of Cloud APIs that we cover.
89
- #
90
- # [Product Documentation]: https://cloud.google.com/video-intelligence
91
- #
92
- # ## Enabling Logging
93
- #
94
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
95
- # 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,
96
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
97
- # 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)
98
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
99
- #
100
- # Configuring a Ruby stdlib logger:
101
- #
102
- # ```ruby
103
- # require "logger"
104
- #
105
- # module MyLogger
106
- # LOGGER = Logger.new $stderr, level: Logger::WARN
107
- # def logger
108
- # LOGGER
109
- # end
110
- # end
111
- #
112
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
113
- # module GRPC
114
- # extend MyLogger
115
- # end
116
- # ```
117
- #
118
46
  module VideoIntelligence
119
- # rubocop:enable LineLength
120
-
121
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("video_intelligence"))
47
+ ##
48
+ # Create a new client object for VideoIntelligenceService.
49
+ #
50
+ # By default, this returns an instance of
51
+ # [Google::Cloud::VideoIntelligence::V1::VideoIntelligenceService::Client](https://googleapis.dev/ruby/google-cloud-video_intelligence-v1/latest/Google/Cloud/VideoIntelligence/V1/VideoIntelligenceService/Client.html)
52
+ # for version V1 of the API.
53
+ # However, you can specify specify a different API version by passing it in the
54
+ # `version` parameter. If the VideoIntelligenceService service is
55
+ # supported by that API version, and the corresponding gem is available, the
56
+ # appropriate versioned client will be returned.
57
+ #
58
+ # ## About VideoIntelligenceService
59
+ #
60
+ # Service that implements the Video Intelligence API.
61
+ #
62
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
63
+ # Defaults to `:v1`.
64
+ # @return [VideoIntelligenceService::Client] A client object for the specified version.
65
+ #
66
+ def self.video_intelligence_service version: :v1, &block
67
+ require "google/cloud/video_intelligence/#{version.to_s.downcase}"
122
68
 
123
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
124
- .select { |file| File.directory?(file) }
125
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
126
- .select { |dir| File.exist?(dir + ".rb") }
127
- .map { |dir| File.basename(dir) }
69
+ package_name = Google::Cloud::VideoIntelligence
70
+ .constants
71
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
72
+ .first
73
+ package_module = Google::Cloud::VideoIntelligence.const_get package_name
74
+ package_module.const_get(:VideoIntelligenceService).const_get(:Client).new(&block)
75
+ end
128
76
 
129
77
  ##
130
- # Service that implements Google Cloud Video Intelligence API.
78
+ # Configure the google-cloud-video_intelligence library.
131
79
  #
132
- # @param version [Symbol, String]
133
- # The major version of the service to be used. By default :v1
134
- # is used.
135
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
136
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
137
- # Provides the means for authenticating requests made by the client. This parameter can
138
- # be many types.
139
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
140
- # authenticating requests made by this client.
141
- # A `String` will be treated as the path to the keyfile to be used for the construction of
142
- # credentials for this client.
143
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
144
- # credentials for this client.
145
- # A `GRPC::Core::Channel` will be used to make calls through.
146
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
147
- # should already be composed with a `GRPC::Core::CallCredentials` object.
148
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
149
- # metadata for requests, generally, to give OAuth credentials.
150
- # @param scopes [Array<String>]
151
- # The OAuth scopes for this service. This parameter is ignored if
152
- # an updater_proc is supplied.
153
- # @param client_config [Hash]
154
- # A Hash for call options for each method. See
155
- # Google::Gax#construct_settings for the structure of
156
- # this data. Falls back to the default config if not specified
157
- # or the specified config is missing data points.
158
- # @param timeout [Numeric]
159
- # The default timeout, in seconds, for calls made through this client.
160
- # @param metadata [Hash]
161
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
162
- # @param service_address [String]
163
- # Override for the service hostname, or `nil` to leave as the default.
164
- # @param service_port [Integer]
165
- # Override for the service port, or `nil` to leave as the default.
166
- # @param exception_transformer [Proc]
167
- # An optional proc that intercepts any exceptions raised during an API call to inject
168
- # custom error handling.
169
- def self.new(*args, version: :v1, **kwargs)
170
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
171
- raise "The version: #{version} is not available. The available versions " \
172
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
173
- end
80
+ # The following configuration parameters are supported:
81
+ #
82
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
83
+ # The path to the keyfile as a String, the contents of the keyfile as a
84
+ # Hash, or a Google::Auth::Credentials object.
85
+ # * `lib_name` (*type:* `String`) -
86
+ # The library name as recorded in instrumentation and logging.
87
+ # * `lib_version` (*type:* `String`) -
88
+ # The library version as recorded in instrumentation and logging.
89
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
90
+ # An array of interceptors that are run before calls are executed.
91
+ # * `timeout` (*type:* `Numeric`) -
92
+ # Default timeout in seconds.
93
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
94
+ # Additional gRPC headers to be sent with the call.
95
+ # * `retry_policy` (*type:* `Hash`) -
96
+ # The retry policy. The value is a hash with the following keys:
97
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
98
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
99
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
100
+ # * `:retry_codes` (*type:* `Array<String>`) -
101
+ # The error codes that should trigger a retry.
102
+ #
103
+ # @return [::Google::Cloud::Config] The default configuration used by this library
104
+ #
105
+ def self.configure
106
+ yield ::Google::Cloud.configure.video_intelligence if block_given?
174
107
 
175
- require "#{FILE_DIR}/#{version.to_s.downcase}"
176
- version_module = Google::Cloud::VideoIntelligence
177
- .constants
178
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
179
- .first
180
- Google::Cloud::VideoIntelligence.const_get(version_module).new(*args, **kwargs)
108
+ ::Google::Cloud.configure.video_intelligence
181
109
  end
182
110
  end
183
111
  end
184
112
  end
113
+
114
+ helper_path = ::File.join __dir__, "video_intelligence", "helpers.rb"
115
+ require "google/cloud/video_intelligence/helpers" if ::File.file? helper_path