google-cloud-language 1.8.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3af09f2a6f18c5cade2c3e26485b1daf2a75f6b266a67c0ae153708811c4ed2c
4
- data.tar.gz: 1282138fc154557ec9fb0f34517321785f0fffdd4768932482df74c0f1077b84
3
+ metadata.gz: afd01b20520f6ea0847ca0c80687b0208d25f064e8b763d33e07b5efd7522e8e
4
+ data.tar.gz: 5b681bf595cef39a768e9305b12fc43803b796876a04aa5ffadd9df97d7cdf91
5
5
  SHA512:
6
- metadata.gz: 669af530f4096ba38249681a3f38e9f731578b3573fb095f6a474d2ac35b479a2f9b31dd6261fc3d7f69b9a853435efd575007545a2821fdb143f09301629e8f
7
- data.tar.gz: ff8486c1fcc9bda8e80daad17d61112f481e34f7300eaea582567bcca3f5950e1737f8f28fff5805fc839e60870d41aab853c8fcee643146b03591c96a30d990
6
+ metadata.gz: 43c944b074a266f94cdca7eb7e7da8adc246395089176f5a1578340762826f8070b0ea02eede025765e523a32f6c9c83d892b3edaca6e928dd1b70c7dd8bb0b6
7
+ data.tar.gz: 68814a66a9ad00b74fd1ec17e79f8e1416f1b6a73676bfbabda2e888164d2998c21785f3b3467fdabb825aea57dee772dffdf342de1431a53b47610a9c486de8
data/.yardopts CHANGED
@@ -8,5 +8,4 @@
8
8
  -
9
9
  README.md
10
10
  AUTHENTICATION.md
11
- MIGRATING.md
12
11
  LICENSE.md
data/README.md CHANGED
@@ -17,7 +17,7 @@ constructing client objects. Reference documentation for the client objects
17
17
  themselves can be found in the client library documentation for the versioned
18
18
  client gems:
19
19
  [google-cloud-language-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v1/latest),
20
- [google-cloud-language-v1beta2](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v1beta2/latest).
20
+ [google-cloud-language-v2](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v2/latest).
21
21
 
