google-cloud-automl 0.7.0 → 1.1.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 -59
- data/LICENSE.md +201 -0
- data/MIGRATING.md +324 -0
- data/README.md +97 -27
- 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 +75 -111
- 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,54 @@
|
|
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 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?*.
|
13
|
+
|
14
|
+
View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-automl/latest)
|
15
|
+
for this library, google-cloud-automl, 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-automl-v1](https://googleapis.dev/ruby/google-cloud-automl-v1/latest),
|
20
|
+
[google-cloud-automl-v1beta1](https://googleapis.dev/ruby/google-cloud-automl-v1beta1/latest).
|
21
|
+
|
22
|
+
See also the [Product Documentation](https://cloud.google.com/automl)
|
23
|
+
for more usage information.
|
24
|
+
|
25
|
+
## Quick Start
|
17
26
|
|
18
|
-
### Installation
|
19
27
|
```
|
20
28
|
$ gem install google-cloud-automl
|
21
29
|
```
|
22
30
|
|
23
|
-
|
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.
|
31
|
+
In order to use this library, you first need to go through the following steps:
|
30
32
|
|
31
|
-
[
|
32
|
-
[
|
33
|
+
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
+
1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
+
1. [Enable the API.](https://console.cloud.google.com/apis/library/automl.googleapis.com)
|
36
|
+
1. {file:AUTHENTICATION.md Set up authentication.}
|
37
|
+
|
38
|
+
## Migrating from 0.x versions
|
39
|
+
|
40
|
+
The 1.0 release of the google-cloud-automl client is a significant upgrade
|
41
|
+
based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
|
42
|
+
and includes substantial interface changes. Existing code written for earlier
|
43
|
+
versions of this library will likely require updates to use this version.
|
44
|
+
See the {file:MIGRATING.md MIGRATING.md} document for more information.
|
33
45
|
|
34
46
|
## Enabling Logging
|
35
47
|
|
36
48
|
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
|
49
|
+
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
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
39
|
-
that will write logs to [
|
51
|
+
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
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
41
53
|
|
42
54
|
Configuring a Ruby stdlib logger:
|
@@ -59,11 +71,69 @@ end
|
|
59
71
|
|
60
72
|
## Supported Ruby Versions
|
61
73
|
|
62
|
-
This library is supported on Ruby 2.
|
74
|
+
This library is supported on Ruby 2.5+.
|
63
75
|
|
64
76
|
Google provides official support for Ruby versions that are actively supported
|
65
77
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
66
|
-
in security maintenance, and not end of life. Currently, this means Ruby 2.
|
78
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.5
|
67
79
|
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
68
80
|
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
69
81
|
about the Ruby support schedule.
|
82
|
+
|
83
|
+
## Which client should I use?
|
84
|
+
|
85
|
+
Most modern Ruby client libraries for Google APIs come in two flavors: the main
|
86
|
+
client library with a name such as `google-cloud-automl`,
|
87
|
+
and lower-level _versioned_ client libraries with names such as
|
88
|
+
`google-cloud-automl-v1`.
|
89
|
+
_In most cases, you should install the main client._
|
90
|
+
|
91
|
+
### What's the difference between the main client and a versioned client?
|
92
|
+
|
93
|
+
A _versioned client_ provides a basic set of data types and client classes for
|
94
|
+
a _single version_ of a specific service. (That is, for a service with multiple
|
95
|
+
versions, there might be a separate versioned client for each service version.)
|
96
|
+
Most versioned clients are written and maintained by a code generator.
|
97
|
+
|
98
|
+
The _main client_ is designed to provide you with the _recommended_ client
|
99
|
+
interfaces for the service. There will be only one main client for any given
|
100
|
+
service, even a service with multiple versions. The main client includes
|
101
|
+
factory methods for constructing the client objects we recommend for most
|
102
|
+
users. In some cases, those will be classes provided by an underlying versioned
|
103
|
+
client; in other cases, they will be handwritten higher-level client objects
|
104
|
+
with additional capabilities, convenience methods, or best practices built in.
|
105
|
+
Generally, the main client will default to a recommended service version,
|
106
|
+
although in some cases you can override this if you need to talk to a specific
|
107
|
+
service version.
|
108
|
+
|
109
|
+
### Why would I want to use the main client?
|
110
|
+
|
111
|
+
We recommend that most users install the main client gem for a service. You can
|
112
|
+
identify this gem as the one _without_ a version in its name, e.g.
|
113
|
+
`google-cloud-automl`.
|
114
|
+
The main client is recommended because it will embody the best practices for
|
115
|
+
accessing the service, and may also provide more convenient interfaces or
|
116
|
+
tighter integration into frameworks and third-party libraries. In addition, the
|
117
|
+
documentation and samples published by Google will generally demonstrate use of
|
118
|
+
the main client.
|
119
|
+
|
120
|
+
### Why would I want to use a versioned client?
|
121
|
+
|
122
|
+
You can use a versioned client if you are content with a possibly lower-level
|
123
|
+
class interface, you explicitly want to avoid features provided by the main
|
124
|
+
client, or you want to access a specific service version not be covered by the
|
125
|
+
main client. You can identify versioned client gems because the service version
|
126
|
+
is part of the name, e.g. `google-cloud-automl-v1`.
|
127
|
+
|
128
|
+
### What about the google-apis-<name> clients?
|
129
|
+
|
130
|
+
Client library gems with names that begin with `google-apis-` are based on an
|
131
|
+
older code generation technology. They talk to a REST/JSON backend (whereas
|
132
|
+
most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
|
133
|
+
not offer the same performance, features, and ease of use provided by more
|
134
|
+
modern clients.
|
135
|
+
|
136
|
+
The `google-apis-` clients have wide coverage across Google services, so you
|
137
|
+
might need to use one if there is no modern client available for the service.
|
138
|
+
However, if a modern client is available, we generally recommend it over the
|
139
|
+
older `google-apis-` clients.
|
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:* `Numeric`) -
|
138
|
+
# Default timeout in seconds.
|
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
|