google-cloud-automl 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -54
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +324 -0
  6. data/README.md +36 -25
  7. data/lib/google-cloud-automl.rb +6 -2
  8. data/lib/google/cloud/automl.rb +132 -190
  9. data/lib/google/cloud/automl/version.rb +6 -2
  10. metadata +74 -110
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/automl/v1beta1.rb +0 -231
  13. data/lib/google/cloud/automl/v1beta1/annotation_payload_pb.rb +0 -34
  14. data/lib/google/cloud/automl/v1beta1/annotation_spec_pb.rb +0 -19
  15. data/lib/google/cloud/automl/v1beta1/automl_client.rb +0 -1909
  16. data/lib/google/cloud/automl/v1beta1/automl_client_config.json +0 -146
  17. data/lib/google/cloud/automl/v1beta1/automl_client_helpers.rb +0 -109
  18. data/lib/google/cloud/automl/v1beta1/classification_pb.rb +0 -66
  19. data/lib/google/cloud/automl/v1beta1/column_spec_pb.rb +0 -29
  20. data/lib/google/cloud/automl/v1beta1/credentials.rb +0 -41
  21. data/lib/google/cloud/automl/v1beta1/data_items_pb.rb +0 -88
  22. data/lib/google/cloud/automl/v1beta1/data_stats_pb.rb +0 -77
  23. data/lib/google/cloud/automl/v1beta1/data_types_pb.rb +0 -36
  24. data/lib/google/cloud/automl/v1beta1/dataset_pb.rb +0 -39
  25. data/lib/google/cloud/automl/v1beta1/detection_pb.rb +0 -52
  26. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/annotation_payload.rb +0 -63
  27. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/annotation_spec.rb +0 -39
  28. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/classification.rb +0 -212
  29. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/column_spec.rb +0 -67
  30. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_items.rb +0 -202
  31. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_stats.rb +0 -160
  32. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_types.rb +0 -99
  33. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/dataset.rb +0 -77
  34. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/detection.rb +0 -130
  35. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/geometry.rb +0 -43
  36. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/image.rb +0 -183
  37. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/io.rb +0 -1110
  38. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/model.rb +0 -88
  39. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/model_evaluation.rb +0 -96
  40. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/prediction_service.rb +0 -186
  41. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/ranges.rb +0 -31
  42. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/regression.rb +0 -41
  43. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/service.rb +0 -356
  44. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/table_spec.rb +0 -68
  45. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/tables.rb +0 -275
  46. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/temporal.rb +0 -33
  47. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text.rb +0 -54
  48. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_extraction.rb +0 -60
  49. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_segment.rb +0 -37
  50. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_sentiment.rb +0 -76
  51. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/translation.rb +0 -63
  52. data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/video.rb +0 -35
  53. data/lib/google/cloud/automl/v1beta1/doc/google/longrunning/operations.rb +0 -51
  54. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/any.rb +0 -131
  55. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/duration.rb +0 -91
  56. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/field_mask.rb +0 -222
  57. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/struct.rb +0 -74
  58. data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
  59. data/lib/google/cloud/automl/v1beta1/doc/google/rpc/status.rb +0 -39
  60. data/lib/google/cloud/automl/v1beta1/geometry_pb.rb +0 -21
  61. data/lib/google/cloud/automl/v1beta1/image_pb.rb +0 -50
  62. data/lib/google/cloud/automl/v1beta1/io_pb.rb +0 -80
  63. data/lib/google/cloud/automl/v1beta1/model_evaluation_pb.rb +0 -38
  64. data/lib/google/cloud/automl/v1beta1/model_pb.rb +0 -45
  65. data/lib/google/cloud/automl/v1beta1/operations_pb.rb +0 -90
  66. data/lib/google/cloud/automl/v1beta1/prediction_service_client.rb +0 -480
  67. data/lib/google/cloud/automl/v1beta1/prediction_service_client_config.json +0 -36
  68. data/lib/google/cloud/automl/v1beta1/prediction_service_pb.rb +0 -43
  69. data/lib/google/cloud/automl/v1beta1/prediction_service_services_pb.rb +0 -74
  70. data/lib/google/cloud/automl/v1beta1/ranges_pb.rb +0 -17
  71. data/lib/google/cloud/automl/v1beta1/regression_pb.rb +0 -20
  72. data/lib/google/cloud/automl/v1beta1/service_pb.rb +0 -180
  73. data/lib/google/cloud/automl/v1beta1/service_services_pb.rb +0 -158
  74. data/lib/google/cloud/automl/v1beta1/table_spec_pb.rb +0 -24
  75. data/lib/google/cloud/automl/v1beta1/tables_pb.rb +0 -58
  76. data/lib/google/cloud/automl/v1beta1/temporal_pb.rb +0 -18
  77. data/lib/google/cloud/automl/v1beta1/text_extraction_pb.rb +0 -32
  78. data/lib/google/cloud/automl/v1beta1/text_pb.rb +0 -34
  79. data/lib/google/cloud/automl/v1beta1/text_segment_pb.rb +0 -18
  80. data/lib/google/cloud/automl/v1beta1/text_sentiment_pb.rb +0 -29
  81. data/lib/google/cloud/automl/v1beta1/translation_pb.rb +0 -34
  82. data/lib/google/cloud/automl/v1beta1/video_pb.rb +0 -25
