google-cloud-translate-v2 0.3.1 → 0.4.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/AUTHENTICATION.md +8 -26
- data/CHANGELOG.md +12 -0
- data/README.md +6 -6
- data/lib/google/cloud/translate/v2/service.rb +8 -8
- data/lib/google/cloud/translate/v2/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfa162454371617ef8b8581f85cfa718a1faaedf7977490d08bceb202fcce065
|
4
|
+
data.tar.gz: 6529c870d999fea3ee06b01c392fe87cf5e5b903eaf36b0c4f45f27708ce2172
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d6c851b4c919a06ae5bdd28112cfec17ea848caf07837571c5c90caba1ae91710d0dad8a5414fa98e9f201e4eb0919d47d9c5da91f59ea1c2f886868b9696e3
|
7
|
+
data.tar.gz: db8b5d2a8c25ebc19c564a5d5bd42a9089e14b5cc61deab58a02244b0b4bc6596d0e237d63abab77b562c4f3f4296357fc8b75cdd399a91f0316526942da0197
|
data/AUTHENTICATION.md
CHANGED
@@ -113,15 +113,6 @@ To configure your system for this, simply:
|
|
113
113
|
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
114
114
|
*should* only be used during development.
|
115
115
|
|
116
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
117
|
-
[dev-console]: https://console.cloud.google.com/project
|
118
|
-
|
119
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
120
|
-
|
121
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
122
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
123
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
124
|
-
|
125
116
|
## Creating a Service Account
|
126
117
|
|
127
118
|
Google Cloud requires a **Project ID** and **Service Account Credentials** to
|
@@ -131,31 +122,22 @@ connect to most services with google-cloud-translate.
|
|
131
122
|
If you are not running this client on Google Compute Engine, you need a Google
|
132
123
|
Developers service account.
|
133
124
|
|
134
|
-
1. Visit the [Google
|
125
|
+
1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
|
135
126
|
1. Create a new project or click on an existing project.
|
136
|
-
1. Activate the
|
127
|
+
1. Activate the menu in the upper left and select **APIs & Services**. From
|
137
128
|
here, you will enable the APIs that your application requires.
|
138
129
|
|
139
|
-
![Enable the APIs that your application requires][enable-apis]
|
140
|
-
|
141
130
|
*Note: You may need to enable billing in order to use these services.*
|
142
131
|
|
143
132
|
1. Select **Credentials** from the side navigation.
|
144
133
|
|
145
|
-
|
146
|
-
|
147
|
-
![Create a new service account][create-new-service-account]
|
148
|
-
|
149
|
-
![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
|
150
|
-
|
151
|
-
Find the "Add credentials" drop down and select "Service account" to be
|
152
|
-
guided through downloading a new JSON key file.
|
153
|
-
|
154
|
-
If you want to re-use an existing service account, you can easily generate a
|
155
|
-
new key file. Just select the account you wish to re-use, and click "Generate
|
156
|
-
new JSON key":
|
134
|
+
Find the "Create credentials" drop down near the top of the page, and select
|
135
|
+
"Service account" to be guided through downloading a new JSON key file.
|
157
136
|
|
158
|
-
|
137
|
+
If you want to re-use an existing service account, you can easily generate
|
138
|
+
a new key file. Just select the account you wish to re-use click the pencil
|
139
|
+
tool on the right side to edit the service account, select the **Keys** tab,
|
140
|
+
and then select **Add Key**.
|
159
141
|
|
160
142
|
The key file you download will be used by this library to authenticate API
|
161
143
|
requests and should be stored in a secure location.
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.4.1 (2023-05-19)
|
4
|
+
|
5
|
+
#### Documentation
|
6
|
+
|
7
|
+
* Fixed broken links in authentication documentation ([#21619](https://github.com/googleapis/google-cloud-ruby/issues/21619))
|
8
|
+
|
9
|
+
### 0.4.0 (2022-07-28)
|
10
|
+
|
11
|
+
#### Features
|
12
|
+
|
13
|
+
* Update minimum Ruby version to 2.6 ([#18868](https://github.com/googleapis/google-cloud-ruby/issues/18868))
|
14
|
+
|
3
15
|
### 0.3.1 / 2021-06-17
|
4
16
|
|
5
17
|
#### Bug Fixes
|
data/README.md
CHANGED
@@ -42,11 +42,11 @@ for class and method documentation.
|
|
42
42
|
|
43
43
|
## Supported Ruby Versions
|
44
44
|
|
45
|
-
This library is supported on Ruby 2.
|
45
|
+
This library is supported on Ruby 2.6+.
|
46
46
|
|
47
47
|
Google provides official support for Ruby versions that are actively supported
|
48
|
-
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
49
|
-
security maintenance, and not end of life.
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
49
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
50
|
+
still work, but are unsupported and not recommended. See
|
51
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
52
|
+
support schedule.
|
@@ -26,7 +26,7 @@ module Google
|
|
26
26
|
##
|
27
27
|
# @private
|
28
28
|
# Represents the Translation API REST service, exposing the API calls.
|
29
|
-
class Service
|
29
|
+
class Service # :nodoc:
|
30
30
|
API_VERSION = "v2".freeze
|
31
31
|
API_HOST = "translate.googleapis.com".freeze
|
32
32
|
|
@@ -50,7 +50,7 @@ module Google
|
|
50
50
|
body = {
|
51
51
|
q: Array(text), target: to, source: from, format: format,
|
52
52
|
model: model, cid: cid
|
53
|
-
}.
|
53
|
+
}.compact.to_json
|
54
54
|
|
55
55
|
post "/language/translate/v2", body
|
56
56
|
end
|
@@ -104,7 +104,7 @@ module Google
|
|
104
104
|
def http
|
105
105
|
@http ||= Faraday.new url: @url, request: {
|
106
106
|
open_timeout: @timeout, timeout: @timeout
|
107
|
-
}.
|
107
|
+
}.compact
|
108
108
|
end
|
109
109
|
|
110
110
|
##
|
@@ -161,14 +161,14 @@ module Google
|
|
161
161
|
self.reasons = ["rateLimitExceeded", "userRateLimitExceeded"]
|
162
162
|
self.backoff = ->(retries) { sleep retries.to_i }
|
163
163
|
|
164
|
-
def initialize options = {}
|
164
|
+
def initialize options = {} # :nodoc:
|
165
165
|
@max_retries = (options[:retries] || Backoff.retries).to_i
|
166
166
|
@http_codes = (options[:http_codes] || Backoff.http_codes).to_a
|
167
167
|
@reasons = (options[:reasons] || Backoff.reasons).to_a
|
168
168
|
@backoff = options[:backoff] || Backoff.backoff
|
169
169
|
end
|
170
170
|
|
171
|
-
def execute
|
171
|
+
def execute # :nodoc:
|
172
172
|
current_retries = 0
|
173
173
|
loop do
|
174
174
|
response = yield # Expecting Faraday::Response
|
@@ -181,7 +181,7 @@ module Google
|
|
181
181
|
|
182
182
|
protected
|
183
183
|
|
184
|
-
def retry? result, current_retries
|
184
|
+
def retry? result, current_retries # :nodoc:
|
185
185
|
if current_retries < @max_retries
|
186
186
|
return true if retry_http_code? result
|
187
187
|
return true if retry_error_reason? result
|
@@ -189,11 +189,11 @@ module Google
|
|
189
189
|
false
|
190
190
|
end
|
191
191
|
|
192
|
-
def retry_http_code? response
|
192
|
+
def retry_http_code? response # :nodoc:
|
193
193
|
@http_codes.include? response.status
|
194
194
|
end
|
195
195
|
|
196
|
-
def retry_error_reason? response
|
196
|
+
def retry_error_reason? response # :nodoc:
|
197
197
|
result = JSON.parse response.body
|
198
198
|
if result && result["error"] && result["error"]["errors"]
|
199
199
|
Array(result["error"]["errors"]).each do |error|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-translate-v2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.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:
|
11
|
+
date: 2023-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -110,28 +110,28 @@ dependencies:
|
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: 1.
|
113
|
+
version: 1.26.1
|
114
114
|
type: :development
|
115
115
|
prerelease: false
|
116
116
|
version_requirements: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - "~>"
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 1.
|
120
|
+
version: 1.26.1
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
122
|
name: minitest
|
123
123
|
requirement: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
125
|
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: '5.
|
127
|
+
version: '5.16'
|
128
128
|
type: :development
|
129
129
|
prerelease: false
|
130
130
|
version_requirements: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
132
|
- - "~>"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '5.
|
134
|
+
version: '5.16'
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: minitest-focus
|
137
137
|
requirement: !ruby/object:Gem::Requirement
|
@@ -264,14 +264,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
264
264
|
requirements:
|
265
265
|
- - ">="
|
266
266
|
- !ruby/object:Gem::Version
|
267
|
-
version: '2.
|
267
|
+
version: '2.6'
|
268
268
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
269
|
requirements:
|
270
270
|
- - ">="
|
271
271
|
- !ruby/object:Gem::Version
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
|
-
rubygems_version: 3.2
|
274
|
+
rubygems_version: 3.4.2
|
275
275
|
signing_key:
|
276
276
|
specification_version: 4
|
277
277
|
summary: API Client library for Cloud Translation V2 API
|