google-cloud-language 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIGRATING.md +54 -0
- data/lib/google/cloud/language/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc1193cbacb5d36f6b34cfab3d90e39e68c1ebe00014fc830589f697b1c2b102
|
4
|
+
data.tar.gz: e7646dcbb3930c4b2eb8cd9c675394431b7ef381ee91ee6e6948364ddd71e3c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e75189339140c7dfd71b1b71dc6b67f73beec0a6fc05529b027b29515ff2bf3ec7bbcbc6de6890f5eb0a079c3b14d4c66328702f2c17ab58deb0ac7041b4c41
|
7
|
+
data.tar.gz: 768af4b94d592bf21d0199c10dcc1b3ee19c81380cad10fd245e4e915236aa2eb3bb2a91fd63d280b9edcdb8efb12f924263c8496974a8369f86bdf887669c66
|
data/MIGRATING.md
CHANGED
@@ -26,6 +26,10 @@ To summarize:
|
|
26
26
|
specifies whether they are required or optional. Additionally, you can pass
|
27
27
|
a proto request object instead of separate arguments. See
|
28
28
|
[Passing Arguments](#passing-arguments) for more info.
|
29
|
+
* Previously, clients reported RPC errors by raising instances of
|
30
|
+
`Google::Gax::GaxError` and its subclasses. Now, RPC exceptions are of type
|
31
|
+
`Google::Cloud::Error` and its subclasses. See
|
32
|
+
[Handling Errors](#handling-errors) for more info.
|
29
33
|
* Some classes have moved into different namespaces. See
|
30
34
|
[Class Namespaces](#class-namespaces) for more info.
|
31
35
|
|
@@ -216,6 +220,56 @@ response = client.analyze_sentiment(
|
|
216
220
|
)
|
217
221
|
```
|
218
222
|
|
223
|
+
### Handling Errors
|
224
|
+
|
225
|
+
The client reports standard
|
226
|
+
[gRPC error codes](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)
|
227
|
+
by raising exceptions. In older releases, these exceptions were located in the
|
228
|
+
`Google::Gax` namespace and were subclasses of the `Google::Gax::GaxError` base
|
229
|
+
exception class, defined in the `google-gax` gem. However, these classes were
|
230
|
+
different from the standard exceptions (subclasses of `Google::Cloud::Error`)
|
231
|
+
thrown by other client libraries such as `google-cloud-storage`.
|
232
|
+
|
233
|
+
The 1.0 client library now uses the `Google::Cloud::Error` exception hierarchy,
|
234
|
+
for consistency across all the Google Cloud client libraries. In general, these
|
235
|
+
exceptions have the same name as their counterparts from older releases, but
|
236
|
+
are located in the `Google::Cloud` namespace rather than the `Google::Gax`
|
237
|
+
namespace.
|
238
|
+
|
239
|
+
Old:
|
240
|
+
```
|
241
|
+
client = Google::Cloud::Language.new
|
242
|
+
|
243
|
+
document = {
|
244
|
+
content: "I love API calls!",
|
245
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
246
|
+
}
|
247
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
248
|
+
|
249
|
+
begin
|
250
|
+
response = client.analyze_sentiment document, encoding_type: encoding
|
251
|
+
rescue Google::Gax::Error => e
|
252
|
+
# Handle exceptions that subclass Google::Gax::Error
|
253
|
+
end
|
254
|
+
```
|
255
|
+
|
256
|
+
New:
|
257
|
+
```
|
258
|
+
client = Google::Cloud::Language.language_service
|
259
|
+
|
260
|
+
document = {
|
261
|
+
content: "I love API calls!",
|
262
|
+
type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
|
263
|
+
}
|
264
|
+
encoding = Google:Cloud::Language::V1::EncodingType::UTF8
|
265
|
+
|
266
|
+
begin
|
267
|
+
response = client.analyze_sentiment document: document, encoding_type: encoding
|
268
|
+
rescue Google::Cloud::Error => e
|
269
|
+
# Handle exceptions that subclass Google::Cloud::Error
|
270
|
+
end
|
271
|
+
```
|
272
|
+
|
219
273
|
### Class Namespaces
|
220
274
|
|
221
275
|
In older releases, the client object was of class
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-language
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.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-05-
|
11
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-cloud-core
|