data/README.md CHANGED
@@ -1,42 +1,53 @@
1
- # Ruby Client for Cloud AutoML API
1
+ # Ruby Client for the Cloud AutoML API
2
2
 
3
- [Cloud AutoML API][Product Documentation]:
4
- Train high-quality custom machine learning models with minimum effort and
5
- machine learning expertise.
6
- - [Client Library Documentation][]
7
- - [Product Documentation][]
3
+ API Client library for the Cloud AutoML API
8
4
 
9
- ## Quick Start
10
- In order to use this library, you first need to go through the following
11
- steps:
5
+ AutoML makes the power of machine learning available to you even if you have limited knowledge of machine learning. You can use AutoML to build on Google's machine learning capabilities to create your own custom machine learning models that are tailored to your business needs, and then integrate those models into your applications and web sites.
12
6
 
13
- 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
14
- 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
15
- 3. [Enable the Cloud AutoML API.](https://console.cloud.google.com/apis/library/automl.googleapis.com)
16
- 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-automl/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-automl-v*`.
9
+ The gem `google-cloud-automl` is a convenience wrapper library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients.
12
+
13
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-automl/latest)
14
+ for this library, google-cloud-automl, to see the convenience methods for
15
+ constructing client objects. Reference documentation for the client objects
16
+ themselves can be found in the client library documentation for the versioned
17
+ client gems:
18
+ [google-cloud-automl-v1](https://googleapis.dev/ruby/google-cloud-automl-v1/latest),
19
+ [google-cloud-automl-v1beta1](https://googleapis.dev/ruby/google-cloud-automl-v1beta1/latest).
20
+
21
+ See also the [Product Documentation](https://cloud.google.com/automl)
22
+ for more usage information.
23
+
24
+ ## Quick Start
17
25
 
18
- ### Installation
19
26
  ```
20
27
  $ gem install google-cloud-automl
21
28
  ```
22
29
 
23
- ### Next Steps
24
- - Read the [Client Library Documentation][] for Cloud AutoML API
25
- to see other available methods on the client.
26
- - Read the [Cloud AutoML API Product documentation][Product Documentation]
27
- to learn more about the product and see How-to Guides.
28
- - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
29
- to see the full list of Cloud APIs that we cover.
30
+ In order to use this library, you first need to go through the following steps:
31
+
32
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
33
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
34
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/automl.googleapis.com)
35
+ 1. {file:AUTHENTICATION.md Set up authentication.}
36
+
37
+ ## Migrating from 0.x versions
30
38
 
31
- [Client Library Documentation]: https://googleapis.dev/ruby/google-cloud-automl/latest
32
- [Product Documentation]: https://cloud.google.com/automl
39
+ The 1.0 release of the google-cloud-automl client is a significant upgrade
40
+ based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
41
+ and includes substantial interface changes. Existing code written for earlier
42
+ versions of this library will likely require updates to use this version.
43
+ See the {file:MIGRATING.md MIGRATING.md} document for more information.
33
44
 
34
45
  ## Enabling Logging
35
46
 
36
47
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
37
- 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,
48
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
38
49
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
39
- 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)
50
+ 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)
40
51
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
41
52
 
42
53
  Configuring a Ruby stdlib logger:
@@ -1,4 +1,6 @@
1
- # Copyright 2019 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,4 +14,6 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
15
- require "google/cloud/automl"
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/automl" unless defined? Google::Cloud::AutoML::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,208 +14,148 @@
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/automl/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! :automl do |config|
32
+ config.add_field! :endpoint, "automl.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 AutoML API
25
- #
26
- # [Cloud AutoML API][Product Documentation]:
27
- # Train high-quality custom machine learning models with minimum effort and
28
- # machine learning expertise.
29
- # - [Product Documentation][]
30
- #
31
- # ## Quick Start
32
- # In order to use this library, you first need to go through the following
33
- # steps:
34
- #
35
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
- # 3. [Enable the Cloud AutoML API.](https://console.cloud.google.com/apis/library/automl.googleapis.com)
38
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-automl/latest/file.AUTHENTICATION.html)
39
- #
40
- # ### Installation
41
- # ```
42
- # $ gem install google-cloud-automl
43
- # ```
44
- #
45
- # ### Next Steps
46
- # - Read the [Cloud AutoML API Product documentation][Product Documentation]
47
- # to learn more about the product and see How-to Guides.
48
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
49
- # to see the full list of Cloud APIs that we cover.
50
- #
51
- # [Product Documentation]: https://cloud.google.com/automl
52
- #
53
- # ## Enabling Logging
54
- #
55
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
56
- # 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,
57
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
58
- # 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)
59
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
60
- #
61
- # Configuring a Ruby stdlib logger:
62
- #
63
- # ```ruby
64
- # require "logger"
65
- #
66
- # module MyLogger
67
- # LOGGER = Logger.new $stderr, level: Logger::WARN
68
- # def logger
69
- # LOGGER
70
- # end
71
- # end
72
- #
73
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
74
- # module GRPC
75
- # extend MyLogger
76
- # end
77
- # ```
78
- #
79
46
  module AutoML
80
- # rubocop:enable LineLength
81
-
82
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("automl"))
47
+ ##
48
+ # Create a new client object for PredictionService.
49
+ #
50
+ # By default, this returns an instance of
51
+ # [Google::Cloud::AutoML::V1::PredictionService::Client](https://googleapis.dev/ruby/google-cloud-automl-v1/latest/Google/Cloud/AutoML/V1/PredictionService/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 PredictionService 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 PredictionService
59
+ #
60
+ # AutoML Prediction API.
61
+ #
62
+ # On any input that is documented to expect a string parameter in
63
+ # snake_case or kebab-case, either of those cases is accepted.
64
+ #
65
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
66
+ # Defaults to `:v1`.
67
+ # @return [PredictionService::Client] A client object for the specified version.
68
+ #
69
+ def self.prediction_service version: :v1, &block
70
+ require "google/cloud/automl/#{version.to_s.downcase}"
83
71
 
