google-cloud-translate 1.3.0 → 1.3.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/CHANGELOG.md +7 -1
- data/lib/google-cloud-translate.rb +1 -1
- data/lib/google/cloud/translate.rb +1 -7
- data/lib/google/cloud/translate/api.rb +1 -1
- data/lib/google/cloud/translate/credentials.rb +10 -10
- data/lib/google/cloud/translate/service.rb +7 -11
- data/lib/google/cloud/translate/version.rb +1 -1
- metadata +22 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fce4c949921261a8c75ba0850348861e4868d1f8a3a78f3b314f7743342e6939
|
4
|
+
data.tar.gz: 171c017925040b13631358a5e1c347f6188ccad4bb4656300efd8c8c2d58eaec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc1b16bdaca4f0aacb52fd897efb6da493828bb9ee3c46e5ec7fcafc643c1a47be7503edd5da6734d45840fdaf00da52dbb5937f0e6bae03985fb33c041834e
|
7
|
+
data.tar.gz: 21c94ae85e2a7dc332e641bc3245046a90707c2e2a8f85da51f34b96fa0baa64d74aed2150e2f5404425b64ccb25d39673666abc4586e255ee7ccb58a9de3bc4
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.3.1 / 2019-08-23
|
4
|
+
|
5
|
+
#### Documentation
|
6
|
+
|
7
|
+
* Update documentation
|
8
|
+
|
3
9
|
### 1.3.0 / 2019-02-01
|
4
10
|
|
5
11
|
* Make use of Credentials#project_id
|
@@ -8,7 +14,7 @@
|
|
8
14
|
This value was added in googleauth 0.7.0.
|
9
15
|
* Loosen googleauth dependency
|
10
16
|
Allow for new releases up to 0.10.
|
11
|
-
The googleauth devs have committed to
|
17
|
+
The googleauth devs have committed to maintaining the current API
|
12
18
|
and will not make backwards compatible changes before 0.10.
|
13
19
|
|
14
20
|
### 1.2.4 / 2018-09-20
|
@@ -161,7 +161,7 @@ Google::Cloud.configure.add_config! :translate do |config|
|
|
161
161
|
config.add_field! :project_id, default_project, match: String, allow_nil: true
|
162
162
|
config.add_alias! :project, :project_id
|
163
163
|
config.add_field! :credentials, default_creds,
|
164
|
-
match:
|
164
|
+
match: [String, Hash, Google::Auth::Credentials],
|
165
165
|
allow_nil: true
|
166
166
|
config.add_alias! :keyfile, :credentials
|
167
167
|
config.add_field! :key, default_key, match: String, allow_nil: true
|
@@ -39,8 +39,6 @@ module Google
|
|
39
39
|
# See {file:OVERVIEW.md Translation Overview}.
|
40
40
|
#
|
41
41
|
module Translate
|
42
|
-
# rubocop:disable Metrics/AbcSize
|
43
|
-
|
44
42
|
##
|
45
43
|
# Creates a new object for connecting to Cloud Translation API. Each call
|
46
44
|
# creates a new connection.
|
@@ -129,9 +127,7 @@ module Google
|
|
129
127
|
credentials = Translate::Credentials.new credentials, scope: scope
|
130
128
|
end
|
131
129
|
|
132
|
-
if credentials.respond_to? :project_id
|
133
|
-
project_id ||= credentials.project_id
|
134
|
-
end
|
130
|
+
project_id ||= credentials.project_id if credentials.respond_to? :project_id
|
135
131
|
project_id = project_id.to_s # Always cast to a string
|
136
132
|
raise ArgumentError, "project_id is missing" if project_id.empty?
|
137
133
|
|
@@ -142,8 +138,6 @@ module Google
|
|
142
138
|
)
|
143
139
|
end
|
144
140
|
|
145
|
-
# rubocop:enable Metrics/AbcSize
|
146
|
-
|
147
141
|
##
|
148
142
|
# Configure the Google Cloud Translate library.
|
149
143
|
#
|
@@ -39,16 +39,16 @@ module Google
|
|
39
39
|
#
|
40
40
|
class Credentials < Google::Auth::Credentials
|
41
41
|
SCOPE = ["https://www.googleapis.com/auth/cloud-platform"].freeze
|
42
|
-
PATH_ENV_VARS =
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
JSON_ENV_VARS =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
42
|
+
PATH_ENV_VARS = ["TRANSLATE_CREDENTIALS",
|
43
|
+
"TRANSLATE_KEYFILE",
|
44
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
45
|
+
"GOOGLE_CLOUD_KEYFILE",
|
46
|
+
"GCLOUD_KEYFILE"].freeze
|
47
|
+
JSON_ENV_VARS = ["TRANSLATE_CREDENTIALS_JSON",
|
48
|
+
"TRANSLATE_KEYFILE_JSON",
|
49
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
50
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
51
|
+
"GCLOUD_KEYFILE_JSON"].freeze
|
52
52
|
DEFAULT_PATHS = \
|
53
53
|
["~/.config/gcloud/application_default_credentials.json"].freeze
|
54
54
|
end
|
@@ -110,10 +110,10 @@ module Google
|
|
110
110
|
# The default HTTP headers to be sent on all API calls.
|
111
111
|
def default_http_headers
|
112
112
|
@default_http_headers ||= {
|
113
|
-
"User-Agent"
|
113
|
+
"User-Agent" => "gcloud-ruby/#{Google::Cloud::Translate::VERSION}",
|
114
114
|
"google-cloud-resource-prefix" => "projects/#{@project}",
|
115
|
-
"Content-Type"
|
116
|
-
"x-goog-api-client"
|
115
|
+
"Content-Type" => "application/json",
|
116
|
+
"x-goog-api-client" => "gl-ruby/#{RUBY_VERSION} " \
|
117
117
|
"gccl/#{Google::Cloud::Translate::VERSION}"
|
118
118
|
}
|
119
119
|
end
|
@@ -153,7 +153,7 @@ module Google
|
|
153
153
|
# Set the default values
|
154
154
|
self.retries = 3
|
155
155
|
self.http_codes = [500, 503]
|
156
|
-
self.reasons =
|
156
|
+
self.reasons = ["rateLimitExceeded", "userRateLimitExceeded"]
|
157
157
|
self.backoff = ->(retries) { sleep retries.to_i }
|
158
158
|
|
159
159
|
def initialize options = {} #:nodoc:
|
@@ -189,14 +189,10 @@ module Google
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def retry_error_reason? response #:nodoc:
|
192
|
-
result = JSON.parse
|
193
|
-
if result &&
|
194
|
-
result["error"] &&
|
195
|
-
result["error"]["errors"]
|
192
|
+
result = JSON.parse response.body
|
193
|
+
if result && result["error"] && result["error"]["errors"]
|
196
194
|
Array(result["error"]["errors"]).each do |error|
|
197
|
-
if error["reason"] && @reasons.include?(error["reason"])
|
198
|
-
return true
|
199
|
-
end
|
195
|
+
return true if error["reason"] && @reasons.include?(error["reason"])
|
200
196
|
end
|
201
197
|
end
|
202
198
|
false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-translate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -60,63 +60,63 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.10.0
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: autotest-suffix
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.1'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.1'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: google-style
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0.3'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0.3'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name: minitest
|
91
|
+
name: minitest
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '5.10'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '5.10'
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name: minitest-
|
105
|
+
name: minitest-autotest
|
106
106
|
requirement: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '1.0'
|
111
111
|
type: :development
|
112
112
|
prerelease: false
|
113
113
|
version_requirements: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '1.0'
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
119
|
+
name: minitest-focus
|
120
120
|
requirement: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
@@ -130,33 +130,33 @@ dependencies:
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '1.1'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
|
-
name:
|
133
|
+
name: minitest-rg
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '5.2'
|
139
139
|
type: :development
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '5.2'
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
|
-
name:
|
147
|
+
name: redcarpet
|
148
148
|
requirement: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '3.0'
|
153
153
|
type: :development
|
154
154
|
prerelease: false
|
155
155
|
version_requirements: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: '3.0'
|
160
160
|
- !ruby/object:Gem::Dependency
|
161
161
|
name: simplecov
|
162
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,8 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
244
|
- !ruby/object:Gem::Version
|
245
245
|
version: '0'
|
246
246
|
requirements: []
|
247
|
-
|
248
|
-
rubygems_version: 2.7.6
|
247
|
+
rubygems_version: 3.0.4
|
249
248
|
signing_key:
|
250
249
|
specification_version: 4
|
251
250
|
summary: API Client library for Google Cloud Translation API
|