google-cloud-translate 2.1.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +5 -8
- data/AUTHENTICATION.md +67 -81
- data/LICENSE.md +203 -0
- data/MIGRATING.md +302 -0
- data/README.md +80 -0
- data/lib/google-cloud-translate.rb +5 -146
- data/lib/google/cloud/translate.rb +79 -178
- data/lib/google/cloud/translate/helpers.rb +107 -0
- data/lib/google/cloud/translate/version.rb +6 -2
- metadata +35 -129
- data/CHANGELOG.md +0 -146
- data/CODE_OF_CONDUCT.md +0 -40
- data/CONTRIBUTING.md +0 -188
- data/LICENSE +0 -201
- data/OVERVIEW.md +0 -390
- data/TROUBLESHOOTING.md +0 -37
- data/lib/google/cloud/translate/v2.rb +0 -169
- data/lib/google/cloud/translate/v2/api.rb +0 -255
- data/lib/google/cloud/translate/v2/credentials.rb +0 -58
- data/lib/google/cloud/translate/v2/detection.rb +0 -132
- data/lib/google/cloud/translate/v2/language.rb +0 -68
- data/lib/google/cloud/translate/v2/service.rb +0 -205
- data/lib/google/cloud/translate/v2/translation.rb +0 -120
- data/lib/google/cloud/translate/v3.rb +0 -144
- data/lib/google/cloud/translate/v3/credentials.rb +0 -42
- data/lib/google/cloud/translate/v3/doc/google/cloud/translate/v3/translation_service.rb +0 -663
- data/lib/google/cloud/translate/v3/doc/google/longrunning/operations.rb +0 -51
- data/lib/google/cloud/translate/v3/doc/google/protobuf/any.rb +0 -131
- data/lib/google/cloud/translate/v3/doc/google/protobuf/timestamp.rb +0 -113
- data/lib/google/cloud/translate/v3/doc/google/rpc/status.rb +0 -39
- data/lib/google/cloud/translate/v3/translation_service_client.rb +0 -927
- data/lib/google/cloud/translate/v3/translation_service_client_config.json +0 -66
- data/lib/google/cloud/translate/v3/translation_service_pb.rb +0 -226
- data/lib/google/cloud/translate/v3/translation_service_services_pb.rb +0 -68
|
@@ -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,203 +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/translate/version"
|
|
15
24
|
|
|
16
|
-
require "
|
|
25
|
+
require "googleauth"
|
|
26
|
+
gem "google-cloud-core"
|
|
27
|
+
require "google/cloud" unless defined? ::Google::Cloud.new
|
|
17
28
|
require "google/cloud/config"
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
|
|
30
|
+
# Set the default configuration
|
|
31
|
+
::Google::Cloud.configure.add_config! :translate do |config|
|
|
32
|
+
config.add_field! :endpoint, "translate.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
|
|
20
43
|
|
|
21
44
|
module Google
|
|
22
45
|
module Cloud
|
|
23
|
-
##
|
|
24
|
-
# # Google Cloud Translation API
|
|
25
|
-
#
|
|
26
|
-
# [Google Cloud Translation API](https://cloud.google.com/translation/)
|
|
27
|
-
# provides a simple, programmatic interface for translating an arbitrary
|
|
28
|
-
# string into any supported language. It is highly responsive, so websites
|
|
29
|
-
# and applications can integrate with Translation API for fast, dynamic
|
|
30
|
-
# translation of source text. Language detection is also available in cases
|
|
31
|
-
# where the source language is unknown.
|
|
32
|
-
#
|
|
33
|
-
# Translation API supports more than one hundred different languages, from
|
|
34
|
-
# Afrikaans to Zulu. Used in combination, this enables translation between
|
|
35
|
-
# thousands of language pairs. Also, you can send in HTML and receive HTML
|
|
36
|
-
# with translated text back. You don't need to extract your source text or
|
|
37
|
-
# reassemble the translated content.
|
|
38
|
-
#
|
|
39
|
-
# The google-cloud-translate 2.0 gem contains a generated v3 client and a legacy hand-written v2 client.
|
|
40
|
-
# To use the legacy v2 client, call {Google::Cloud::Translate.new} and specify `version: :v2`.
|
|
41
|
-
# See [Migrating to Translation v3](https://cloud.google.com/translate/docs/migrate-to-v3) for details regarding
|
|
42
|
-
# differences between v2 and v3.
|
|
43
|
-
#
|
|
44
|
-
# See {file:OVERVIEW.md Translation Overview}.
|
|
45
|
-
#
|
|
46
46
|
module Translate
|
|
47
|
-
FILE_DIR = File.realdirpath Pathname.new(__FILE__).join("..").join("translate")
|
|
48
|
-
|
|
49
|
-
AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
|
|
50
|
-
.select { |file| File.directory? file }
|
|
51
|
-
.select { |dir| Google::Gax::VERSION_MATCHER.match File.basename(dir) }
|
|
52
|
-
.select { |dir| File.exist? dir + ".rb" }
|
|
53
|
-
.map { |dir| File.basename dir }
|
|
54
|
-
|
|
55
47
|
##
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
# @overload new(version:, credentials:, scopes:, client_config:, timeout:)
|
|
59
|
-
# @param version [Symbol, String]
|
|
60
|
-
# The major version of the service to be used. By default `:v3` is used.
|
|
61
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel,
|
|
62
|
-
# GRPC::Core::ChannelCredentials, Proc]
|
|
63
|
-
# Provides the means for authenticating requests made by the client. This parameter can be many types.
|
|
64
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for authenticating requests
|
|
65
|
-
# made by this client.
|
|
66
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of credentials for
|
|
67
|
-
# this client.
|
|
68
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of credentials for
|
|
69
|
-
# this client.
|
|
70
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
|
71
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials should already
|
|
72
|
-
# be composed with a `GRPC::Core::CallCredentials` object.
|
|
73
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the metadata for
|
|
74
|
-
# requests, generally, to give OAuth credentials.
|
|
75
|
-
# @param scopes [Array<String>]
|
|
76
|
-
# The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.
|
|
77
|
-
# @param client_config [Hash]
|
|
78
|
-
# A Hash for call options for each method. See Google::Gax#construct_settings for the structure of this data.
|
|
79
|
-
# Falls back to the default config if not specified or the specified config is missing data points.
|
|
80
|
-
# @param timeout [Numeric]
|
|
81
|
-
# The default timeout, in seconds, for calls made through this client.
|
|
82
|
-
# @param metadata [Hash]
|
|
83
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
|
84
|
-
# @param service_address [String]
|
|
85
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
|
86
|
-
# @param service_port [Integer]
|
|
87
|
-
# Override for the service port, or `nil` to leave as the default.
|
|
88
|
-
# @param exception_transformer [Proc]
|
|
89
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject custom error handling.
|
|
90
|
-
# @overload new(version:, project_id:, credentials:, key:, scope:, retries:, timeout:, endpoint:)
|
|
91
|
-
# @param version [Symbol, String]
|
|
92
|
-
# The major version of the service to be used. Specifying `:v2` will return the legacy client.
|
|
93
|
-
# @param [String] project_id Project identifier for the Cloud Translation service you are connecting to. If not
|
|
94
|
-
# present, the default project for the credentials is used.
|
|
95
|
-
# @param [String, Hash, Google::Auth::Credentials] credentials The path to the keyfile as a String, the contents
|
|
96
|
-
# of the keyfile as a Hash, or a Google::Auth::Credentials object. (See
|
|
97
|
-
# {Google::Cloud::Translate::V2::Credentials})
|
|
98
|
-
# @param [String] key a public API access key (not an OAuth 2.0 token)
|
|
99
|
-
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the set of resources and operations that
|
|
100
|
-
# the connection can access. See [Using OAuth 2.0 to Access Google
|
|
101
|
-
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
|
102
|
-
#
|
|
103
|
-
# The default scope is:
|
|
104
|
-
#
|
|
105
|
-
# * `https://www.googleapis.com/auth/cloud-platform`
|
|
106
|
-
# @param [Integer] retries Number of times to retry requests on server error. The default value is `3`.
|
|
107
|
-
# Optional.
|
|
108
|
-
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
|
109
|
-
# @param [String] endpoint Override of the endpoint host name. Optional. If the param is nil, uses the default
|
|
110
|
-
# endpoint.
|
|
111
|
-
#
|
|
112
|
-
# @example Using the v3 client.
|
|
113
|
-
# require "google/cloud/translate"
|
|
114
|
-
#
|
|
115
|
-
# client = Google::Cloud::Translate.new
|
|
116
|
-
#
|
|
117
|
-
# project_id = "my-project-id"
|
|
118
|
-
# location_id = "us-central1"
|
|
119
|
-
# model_id = "my-automl-model-id"
|
|
120
|
-
#
|
|
121
|
-
# # The `model` type requested for this translation.
|
|
122
|
-
# model = "projects/#{project_id}/locations/#{location_id}/models/#{model_id}"
|
|
123
|
-
# # The content to translate in string format
|
|
124
|
-
# contents = ["Hello, world!"]
|
|
125
|
-
# # Required. The BCP-47 language code to use for translation.
|
|
126
|
-
# target_language = "fr"
|
|
127
|
-
# # Optional. The BCP-47 language code of the input text.
|
|
128
|
-
# source_language = "en"
|
|
129
|
-
# # Optional. Can be "text/plain" or "text/html".
|
|
130
|
-
# mime_type = "text/plain"
|
|
131
|
-
# parent = client.class.location_path project_id, location_id
|
|
48
|
+
# Create a new client object for TranslationService.
|
|
132
49
|
#
|
|
133
|
-
#
|
|
134
|
-
#
|
|
50
|
+
# By default, this returns an instance of
|
|
51
|
+
# [Google::Cloud::Translate::V3::TranslationService::Client](https://googleapis.dev/ruby/google-cloud-translate-v3/latest/Google/Cloud/Translate/V3/TranslationService/Client.html)
|
|
52
|
+
# for version V3 of the API.
|
|
53
|
+
# However, you can specify specify a different API version by passing it in the
|
|
54
|
+
# `version` parameter. If the TranslationService service is
|
|
55
|
+
# supported by that API version, and the corresponding gem is available, the
|
|
56
|
+
# appropriate versioned client will be returned.
|
|
135
57
|
#
|
|
136
|
-
#
|
|
137
|
-
# response.translations.each do |translation|
|
|
138
|
-
# puts "Translated text: #{translation.translated_text}"
|
|
139
|
-
# end
|
|
58
|
+
# ## About TranslationService
|
|
140
59
|
#
|
|
141
|
-
#
|
|
142
|
-
# require "google/cloud/translate"
|
|
143
|
-
#
|
|
144
|
-
# translate = Google::Cloud::Translate.new(
|
|
145
|
-
# version: :v2,
|
|
146
|
-
# project_id: "my-todo-project",
|
|
147
|
-
# credentials: "/path/to/keyfile.json"
|
|
148
|
-
# )
|
|
149
|
-
#
|
|
150
|
-
# translation = translate.translate "Hello world!", to: "la"
|
|
151
|
-
# translation.text #=> "Salve mundi!"
|
|
152
|
-
#
|
|
153
|
-
# @example Using the legacy v2 client with an API Key.
|
|
154
|
-
# require "google/cloud/translate"
|
|
155
|
-
#
|
|
156
|
-
# translate = Google::Cloud::Translate.new(
|
|
157
|
-
# version: :v2,
|
|
158
|
-
# key: "api-key-abc123XYZ789"
|
|
159
|
-
# )
|
|
160
|
-
#
|
|
161
|
-
# translation = translate.translate "Hello world!", to: "la"
|
|
162
|
-
# translation.text #=> "Salve mundi!"
|
|
163
|
-
#
|
|
164
|
-
# @example Using API Key from the environment variable.
|
|
165
|
-
# require "google/cloud/translate"
|
|
166
|
-
#
|
|
167
|
-
# ENV["TRANSLATE_KEY"] = "api-key-abc123XYZ789"
|
|
168
|
-
#
|
|
169
|
-
# translate = Google::Cloud::Translate.new version: :v2
|
|
60
|
+
# Provides natural language translation operations.
|
|
170
61
|
#
|
|
171
|
-
#
|
|
172
|
-
#
|
|
62
|
+
# @param version [::String, ::Symbol] The API version to connect to. Optional.
|
|
63
|
+
# Defaults to `:v3`.
|
|
64
|
+
# @return [TranslationService::Client] A client object for the specified version.
|
|
173
65
|
#
|
|
174
|
-
def self.
|
|
175
|
-
|
|
176
|
-
raise "The version: #{version} is not available. The available versions " \
|
|
177
|
-
"are: [#{AVAILABLE_VERSIONS.join ', '}]"
|
|
178
|
-
end
|
|
66
|
+
def self.translation_service version: :v3, &block
|
|
67
|
+
require "google/cloud/translate/#{version.to_s.downcase}"
|
|
179
68
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
69
|
+
package_name = Google::Cloud::Translate
|
|
70
|
+
.constants
|
|
71
|
+
.select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
|
|
72
|
+
.first
|
|
73
|
+
package_module = Google::Cloud::Translate.const_get package_name
|
|
74
|
+
package_module.const_get(:TranslationService).const_get(:Client).new(&block)
|
|
186
75
|
end
|
|
187
76
|
|
|
188
77
|
##
|
|
189
|
-
# Configure the
|
|
190
|
-
#
|
|
191
|
-
# The following
|
|
192
|
-
#
|
|
193
|
-
# * `
|
|
194
|
-
#
|
|
195
|
-
#
|
|
196
|
-
#
|
|
197
|
-
#
|
|
198
|
-
#
|
|
199
|
-
#
|
|
200
|
-
# * `
|
|
201
|
-
#
|
|
202
|
-
#
|
|
203
|
-
#
|
|
204
|
-
#
|
|
205
|
-
#
|
|
78
|
+
# Configure the google-cloud-translate library.
|
|
79
|
+
#
|
|
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:* `Integer`) -
|
|
92
|
+
# Default timeout in milliseconds.
|
|
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
|
|
206
104
|
#
|
|
207
105
|
def self.configure
|
|
208
|
-
yield Google::Cloud.configure.translate if block_given?
|
|
106
|
+
yield ::Google::Cloud.configure.translate if block_given?
|
|
209
107
|
|
|
210
|
-
Google::Cloud.configure.translate
|
|
108
|
+
::Google::Cloud.configure.translate
|
|
211
109
|
end
|
|
212
110
|
end
|
|
213
111
|
end
|
|
214
112
|
end
|
|
113
|
+
|
|
114
|
+
helper_path = ::File.join __dir__, "translate", "helpers.rb"
|
|
115
|
+
require "google/cloud/translate/helpers" if ::File.file? helper_path
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2020 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
module Google
|
|
19
|
+
module Cloud
|
|
20
|
+
module Translate
|
|
21
|
+
##
|
|
22
|
+
# Creates a new object for connecting to the legacy V2 version of the
|
|
23
|
+
# Cloud Translation API.
|
|
24
|
+
#
|
|
25
|
+
# Like other Cloud Platform services, Google Cloud Translation API supports authentication using a project ID
|
|
26
|
+
# and OAuth 2.0 credentials. In addition, it supports authentication using a public API access key. (If both the
|
|
27
|
+
# API key and the project and OAuth 2.0 credentials are provided, the API key will be used.) Instructions and
|
|
28
|
+
# configuration options are covered in the {file:AUTHENTICATION.md Authentication Guide}.
|
|
29
|
+
#
|
|
30
|
+
# @param [String] project_id Project identifier for the Cloud Translation service you are connecting to. If not
|
|
31
|
+
# present, the default project for the credentials is used.
|
|
32
|
+
# @param [String, Hash, Google::Auth::Credentials] credentials The path to the keyfile as a String, the contents
|
|
33
|
+
# of the keyfile as a Hash, or a Google::Auth::Credentials object.
|
|
34
|
+
# @param [String] key a public API access key (not an OAuth 2.0 token)
|
|
35
|
+
# @param [String, Array<String>] scope The OAuth 2.0 scopes controlling the set of resources and operations that
|
|
36
|
+
# the connection can access. See [Using OAuth 2.0 to Access Google
|
|
37
|
+
# APIs](https://developers.google.com/identity/protocols/OAuth2).
|
|
38
|
+
#
|
|
39
|
+
# The default scope is:
|
|
40
|
+
#
|
|
41
|
+
# * `https://www.googleapis.com/auth/cloud-platform`
|
|
42
|
+
# @param [Integer] retries Number of times to retry requests on server error. The default value is `3`.
|
|
43
|
+
# Optional.
|
|
44
|
+
# @param [Integer] timeout Default timeout to use in requests. Optional.
|
|
45
|
+
# @param [String] endpoint Override of the endpoint host name. Optional. If the param is nil, uses the default
|
|
46
|
+
# endpoint.
|
|
47
|
+
#
|
|
48
|
+
# @return [Google::Cloud::Translate::V2::Api]
|
|
49
|
+
#
|
|
50
|
+
# @example
|
|
51
|
+
# require "google/cloud/translate/v2"
|
|
52
|
+
#
|
|
53
|
+
# translate = Google::Cloud::Translate::V2.new(
|
|
54
|
+
# version: :v2,
|
|
55
|
+
# project_id: "my-todo-project",
|
|
56
|
+
# credentials: "/path/to/keyfile.json"
|
|
57
|
+
# )
|
|
58
|
+
#
|
|
59
|
+
# translation = translate.translate "Hello world!", to: "la"
|
|
60
|
+
# translation.text #=> "Salve mundi!"
|
|
61
|
+
#
|
|
62
|
+
# @example Using API Key.
|
|
63
|
+
# require "google/cloud/translate/v2"
|
|
64
|
+
#
|
|
65
|
+
# translate = Google::Cloud::Translate::V2.new(
|
|
66
|
+
# key: "api-key-abc123XYZ789"
|
|
67
|
+
# )
|
|
68
|
+
#
|
|
69
|
+
# translation = translate.translate "Hello world!", to: "la"
|
|
70
|
+
# translation.text #=> "Salve mundi!"
|
|
71
|
+
#
|
|
72
|
+
# @example Using API Key from the environment variable.
|
|
73
|
+
# require "google/cloud/translate/v2"
|
|
74
|
+
#
|
|
75
|
+
# ENV["TRANSLATE_KEY"] = "api-key-abc123XYZ789"
|
|
76
|
+
#
|
|
77
|
+
# translate = Google::Cloud::Translate::V2.new
|
|
78
|
+
#
|
|
79
|
+
# translation = translate.translate "Hello world!", to: "la"
|
|
80
|
+
# translation.text #=> "Salve mundi!"
|
|
81
|
+
#
|
|
82
|
+
def self.translation_v2_service project_id: nil,
|
|
83
|
+
credentials: nil,
|
|
84
|
+
key: nil,
|
|
85
|
+
scope: nil,
|
|
86
|
+
retries: nil,
|
|
87
|
+
timeout: nil,
|
|
88
|
+
endpoint: nil
|
|
89
|
+
require "google/cloud/translate/v2"
|
|
90
|
+
Google::Cloud::Translate::V2.new project_id: project_id,
|
|
91
|
+
credentials: credentials,
|
|
92
|
+
key: key,
|
|
93
|
+
scope: scope,
|
|
94
|
+
retries: retries,
|
|
95
|
+
timeout: timeout,
|
|
96
|
+
endpoint: endpoint
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Additional config keys used by V2
|
|
100
|
+
configure do |config|
|
|
101
|
+
config.add_field! :project_id, nil, match: ::String
|
|
102
|
+
config.add_field! :key, nil, match: ::String
|
|
103
|
+
config.add_field! :retries, nil, match: ::Integer
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -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 Translate
|
|
19
|
-
VERSION = "
|
|
23
|
+
VERSION = "3.0.1"
|
|
20
24
|
end
|
|
21
25
|
end
|
|
22
26
|
end
|
metadata
CHANGED
|
@@ -1,111 +1,57 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google-cloud-translate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Google LLC
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: faraday
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0.13'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0.13'
|
|
27
13
|
- !ruby/object:Gem::Dependency
|
|
28
14
|
name: google-cloud-core
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
|
30
16
|
requirements:
|
|
31
17
|
- - "~>"
|
|
32
18
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '1.
|
|
19
|
+
version: '1.5'
|
|
34
20
|
type: :runtime
|
|
35
21
|
prerelease: false
|
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
23
|
requirements:
|
|
38
24
|
- - "~>"
|
|
39
25
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1.
|
|
26
|
+
version: '1.5'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: google-
|
|
28
|
+
name: google-cloud-translate-v2
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
44
30
|
requirements:
|
|
45
31
|
- - "~>"
|
|
46
32
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
33
|
+
version: '0.0'
|
|
48
34
|
type: :runtime
|
|
49
35
|
prerelease: false
|
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
37
|
requirements:
|
|
52
38
|
- - "~>"
|
|
53
39
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: googleapis-common-protos
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: 1.3.9
|
|
62
|
-
- - "<"
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: '2.0'
|
|
65
|
-
type: :runtime
|
|
66
|
-
prerelease: false
|
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
-
requirements:
|
|
69
|
-
- - ">="
|
|
70
|
-
- !ruby/object:Gem::Version
|
|
71
|
-
version: 1.3.9
|
|
72
|
-
- - "<"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '2.0'
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: googleapis-common-protos-types
|
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - ">="
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: 1.0.4
|
|
82
|
-
- - "<"
|
|
83
|
-
- !ruby/object:Gem::Version
|
|
84
|
-
version: '2.0'
|
|
85
|
-
type: :runtime
|
|
86
|
-
prerelease: false
|
|
87
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
88
|
-
requirements:
|
|
89
|
-
- - ">="
|
|
90
|
-
- !ruby/object:Gem::Version
|
|
91
|
-
version: 1.0.4
|
|
92
|
-
- - "<"
|
|
93
|
-
- !ruby/object:Gem::Version
|
|
94
|
-
version: '2.0'
|
|
40
|
+
version: '0.0'
|
|
95
41
|
- !ruby/object:Gem::Dependency
|
|
96
|
-
name:
|
|
42
|
+
name: google-cloud-translate-v3
|
|
97
43
|
requirement: !ruby/object:Gem::Requirement
|
|
98
44
|
requirements:
|
|
99
45
|
- - "~>"
|
|
100
46
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '
|
|
102
|
-
type: :
|
|
47
|
+
version: '0.0'
|
|
48
|
+
type: :runtime
|
|
103
49
|
prerelease: false
|
|
104
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
51
|
requirements:
|
|
106
52
|
- - "~>"
|
|
107
53
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '
|
|
54
|
+
version: '0.0'
|
|
109
55
|
- !ruby/object:Gem::Dependency
|
|
110
56
|
name: google-style
|
|
111
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -126,56 +72,56 @@ dependencies:
|
|
|
126
72
|
requirements:
|
|
127
73
|
- - "~>"
|
|
128
74
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '5.
|
|
75
|
+
version: '5.14'
|
|
130
76
|
type: :development
|
|
131
77
|
prerelease: false
|
|
132
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
133
79
|
requirements:
|
|
134
80
|
- - "~>"
|
|
135
81
|
- !ruby/object:Gem::Version
|
|
136
|
-
version: '5.
|
|
82
|
+
version: '5.14'
|
|
137
83
|
- !ruby/object:Gem::Dependency
|
|
138
|
-
name: minitest-
|
|
84
|
+
name: minitest-focus
|
|
139
85
|
requirement: !ruby/object:Gem::Requirement
|
|
140
86
|
requirements:
|
|
141
87
|
- - "~>"
|
|
142
88
|
- !ruby/object:Gem::Version
|
|
143
|
-
version: '1.
|
|
89
|
+
version: '1.1'
|
|
144
90
|
type: :development
|
|
145
91
|
prerelease: false
|
|
146
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
147
93
|
requirements:
|
|
148
94
|
- - "~>"
|
|
149
95
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '1.
|
|
96
|
+
version: '1.1'
|
|
151
97
|
- !ruby/object:Gem::Dependency
|
|
152
|
-
name: minitest-
|
|
98
|
+
name: minitest-rg
|
|
153
99
|
requirement: !ruby/object:Gem::Requirement
|
|
154
100
|
requirements:
|
|
155
101
|
- - "~>"
|
|
156
102
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: '
|
|
103
|
+
version: '5.2'
|
|
158
104
|
type: :development
|
|
159
105
|
prerelease: false
|
|
160
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
161
107
|
requirements:
|
|
162
108
|
- - "~>"
|
|
163
109
|
- !ruby/object:Gem::Version
|
|
164
|
-
version: '
|
|
110
|
+
version: '5.2'
|
|
165
111
|
- !ruby/object:Gem::Dependency
|
|
166
|
-
name:
|
|
112
|
+
name: rake
|
|
167
113
|
requirement: !ruby/object:Gem::Requirement
|
|
168
114
|
requirements:
|
|
169
|
-
- - "
|
|
115
|
+
- - ">="
|
|
170
116
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: '
|
|
117
|
+
version: '12.0'
|
|
172
118
|
type: :development
|
|
173
119
|
prerelease: false
|
|
174
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
175
121
|
requirements:
|
|
176
|
-
- - "
|
|
122
|
+
- - ">="
|
|
177
123
|
- !ruby/object:Gem::Version
|
|
178
|
-
version: '
|
|
124
|
+
version: '12.0'
|
|
179
125
|
- !ruby/object:Gem::Dependency
|
|
180
126
|
name: redcarpet
|
|
181
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -218,22 +164,9 @@ dependencies:
|
|
|
218
164
|
- - "~>"
|
|
219
165
|
- !ruby/object:Gem::Version
|
|
220
166
|
version: '0.9'
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
requirements:
|
|
225
|
-
- - "~>"
|
|
226
|
-
- !ruby/object:Gem::Version
|
|
227
|
-
version: 0.1.13
|
|
228
|
-
type: :development
|
|
229
|
-
prerelease: false
|
|
230
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
231
|
-
requirements:
|
|
232
|
-
- - "~>"
|
|
233
|
-
- !ruby/object:Gem::Version
|
|
234
|
-
version: 0.1.13
|
|
235
|
-
description: google-cloud-translate is the official library for Cloud Translation
|
|
236
|
-
API.
|
|
167
|
+
description: Cloud Translation can dynamically translate text between thousands of
|
|
168
|
+
language pairs. Translation lets websites and programs programmatically integrate
|
|
169
|
+
with the translation service.
|
|
237
170
|
email: googleapis-packages@google.com
|
|
238
171
|
executables: []
|
|
239
172
|
extensions: []
|
|
@@ -241,45 +174,18 @@ extra_rdoc_files: []
|
|
|
241
174
|
files:
|
|
242
175
|
- ".yardopts"
|
|
243
176
|
- AUTHENTICATION.md
|
|
244
|
-
-
|
|
245
|
-
-
|
|
246
|
-
-
|
|
247
|
-
- LICENSE
|
|
248
|
-
- OVERVIEW.md
|
|
249
|
-
- TROUBLESHOOTING.md
|
|
177
|
+
- LICENSE.md
|
|
178
|
+
- MIGRATING.md
|
|
179
|
+
- README.md
|
|
250
180
|
- lib/google-cloud-translate.rb
|
|
251
181
|
- lib/google/cloud/translate.rb
|
|
252
|
-
- lib/google/cloud/translate/
|
|
253
|
-
- lib/google/cloud/translate/v2/api.rb
|
|
254
|
-
- lib/google/cloud/translate/v2/credentials.rb
|
|
255
|
-
- lib/google/cloud/translate/v2/detection.rb
|
|
256
|
-
- lib/google/cloud/translate/v2/language.rb
|
|
257
|
-
- lib/google/cloud/translate/v2/service.rb
|
|
258
|
-
- lib/google/cloud/translate/v2/translation.rb
|
|
259
|
-
- lib/google/cloud/translate/v3.rb
|
|
260
|
-
- lib/google/cloud/translate/v3/credentials.rb
|
|
261
|
-
- lib/google/cloud/translate/v3/doc/google/cloud/translate/v3/translation_service.rb
|
|
262
|
-
- lib/google/cloud/translate/v3/doc/google/longrunning/operations.rb
|
|
263
|
-
- lib/google/cloud/translate/v3/doc/google/protobuf/any.rb
|
|
264
|
-
- lib/google/cloud/translate/v3/doc/google/protobuf/timestamp.rb
|
|
265
|
-
- lib/google/cloud/translate/v3/doc/google/rpc/status.rb
|
|
266
|
-
- lib/google/cloud/translate/v3/translation_service_client.rb
|
|
267
|
-
- lib/google/cloud/translate/v3/translation_service_client_config.json
|
|
268
|
-
- lib/google/cloud/translate/v3/translation_service_pb.rb
|
|
269
|
-
- lib/google/cloud/translate/v3/translation_service_services_pb.rb
|
|
182
|
+
- lib/google/cloud/translate/helpers.rb
|
|
270
183
|
- lib/google/cloud/translate/version.rb
|
|
271
|
-
homepage: https://github.com/googleapis/google-cloud-ruby
|
|
184
|
+
homepage: https://github.com/googleapis/google-cloud-ruby
|
|
272
185
|
licenses:
|
|
273
186
|
- Apache-2.0
|
|
274
187
|
metadata: {}
|
|
275
|
-
post_install_message:
|
|
276
|
-
The 2.0 release introduces breaking changes by defaulting to a
|
|
277
|
-
new generated v3 API client. This gem continues to contain the
|
|
278
|
-
legacy hand-written v2 client for backward compatibility aside
|
|
279
|
-
from the default client constructor.
|
|
280
|
-
|
|
281
|
-
For more details please visit the 2.0.0 CHANGELOG:
|
|
282
|
-
https://googleapis.dev/ruby/google-cloud-translate/v2.0.0/file.CHANGELOG.html#2_0_0___2019-10-28
|
|
188
|
+
post_install_message:
|
|
283
189
|
rdoc_options: []
|
|
284
190
|
require_paths:
|
|
285
191
|
- lib
|
|
@@ -294,8 +200,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
294
200
|
- !ruby/object:Gem::Version
|
|
295
201
|
version: '0'
|
|
296
202
|
requirements: []
|
|
297
|
-
rubygems_version: 3.
|
|
203
|
+
rubygems_version: 3.1.3
|
|
298
204
|
signing_key:
|
|
299
205
|
specification_version: 4
|
|
300
|
-
summary: API Client library for Cloud Translation API
|
|
206
|
+
summary: API Client library for the Cloud Translation API
|
|
301
207
|
test_files: []
|