84
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
85
- .select { |file| File.directory?(file) }
86
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
87
- .select { |dir| File.exist?(dir + ".rb") }
88
- .map { |dir| File.basename(dir) }
72
+ package_name = Google::Cloud::AutoML
73
+ .constants
74
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
75
+ .first
76
+ package_module = Google::Cloud::AutoML.const_get package_name
77
+ package_module.const_get(:PredictionService).const_get(:Client).new(&block)
78
+ end
89
79
 
90
- module AutoML
91
- ##
92
- # AutoML Server API.
93
- #
94
- # The resource names are assigned by the server.
95
- # The server never reuses names that it has created after the resources with
96
- # those names are deleted.
97
- #
98
- # An ID of a resource is the last element of the item's resource name. For
99
- # `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then
100
- # the id for the item is `{dataset_id}`.
101
- #
102
- # Currently the only supported `location_id` is "us-central1".
103
- #
104
- # On any input that is documented to expect a string parameter in
105
- # snake_case or kebab-case, either of those cases is accepted.
106
- #
107
- # @param version [Symbol, String]
108
- # The major version of the service to be used. By default :v1beta1
109
- # is used.
110
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
111
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
112
- # Provides the means for authenticating requests made by the client. This parameter can
113
- # be many types.
114
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
115
- # authenticating requests made by this client.
116
- # A `String` will be treated as the path to the keyfile to be used for the construction of
117
- # credentials for this client.
118
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
119
- # credentials for this client.
120
- # A `GRPC::Core::Channel` will be used to make calls through.
121
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
122
- # should already be composed with a `GRPC::Core::CallCredentials` object.
123
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
124
- # metadata for requests, generally, to give OAuth credentials.
125
- # @param scopes [Array<String>]
126
- # The OAuth scopes for this service. This parameter is ignored if
127
- # an updater_proc is supplied.
128
- # @param client_config [Hash]
129
- # A Hash for call options for each method. See
130
- # Google::Gax#construct_settings for the structure of
131
- # this data. Falls back to the default config if not specified
132
- # or the specified config is missing data points.
133
- # @param timeout [Numeric]
134
- # The default timeout, in seconds, for calls made through this client.
135
- # @param metadata [Hash]
136
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
137
- # @param service_address [String]
138
- # Override for the service hostname, or `nil` to leave as the default.
139
- # @param service_port [Integer]
140
- # Override for the service port, or `nil` to leave as the default.
141
- # @param exception_transformer [Proc]
142
- # An optional proc that intercepts any exceptions raised during an API call to inject
143
- # custom error handling.
144
- def self.new(*args, version: :v1beta1, **kwargs)
145
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
146
- raise "The version: #{version} is not available. The available versions " \
147
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
148
- end
80
+ ##
81
+ # Create a new client object for AutoML.
82
+ #
83
+ # By default, this returns an instance of
84
+ # [Google::Cloud::AutoML::V1::AutoML::Client](https://googleapis.dev/ruby/google-cloud-automl-v1/latest/Google/Cloud/AutoML/V1/AutoML/Client.html)
85
+ # for version V1 of the API.
86
+ # However, you can specify specify a different API version by passing it in the
87
+ # `version` parameter. If the AutoML service is
88
+ # supported by that API version, and the corresponding gem is available, the
89
+ # appropriate versioned client will be returned.
90
+ #
91
+ # ## About AutoML
92
+ #
93
+ # AutoML Server API.
94
+ #
95
+ # The resource names are assigned by the server.
96
+ # The server never reuses names that it has created after the resources with
97
+ # those names are deleted.
98
+ #
99
+ # An ID of a resource is the last element of the item's resource name. For
100
+ # `projects/{project_id}/locations/{location_id}/datasets/{dataset_id}`, then
101
+ # the id for the item is `{dataset_id}`.
102
+ #
103
+ # Currently the only supported `location_id` is "us-central1".
104
+ #
105
+ # On any input that is documented to expect a string parameter in
106
+ # snake_case or kebab-case, either of those cases is accepted.
107
+ #
108
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
109
+ # Defaults to `:v1`.
110
+ # @return [AutoML::Client] A client object for the specified version.
111
+ #
112
+ def self.auto_ml version: :v1, &block
113
+ require "google/cloud/automl/#{version.to_s.downcase}"
149
114
 
