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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4d0b506a28c32a88d04a43a7123d5b808e0a202efb45e8cade5f93547496d62
4
- data.tar.gz: 13554671d3c8ac13c2b9d9b65119a402aa4fc5a67135113a99cf222afbebdbd3
3
+ metadata.gz: fce4c949921261a8c75ba0850348861e4868d1f8a3a78f3b314f7743342e6939
4
+ data.tar.gz: 171c017925040b13631358a5e1c347f6188ccad4bb4656300efd8c8c2d58eaec
5
5
  SHA512:
6
- metadata.gz: 198e95d6ffd565ef4d908bc6e34619698c9442e4d50e0321bf54a3fabb87eb5f5858331daa3bbd1a97b6638aaa83d8061c7f1803ebc4015cf4bda6fff7d1fad7
7
- data.tar.gz: 2fffd675cdf8335edfe9fd069f8fa29e25c04000652c6fd471bc3f1f6a2b3d2c75fba469be89bb59b03ac3651582d5e814822ab5860c15dba01cd7e8cc090c5e
6
+ metadata.gz: 5cc1b16bdaca4f0aacb52fd897efb6da493828bb9ee3c46e5ec7fcafc643c1a47be7503edd5da6734d45840fdaf00da52dbb5937f0e6bae03985fb33c041834e
7
+ data.tar.gz: 21c94ae85e2a7dc332e641bc3245046a90707c2e2a8f85da51f34b96fa0baa64d74aed2150e2f5404425b64ccb25d39673666abc4586e255ee7ccb58a9de3bc4
@@ -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 maintanining the current API
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: [String, Hash, Google::Auth::Credentials],
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
  #
@@ -223,7 +223,7 @@ module Google
223
223
  def detect *text
224
224
  return nil if text.empty?
225
225
  text = Array(text).flatten
226
- gapi = service.detect(text)
226
+ gapi = service.detect text
227
227
  Detection.from_gapi gapi, text
228
228
  end
229
229
 
@@ -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 = %w[TRANSLATE_CREDENTIALS
43
- TRANSLATE_KEYFILE
44
- GOOGLE_CLOUD_CREDENTIALS
45
- GOOGLE_CLOUD_KEYFILE
46
- GCLOUD_KEYFILE].freeze
47
- JSON_ENV_VARS = %w[TRANSLATE_CREDENTIALS_JSON
48
- TRANSLATE_KEYFILE_JSON
49
- GOOGLE_CLOUD_CREDENTIALS_JSON
50
- GOOGLE_CLOUD_KEYFILE_JSON
51
- GCLOUD_KEYFILE_JSON].freeze
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" => "gcloud-ruby/#{Google::Cloud::Translate::VERSION}",
113
+ "User-Agent" => "gcloud-ruby/#{Google::Cloud::Translate::VERSION}",
114
114
  "google-cloud-resource-prefix" => "projects/#{@project}",
115
- "Content-Type" => "application/json",
116
- "x-goog-api-client" => "gl-ruby/#{RUBY_VERSION} " \
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 = %w[rateLimitExceeded userRateLimitExceeded]
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(response.body)
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
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Translate
19
- VERSION = "1.3.0".freeze
19
+ VERSION = "1.3.1".freeze
20
20
  end
21
21
  end
22
22
  end
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.0
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-02-04 00:00:00.000000000 Z
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: minitest
63
+ name: autotest-suffix
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.10'
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: '5.10'
75
+ version: '1.1'
76
76
  - !ruby/object:Gem::Dependency
77
- name: minitest-autotest
77
+ name: google-style
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.0'
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: '1.0'
89
+ version: '0.3'
90
90
  - !ruby/object:Gem::Dependency
91
- name: minitest-focus
91
+ name: minitest
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.1'
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: '1.1'
103
+ version: '5.10'
104
104
  - !ruby/object:Gem::Dependency
105
- name: minitest-rg
105
+ name: minitest-autotest
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '5.2'
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: '5.2'
117
+ version: '1.0'
118
118
  - !ruby/object:Gem::Dependency
119
- name: autotest-suffix
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: redcarpet
133
+ name: minitest-rg
134
134
  requirement: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '3.0'
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: '3.0'
145
+ version: '5.2'
146
146
  - !ruby/object:Gem::Dependency
147
- name: rubocop
147
+ name: redcarpet
148
148
  requirement: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.61.0
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: 0.61.0
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
- rubyforge_project:
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