22
22
  See also the [Product Documentation](https://cloud.google.com/natural-language)
23
23
  for more usage information.
@@ -35,14 +35,6 @@ In order to use this library, you first need to go through the following steps:
35
35
  1. [Enable the API.](https://console.cloud.google.com/apis/library/language.googleapis.com)
36
36
  1. {file:AUTHENTICATION.md Set up authentication.}
37
37
 
38
- ## Migrating from 0.x versions
39
-
40
- The 1.0 release of the google-cloud-language client is a significant upgrade
41
- based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
42
- and includes substantial interface changes. Existing code written for earlier
43
- versions of this library will likely require updates to use this version.
44
- See the {file:MIGRATING.md MIGRATING.md} document for more information.
45
-
46
38
  ## Debug Logging
47
39
 
48
40
  This library comes with opt-in Debug Logging that can help you troubleshoot
@@ -72,7 +64,7 @@ Debug logging also requires that the versioned clients for this service be
72
64
  sufficiently recent, released after about Dec 10, 2024. If logging is not
73
65
  working, try updating the versioned clients in your bundle or installed gems:
74
66
  [google-cloud-language-v1](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v1/latest),
75
- [google-cloud-language-v1beta2](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v1beta2/latest).
67
+ [google-cloud-language-v2](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v2/latest).
76
68
 
77
69
  ## Supported Ruby Versions
78
70
 
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Language
19
- VERSION = "1.8.0".freeze
19
+ VERSION = "2.0.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -49,8 +49,8 @@ module Google
49
49
  # Create a new client object for LanguageService.
50
50
  #
51
51
  # By default, this returns an instance of
52
- # [Google::Cloud::Language::V1::LanguageService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v1/latest/Google-Cloud-Language-V1-LanguageService-Client)
53
- # for a gRPC client for version V1 of the API.
52
+ # [Google::Cloud::Language::V2::LanguageService::Client](https://cloud.google.com/ruby/docs/reference/google-cloud-language-v2/latest/Google-Cloud-Language-V2-LanguageService-Client)
53
+ # for a gRPC client for version V2 of the API.
54
54
  # However, you can specify a different API version by passing it in the
55
55
  # `version` parameter. If the LanguageService service is
56
56
  # supported by that API version, and the corresponding gem is available, the
@@ -69,11 +69,11 @@ module Google
69
69
  # recognition.
70
70
  #
71
71
  # @param version [::String, ::Symbol] The API version to connect to. Optional.
72
- # Defaults to `:v1`.
72
+ # Defaults to `:v2`.
73
73
  # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
74
74
  # @return [::Object] A client object for the specified version.
75
75
  #
76
- def self.language_service version: :v1, transport: :grpc, &block
76
+ def self.language_service version: :v2, transport: :grpc, &block
77
77
  require "google/cloud/language/#{version.to_s.downcase}"
78
78
 
79
79
  package_name = Google::Cloud::Language
@@ -93,11 +93,11 @@ module Google
93
93
  # or if the versioned client gem needs an update to support the LanguageService service.
94
94
  #
95
95
  # @param version [::String, ::Symbol] The API version to connect to. Optional.
96
- # Defaults to `:v1`.
96
+ # Defaults to `:v2`.
97
97
  # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`.
98
98
  # @return [boolean] Whether the service is available.
99
99
  #
100
- def self.language_service_available? version: :v1, transport: :grpc
100
+ def self.language_service_available? version: :v2, transport: :grpc
101
101
  require "google/cloud/language/#{version.to_s.downcase}"
102
102
  package_name = Google::Cloud::Language
103
103
  .constants
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-language
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-29 00:00:00.000000000 Z
10
+ date: 2025-02-13 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: google-cloud-core
@@ -27,42 +27,30 @@ dependencies:
27
27
  name: google-cloud-language-v1
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0.10'
33
- - - "<"
30
+ - - "~>"
34
31
  - !ruby/object:Gem::Version
35
- version: 2.a
32
+ version: '1.0'
36
33
  type: :runtime
37
34
  prerelease: false
38
35
  version_requirements: !ruby/object:Gem::Requirement
39
36
  requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '0.10'
43
- - - "<"
37
+ - - "~>"
44
38
  - !ruby/object:Gem::Version
45
- version: 2.a
39
+ version: '1.0'
46
40
  - !ruby/object:Gem::Dependency
47
- name: google-cloud-language-v1beta2
41
+ name: google-cloud-language-v2
48
42
  requirement: !ruby/object:Gem::Requirement
49
43
  requirements:
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: '0.10'
53
- - - "<"
44
+ - - "~>"
54
45
  - !ruby/object:Gem::Version
55
- version: 2.a
46
+ version: '1.0'
56
47
  type: :runtime
57
48
  prerelease: false
58
49
  version_requirements: !ruby/object:Gem::Requirement
59
50
  requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0.10'
63
- - - "<"
51
+ - - "~>"
64
52
  - !ruby/object:Gem::Version
65
- version: 2.a
53
+ version: '1.0'
66
54
  description: Provides natural language understanding technologies, such as sentiment
67
55
  analysis, entity recognition, entity sentiment analysis, and other text annotations.
68
56
  email: googleapis-packages@google.com
@@ -73,7 +61,6 @@ files:
73
61
  - ".yardopts"
74
62
  - AUTHENTICATION.md
75
63
  - LICENSE.md
76
- - MIGRATING.md
77
64
  - README.md
78
65
  - lib/google-cloud-language.rb
79
66
  - lib/google/cloud/language.rb
@@ -96,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
83
  - !ruby/object:Gem::Version
97
84
  version: '0'
98
85
  requirements: []
99
- rubygems_version: 3.6.2
86
+ rubygems_version: 3.6.3
100
87
  specification_version: 4
101
88
  summary: API Client library for the Cloud Natural Language API
102
89
  test_files: []
data/MIGRATING.md DELETED
@@ -1,289 +0,0 @@
1
- ## Migrating to google-cloud-language 1.0
2
-
3
- The 1.0 release of the google-cloud-language client is a significant upgrade
4
- based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
5
- and includes substantial interface changes. Existing code written for earlier
6
- versions of this library will likely require updates to use this version.
7
- This document describes the changes that have been made, and what you need to
8
- do to update your usage.
9
-
10
- To summarize:
11
-
12
- * The library has been broken out into three libraries. The new gems
13
- `google-cloud-language-v1` and `google-cloud-language-v1beta2` contain the
14
- actual client classes for versions V1 and V1beta2 of the Natural Language
15
- service, and the gem `google-cloud-language` now simply provides a
16
- convenience wrapper. See [Library Structure](#library-structure) for more
17
- info.
18
- * The library uses a new configuration mechanism giving you closer control
19
- over endpoint address, network timeouts, and retry. See
20
- [Client Configuration](#client-configuration) for more info. Furthermore,
21
- when creating a client object, you can customize its configuration in a
22
- block rather than passing arguments to the constructor. See
23
- [Creating Clients](#creating-clients) for more info.
24
- * Previously, positional arguments were used to indicate required arguments.
25
- Now, all method arguments are keyword arguments, with documentation that
26
- specifies whether they are required or optional. Additionally, you can pass
27
- a proto request object instead of separate arguments. See
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.
33
- * Some classes have moved into different namespaces. See
34
- [Class Namespaces](#class-namespaces) for more info.
35
-
36
- ### Library Structure
37
-
38
- Older 0.x releases of the `google-cloud-language` gem were all-in-one gems that
39
- included potentially multiple clients for multiple versions of the Natural
40
- Language service. The `Google::Cloud::Language.new` factory method would
41
- return you an instance of a `Google::Cloud::Language::V1::LanguageServiceClient`
42
- object for the V1 version of the service, or a
43
- `Google::Cloud::Language::V1beta2::LanguageServiceClient` object for the
44
- V1beta2 version of the service. All these classes were defined in the same gem.
45
-
46
- With the 1.0 release, the `google-cloud-language` gem still provides factory
47
- methods for obtaining clients. (The method signatures will have changed. See
48
- [Creating Clients](#creating-clients) for details.) However, the actual client
49
- classes have been moved into separate gems, one per service version. The
50
- `Google::Cloud::Language::V1::LanguageService::Client` class, along with its
51
- helpers and data types, is now part of the `google-cloud-language-v1` gem.
52
- Similarly, the `Google::Cloud::Language::V1beta2::LanguageService::Client`
53
- class is part of the `google-cloud-language-v1beta2` gem.
54
-
55
- For normal usage, you can continue to install the `google-cloud-language` gem
56
- (which will bring in the versioned client gems as dependencies) and continue to
57
- use factory methods to create clients. However, you may alternatively choose to
58
- install only one of the versioned gems. For example, if you know you will only
59
- `V1` of the service, you can install `google-cloud-language-v1` by itself, and
60
- construct instances of the
61
- `Google::Cloud::Language::V1::LanguageService::Client` client class directly.
62
-
63
- ### Client Configuration
64
-
65
- In older releases, if you wanted to customize performance parameters or
66
- low-level behavior of the client (such as credentials, timeouts, or
67
- instrumentation), you would pass a variety of keyword arguments to the client
68
- constructor. It was also extremely difficult to customize the default settings.
69
-
70
- With the 1.0 release, a configuration interface provides control over these
71
- parameters, including defaults for all instances of a client, and settings for
72
- each specific client instance. For example, to set default credentials and
73
- timeout for all Language V1 clients:
74
-
75
- ```
76
- Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
77
- config.credentials = "/path/to/credentials.json"
78
- config.timeout = 10.0
79
- end
80
- ```
81
-
82
- Individual RPCs can also be configured independently. For example, to set the
83
- timeout for the `analyze_sentiment` call:
84
-
85
- ```
86
- Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
87
- config.rpcs.analyze_sentinment.timeout = 20.0
88
- end
89
- ```
90
-
91
- Defaults for certain configurations can be set for all Language versions
92
- globally:
93
-
94
- ```
95
- Google::Cloud::Language.configure do |config|
96
- config.credentials = "/path/to/credentials.json"
97
- config.timeout = 10.0
98
- end
99
- ```
100
-
101
- Finally, you can override the configuration for each client instance. See the
102
- next section on [Creating Clients](#creating-clients) for details.
103
-
104
- ### Creating Clients
105
-
106
- In older releases, to create a client object, you would use the
107
- `Google::Cloud::Language.new` class method. Keyword arguments were available to
108
- select a service version and to configure parameters such as credentials and
109
- timeouts.
110
-
111
- With the 1.0 release, use the `Google::Cloud::Language.language_service` class
112
- method to create a client object. You may select a service version using the
113
- `:version` keyword argument. However, other configuration parameters should be
114
- set in a configuration block when you create the client.
115
-
116
- Old:
117
- ```
118
- client = Google::Cloud::Language.new credentials: "/path/to/credentials.json"
119
- ```
120
-
121
- New:
122
- ```
123
- client = Google::Cloud::Language.language_service do |config|
124
- config.credentials = "/path/to/credentials.json"
125
- end
126
- ```
127
-
128
- The configuration block is optional. If you do not provide it, or you do not
129
- set some configuration parameters, then the default configuration is used. See
130
- [Client Configuration](#client-configuration).
131
-
132
- ### Passing Arguments
133
-
134
- In older releases, required arguments would be passed as positional method
135
- arguments, while most optional arguments would be passed as keyword arguments.
136
-
137
- With the 1.0 release, all RPC arguments are passed as keyword arguments,
138
- regardless of whether they are required or optional. For example:
139
-
140
- Old:
141
- ```
142
- client = Google::Cloud::Language.new
143
-
144
- document = {
145
- content: "I love API calls!",
146
- type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
147
- }
148
- encoding = Google:Cloud::Language::V1::EncodingType::UTF8
149
-
150
- # Document is a positional argument, while encoding_type is a keyword argument.
151
- response = client.analyze_sentiment document, encoding_type: encoding
152
- ```
153
-
154
- New:
155
- ```
156
- client = Google::Cloud::Language.language_service
157
-
158
- document = {
159
- content: "I love API calls!",
160
- type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
161
- }
162
- encoding = Google:Cloud::Language::V1::EncodingType::UTF8
163
-
164
- # Both document and encoding_type are keyword arguments.
165
- response = client.analyze_sentiment document: document, encoding_type: encoding
166
- ```
167
-
168
- In the 1.0 release, it is also possible to pass a request object, either
169
- as a hash or as a protocol buffer.
170
-
171
- New:
172
- ```
173
- client = Google::Cloud::Language.language_service
174
-
175
- request = Google::Cloud::Language::V1::AnalyzeSentimentRequest.new(
176
- document: {
177
- content: "I love API calls!",
178
- type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
179
- },
180
- encoding_type: Google:Cloud::Language::V1::EncodingType::UTF8
181
- )
182
-
183
- # Pass a request object as a positional argument:
184
- response = client.analyze_sentiment request
185
- ```
186
-
187
- Finally, in older releases, to provide call options, you would pass a
188
- `Google::Gax::CallOptions` object with the `:options` keyword argument. In the
189
- 1.0 release, pass call options using a _second set_ of keyword arguments.
190
-
191
- Old:
192
- ```
193
- client = Google::Cloud::Language.new
194
-
195
- document = {
196
- content: "I love API calls!",
197
- type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
198
- }
199
-
200
- options = Google::Gax::CallOptions.new timeout: 10.0
201
-
202
- response = client.analyze_sentiment document, options: options
203
- ```
204
-
205
- New:
206
- ```
207
- client = Google::Cloud::Language.language_service
208
-
209
- document = {
210
- content: "I love API calls!",
211
- type: Google::Cloud::Language::V1::Document::Type::PLAIN_TEXT
212
- }
213
- encoding = Google:Cloud::Language::V1::EncodingType::UTF8
214
-
215
- # Use a hash to wrap the normal call arguments (or pass a request object), and
216
- # then add further keyword arguments for the call options.
217
- response = client.analyze_sentiment(
218
- { document: document, encoding_type: encoding },
219
- timeout: 10.0
220
- )
221
- ```
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
-
273
- ### Class Namespaces
274
-
275
- In older releases, the client object was of class
276
- `Google::Cloud::Language::V1::LanguageServiceClient`.
277
- In the 1.0 release, the client object is of class
278
- `Google::Cloud::Language::V1::LanguageService::Client`.
279
- Note that most users will use the `Google::Cloud::Language.language_service`
280
- factory method to create instances of the client object, so you may not need to
281
- reference the actual class directly.
282
- See [Creating Clients](#creating-clients).
283
-
284
- In older releases, the credentials object was of class
285
- `Google::Cloud::Language::V1::Credentials`.
286
- In the 1.0 release, the credentials object is of class
287
- `Google::Cloud::Language::V1::LanguageService::Credentials`.
288
- Again, most users will not need to reference this class directly.
289
- See [Client Configuration](#client-configuration).