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.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/AUTHENTICATION.md +51 -54
- data/LICENSE.md +203 -0
- data/MIGRATING.md +324 -0
- data/README.md +36 -25
- data/lib/google-cloud-automl.rb +6 -2
- data/lib/google/cloud/automl.rb +132 -190
- data/lib/google/cloud/automl/version.rb +6 -2
- metadata +74 -110
- data/LICENSE +0 -201
- data/lib/google/cloud/automl/v1beta1.rb +0 -231
- data/lib/google/cloud/automl/v1beta1/annotation_payload_pb.rb +0 -34
- data/lib/google/cloud/automl/v1beta1/annotation_spec_pb.rb +0 -19
- data/lib/google/cloud/automl/v1beta1/automl_client.rb +0 -1909
- data/lib/google/cloud/automl/v1beta1/automl_client_config.json +0 -146
- data/lib/google/cloud/automl/v1beta1/automl_client_helpers.rb +0 -109
- data/lib/google/cloud/automl/v1beta1/classification_pb.rb +0 -66
- data/lib/google/cloud/automl/v1beta1/column_spec_pb.rb +0 -29
- data/lib/google/cloud/automl/v1beta1/credentials.rb +0 -41
- data/lib/google/cloud/automl/v1beta1/data_items_pb.rb +0 -88
- data/lib/google/cloud/automl/v1beta1/data_stats_pb.rb +0 -77
- data/lib/google/cloud/automl/v1beta1/data_types_pb.rb +0 -36
- data/lib/google/cloud/automl/v1beta1/dataset_pb.rb +0 -39
- data/lib/google/cloud/automl/v1beta1/detection_pb.rb +0 -52
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/annotation_payload.rb +0 -63
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/annotation_spec.rb +0 -39
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/classification.rb +0 -212
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/column_spec.rb +0 -67
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_items.rb +0 -202
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_stats.rb +0 -160
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/data_types.rb +0 -99
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/dataset.rb +0 -77
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/detection.rb +0 -130
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/geometry.rb +0 -43
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/image.rb +0 -183
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/io.rb +0 -1110
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/model.rb +0 -88
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/model_evaluation.rb +0 -96
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/prediction_service.rb +0 -186
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/ranges.rb +0 -31
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/regression.rb +0 -41
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/service.rb +0 -356
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/table_spec.rb +0 -68
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/tables.rb +0 -275
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/temporal.rb +0 -33
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text.rb +0 -54
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_extraction.rb +0 -60
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_segment.rb +0 -37
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/text_sentiment.rb +0 -76
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/translation.rb +0 -63
- data/lib/google/cloud/automl/v1beta1/doc/google/cloud/automl/v1beta1/video.rb +0 -35
- data/lib/google/cloud/automl/v1beta1/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/duration.rb +0 -91
- data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/struct.rb +0 -74
- data/lib/google/cloud/automl/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/automl/v1beta1/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/automl/v1beta1/geometry_pb.rb +0 -21
- data/lib/google/cloud/automl/v1beta1/image_pb.rb +0 -50
- data/lib/google/cloud/automl/v1beta1/io_pb.rb +0 -80
- data/lib/google/cloud/automl/v1beta1/model_evaluation_pb.rb +0 -38
- data/lib/google/cloud/automl/v1beta1/model_pb.rb +0 -45
- data/lib/google/cloud/automl/v1beta1/operations_pb.rb +0 -90
- data/lib/google/cloud/automl/v1beta1/prediction_service_client.rb +0 -480
- data/lib/google/cloud/automl/v1beta1/prediction_service_client_config.json +0 -36
- data/lib/google/cloud/automl/v1beta1/prediction_service_pb.rb +0 -43
- data/lib/google/cloud/automl/v1beta1/prediction_service_services_pb.rb +0 -74
- data/lib/google/cloud/automl/v1beta1/ranges_pb.rb +0 -17
- data/lib/google/cloud/automl/v1beta1/regression_pb.rb +0 -20
- data/lib/google/cloud/automl/v1beta1/service_pb.rb +0 -180
- data/lib/google/cloud/automl/v1beta1/service_services_pb.rb +0 -158
- data/lib/google/cloud/automl/v1beta1/table_spec_pb.rb +0 -24
- data/lib/google/cloud/automl/v1beta1/tables_pb.rb +0 -58
- data/lib/google/cloud/automl/v1beta1/temporal_pb.rb +0 -18
- data/lib/google/cloud/automl/v1beta1/text_extraction_pb.rb +0 -32
- data/lib/google/cloud/automl/v1beta1/text_pb.rb +0 -34
- data/lib/google/cloud/automl/v1beta1/text_segment_pb.rb +0 -18
- data/lib/google/cloud/automl/v1beta1/text_sentiment_pb.rb +0 -29
- data/lib/google/cloud/automl/v1beta1/translation_pb.rb +0 -34
- 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
|
-
|
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
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
32
|
-
[
|
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
|
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 [
|
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:
|
data/lib/google-cloud-automl.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
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
|
-
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/automl" unless defined? Google::Cloud::AutoML::VERSION
|
data/lib/google/cloud/automl.rb
CHANGED
@@ -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 "
|
17
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
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
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
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
|
-
|
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
|
-
#
|
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.
|
23
|
+
VERSION = "1.0.0"
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|