150
- require "#{FILE_DIR}/#{version.to_s.downcase}"
151
- version_module = Google::Cloud::AutoML
152
- .constants
153
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
154
- .first
155
- Google::Cloud::AutoML.const_get(version_module)::AutoML.new(*args, **kwargs)
156
- end
115
+ package_name = Google::Cloud::AutoML
116
+ .constants
117
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
118
+ .first
119
+ package_module = Google::Cloud::AutoML.const_get package_name
120
+ package_module.const_get(:AutoML).const_get(:Client).new(&block)
157
121
  end
158
122
 
159
- module Prediction
160
- ##
161
- # AutoML Prediction API.
162
- #
163
- # On any input that is documented to expect a string parameter in
164
- # snake_case or kebab-case, either of those cases is accepted.
165
- #
166
- # @param version [Symbol, String]
167
- # The major version of the service to be used. By default :v1beta1
168
- # is used.
169
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
170
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
171
- # Provides the means for authenticating requests made by the client. This parameter can
172
- # be many types.
173
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
174
- # authenticating requests made by this client.
175
- # A `String` will be treated as the path to the keyfile to be used for the construction of
176
- # credentials for this client.
177
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
178
- # credentials for this client.
179
- # A `GRPC::Core::Channel` will be used to make calls through.
180
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
181
- # should already be composed with a `GRPC::Core::CallCredentials` object.
182
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
183
- # metadata for requests, generally, to give OAuth credentials.
184
- # @param scopes [Array<String>]
185
- # The OAuth scopes for this service. This parameter is ignored if
186
- # an updater_proc is supplied.
187
- # @param client_config [Hash]
188
- # A Hash for call options for each method. See
189
- # Google::Gax#construct_settings for the structure of
190
- # this data. Falls back to the default config if not specified
191
- # or the specified config is missing data points.
192
- # @param timeout [Numeric]
193
- # The default timeout, in seconds, for calls made through this client.
194
- # @param metadata [Hash]
195
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
196
- # @param service_address [String]
197
- # Override for the service hostname, or `nil` to leave as the default.
198
- # @param service_port [Integer]
199
- # Override for the service port, or `nil` to leave as the default.
200
- # @param exception_transformer [Proc]
201
- # An optional proc that intercepts any exceptions raised during an API call to inject
202
- # custom error handling.
203
- def self.new(*args, version: :v1beta1, **kwargs)
204
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
205
- raise "The version: #{version} is not available. The available versions " \
206
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
207
- end
123
+ ##
124
+ # Configure the google-cloud-automl library.
125
+ #
126
+ # The following configuration parameters are supported:
127
+ #
128
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
129
+ # The path to the keyfile as a String, the contents of the keyfile as a
130
+ # Hash, or a Google::Auth::Credentials object.
131
+ # * `lib_name` (*type:* `String`) -
132
+ # The library name as recorded in instrumentation and logging.
133
+ # * `lib_version` (*type:* `String`) -
134
+ # The library version as recorded in instrumentation and logging.
135
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
136
+ # An array of interceptors that are run before calls are executed.
137
+ # * `timeout` (*type:* `Integer`) -
138
+ # Default timeout in milliseconds.
139
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
140
+ # Additional gRPC headers to be sent with the call.
141
+ # * `retry_policy` (*type:* `Hash`) -
142
+ # The retry policy. The value is a hash with the following keys:
143
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
144
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
145
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
146
+ # * `:retry_codes` (*type:* `Array<String>`) -
147
+ # The error codes that should trigger a retry.
148
+ #
149
+ # @return [::Google::Cloud::Config] The default configuration used by this library
150
+ #
151
+ def self.configure
152
+ yield ::Google::Cloud.configure.automl if block_given?
208
153
 
209
- require "#{FILE_DIR}/#{version.to_s.downcase}"
210
- version_module = Google::Cloud::AutoML
211
- .constants
212
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
213
- .first
214
- Google::Cloud::AutoML.const_get(version_module)::Prediction.new(*args, **kwargs)
215
- end
154
+ ::Google::Cloud.configure.automl
216
155
  end
217
156
  end
218
157
  end
219
158
  end
159
+
160
+ helper_path = ::File.join __dir__, "automl", "helpers.rb"
161
+ require "google/cloud/automl/helpers" if ::File.file? helper_path
@@ -1,4 +1,6 @@
1
- # Copyright 2019 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,11 +14,13 @@
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
+
15
19
 
16
20
  module Google
17
21
  module Cloud
18
22
  module AutoML
19
- VERSION = "0.7.1".freeze
23
+ VERSION = "1.0.0"
20
24
  end
21
25
  end
22
26
  end