google-cloud-language-v1 0.4.0 → 0.4.4

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: f25f2eb315094473226e0dc4ec339904a6bffc49adf06c2d3ece94264131a9ed
4
- data.tar.gz: bbcd900443953b905d025c2b39b8d19c4e5c936780dd80312b2351787c4d47b1
3
+ metadata.gz: bbcc94c308a251c418ef0fe5643cbe4c8d17f3af4772ee218637111af4a0f0ec
4
+ data.tar.gz: e6418d2c570381facac07163133f1d5b557996e08d5cf2763705bcf238029aa8
5
5
  SHA512:
6
- metadata.gz: 6df72bae6acb960223aa5de715f06685aa1e4d0c5fa60754a24f73bb48637742a624447962578e459c1c168d1a654f7eee0dff3ce4ecd051ccc26a0eb2dea647
7
- data.tar.gz: 7e8d238f03113699466140f796884a81760dfd613fbebb483eed11b138e47637b5adb09d16756903475578eafcf8a966f0cd91079387042a088fe345d5eed6af
6
+ metadata.gz: d95a3c1fd8317c3f854caedb538246cb752ead140975094d63595166f87a7e8935076a10c9810db7df5f071ec4536153c06cd06baccbe738c8fcffd531872b6e
7
+ data.tar.gz: b78562de34b89c7d6f47e18e6881d70fc0df436f54560014b815923f69ea966671fb3a9c81c64c86a7ff5616193c8bcb04ec12801452a766836311a494f772d8
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-language-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::Language::V1::LanguageService::Credentials}):
68
68
 
69
- 1. `LANGUAGE_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `LANGUAGE_KEYFILE` - Path to JSON file, or JSON contents
71
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
69
+ * `LANGUAGE_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `LANGUAGE_KEYFILE` - Path to JSON file, or JSON contents
71
+ * `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
+ * `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
+ * `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/language/v1"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::Language::V1::LanguageService::Client.new
82
82
 
83
83
  ### Configuration
84
84
 
85
- The **Credentials JSON** can be configured instead of placing them in
86
- environment variables. Either on an individual client initialization:
85
+ The path to the **Credentials JSON** file can be configured instead of storing
86
+ it in an environment variable. Either on an individual client initialization:
87
87
 
88
88
  ```ruby
89
89
  require "google/cloud/language/v1"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
93
93
  end
94
94
  ```
95
95
 
96
- Or configured globally for all clients:
96
+ Or globally for all clients:
97
97
 
98
98
  ```ruby
99
99
  require "google/cloud/language/v1"
data/README.md CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/language/v1"
34
34
 
35
35
  client = ::Google::Cloud::Language::V1::LanguageService::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::Language::V1::AnalyzeSentimentRequest.new # (request fields as keyword arguments...)
37
37
  response = client.analyze_sentiment request
38
38
  ```
39
39
 
@@ -40,13 +40,12 @@ module Google
40
40
  # See {::Google::Cloud::Language::V1::LanguageService::Client::Configuration}
41
41
  # for a description of the configuration fields.
42
42
  #
43
- # ## Example
43
+ # @example
44
44
  #
45
- # To modify the configuration for all LanguageService clients:
46
- #
47
- # ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
48
- # config.timeout = 10.0
49
- # end
45
+ # # Modify the configuration for all LanguageService clients
46
+ # ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
47
+ # config.timeout = 10.0
48
+ # end
50
49
  #
51
50
  # @yield [config] Configure the Client client.
52
51
  # @yieldparam config [Client::Configuration]
@@ -66,50 +65,32 @@ module Google
66
65
 
67
66
  default_config.rpcs.analyze_sentiment.timeout = 600.0
68
67
  default_config.rpcs.analyze_sentiment.retry_policy = {
69
- initial_delay: 0.1,
70
- max_delay: 60.0,
71
- multiplier: 1.3,
72
- retry_codes: [4, 14]
68
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
73
69
  }
74
70
 
75
71
  default_config.rpcs.analyze_entities.timeout = 600.0
76
72
  default_config.rpcs.analyze_entities.retry_policy = {
77
- initial_delay: 0.1,
78
- max_delay: 60.0,
79
- multiplier: 1.3,
80
- retry_codes: [4, 14]
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
81
74
  }
82
75
 
83
76
  default_config.rpcs.analyze_entity_sentiment.timeout = 600.0
84
77
  default_config.rpcs.analyze_entity_sentiment.retry_policy = {
85
- initial_delay: 0.1,
86
- max_delay: 60.0,
87
- multiplier: 1.3,
88
- retry_codes: [4, 14]
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
89
79
  }
90
80
 
91
81
  default_config.rpcs.analyze_syntax.timeout = 600.0
92
82
  default_config.rpcs.analyze_syntax.retry_policy = {
93
- initial_delay: 0.1,
94
- max_delay: 60.0,
95
- multiplier: 1.3,
96
- retry_codes: [4, 14]
83
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
97
84
  }
98
85
 
99
86
  default_config.rpcs.classify_text.timeout = 600.0
100
87
  default_config.rpcs.classify_text.retry_policy = {
101
- initial_delay: 0.1,
102
- max_delay: 60.0,
103
- multiplier: 1.3,
104
- retry_codes: [4, 14]
88
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
105
89
  }
106
90
 
107
91
  default_config.rpcs.annotate_text.timeout = 600.0
108
92
  default_config.rpcs.annotate_text.retry_policy = {
109
- initial_delay: 0.1,
110
- max_delay: 60.0,
111
- multiplier: 1.3,
112
- retry_codes: [4, 14]
93
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
113
94
  }
114
95
 
115
96
  default_config
@@ -141,19 +122,15 @@ module Google
141
122
  ##
142
123
  # Create a new LanguageService client object.
143
124
  #
144
- # ## Examples
145
- #
146
- # To create a new LanguageService client with the default
147
- # configuration:
148
- #
149
- # client = ::Google::Cloud::Language::V1::LanguageService::Client.new
125
+ # @example
150
126
  #
151
- # To create a new LanguageService client with a custom
152
- # configuration:
127
+ # # Create a client using the default configuration
128
+ # client = ::Google::Cloud::Language::V1::LanguageService::Client.new
153
129
  #
154
- # client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
155
- # config.timeout = 10.0
156
- # end
130
+ # # Create a client using a custom configuration
131
+ # client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
132
+ # config.timeout = 10.0
133
+ # end
157
134
  #
158
135
  # @yield [config] Configure the LanguageService client.
159
136
  # @yieldparam config [Client::Configuration]
@@ -173,14 +150,13 @@ module Google
173
150
 
174
151
  # Create credentials
175
152
  credentials = @config.credentials
176
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
153
+ # Use self-signed JWT if the endpoint is unchanged from default,
177
154
  # but only if the default endpoint does not have a region prefix.
178
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
179
- @config.endpoint == Client.configure.endpoint &&
155
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
180
156
  !@config.endpoint.split(".").first.include?("-")
181
157
  credentials ||= Credentials.default scope: @config.scope,
182
158
  enable_self_signed_jwt: enable_self_signed_jwt
183
- if credentials.is_a?(String) || credentials.is_a?(Hash)
159
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
184
160
  credentials = Credentials.new credentials, scope: @config.scope
185
161
  end
186
162
  @quota_project_id = @config.quota_project
@@ -228,6 +204,21 @@ module Google
228
204
  #
229
205
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
230
206
  #
207
+ # @example Basic example
208
+ # require "google/cloud/language/v1"
209
+ #
210
+ # # Create a client object. The client can be reused for multiple calls.
211
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
212
+ #
213
+ # # Create a request. To set request fields, pass in keyword arguments.
214
+ # request = Google::Cloud::Language::V1::AnalyzeSentimentRequest.new
215
+ #
216
+ # # Call the analyze_sentiment method.
217
+ # result = client.analyze_sentiment request
218
+ #
219
+ # # The returned object is of type Google::Cloud::Language::V1::AnalyzeSentimentResponse.
220
+ # p result
221
+ #
231
222
  def analyze_sentiment request, options = nil
232
223
  raise ::ArgumentError, "request must be provided" if request.nil?
233
224
 
@@ -248,7 +239,9 @@ module Google
248
239
  options.apply_defaults timeout: @config.rpcs.analyze_sentiment.timeout,
249
240
  metadata: metadata,
250
241
  retry_policy: @config.rpcs.analyze_sentiment.retry_policy
251
- options.apply_defaults metadata: @config.metadata,
242
+
243
+ options.apply_defaults timeout: @config.timeout,
244
+ metadata: @config.metadata,
252
245
  retry_policy: @config.retry_policy
253
246
 
254
247
  @language_service_stub.call_rpc :analyze_sentiment, request, options: options do |response, operation|
@@ -292,6 +285,21 @@ module Google
292
285
  #
293
286
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
294
287
  #
288
+ # @example Basic example
289
+ # require "google/cloud/language/v1"
290
+ #
291
+ # # Create a client object. The client can be reused for multiple calls.
292
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
293
+ #
294
+ # # Create a request. To set request fields, pass in keyword arguments.
295
+ # request = Google::Cloud::Language::V1::AnalyzeEntitiesRequest.new
296
+ #
297
+ # # Call the analyze_entities method.
298
+ # result = client.analyze_entities request
299
+ #
300
+ # # The returned object is of type Google::Cloud::Language::V1::AnalyzeEntitiesResponse.
301
+ # p result
302
+ #
295
303
  def analyze_entities request, options = nil
296
304
  raise ::ArgumentError, "request must be provided" if request.nil?
297
305
 
@@ -312,7 +320,9 @@ module Google
312
320
  options.apply_defaults timeout: @config.rpcs.analyze_entities.timeout,
313
321
  metadata: metadata,
314
322
  retry_policy: @config.rpcs.analyze_entities.retry_policy
315
- options.apply_defaults metadata: @config.metadata,
323
+
324
+ options.apply_defaults timeout: @config.timeout,
325
+ metadata: @config.metadata,
316
326
  retry_policy: @config.retry_policy
317
327
 
318
328
  @language_service_stub.call_rpc :analyze_entities, request, options: options do |response, operation|
@@ -355,6 +365,21 @@ module Google
355
365
  #
356
366
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
357
367
  #
368
+ # @example Basic example
369
+ # require "google/cloud/language/v1"
370
+ #
371
+ # # Create a client object. The client can be reused for multiple calls.
372
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
373
+ #
374
+ # # Create a request. To set request fields, pass in keyword arguments.
375
+ # request = Google::Cloud::Language::V1::AnalyzeEntitySentimentRequest.new
376
+ #
377
+ # # Call the analyze_entity_sentiment method.
378
+ # result = client.analyze_entity_sentiment request
379
+ #
380
+ # # The returned object is of type Google::Cloud::Language::V1::AnalyzeEntitySentimentResponse.
381
+ # p result
382
+ #
358
383
  def analyze_entity_sentiment request, options = nil
359
384
  raise ::ArgumentError, "request must be provided" if request.nil?
360
385
 
@@ -375,7 +400,9 @@ module Google
375
400
  options.apply_defaults timeout: @config.rpcs.analyze_entity_sentiment.timeout,
376
401
  metadata: metadata,
377
402
  retry_policy: @config.rpcs.analyze_entity_sentiment.retry_policy
378
- options.apply_defaults metadata: @config.metadata,
403
+
404
+ options.apply_defaults timeout: @config.timeout,
405
+ metadata: @config.metadata,
379
406
  retry_policy: @config.retry_policy
380
407
 
381
408
  @language_service_stub.call_rpc :analyze_entity_sentiment, request, options: options do |response, operation|
@@ -419,6 +446,21 @@ module Google
419
446
  #
420
447
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
421
448
  #
449
+ # @example Basic example
450
+ # require "google/cloud/language/v1"
451
+ #
452
+ # # Create a client object. The client can be reused for multiple calls.
453
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
454
+ #
455
+ # # Create a request. To set request fields, pass in keyword arguments.
456
+ # request = Google::Cloud::Language::V1::AnalyzeSyntaxRequest.new
457
+ #
458
+ # # Call the analyze_syntax method.
459
+ # result = client.analyze_syntax request
460
+ #
461
+ # # The returned object is of type Google::Cloud::Language::V1::AnalyzeSyntaxResponse.
462
+ # p result
463
+ #
422
464
  def analyze_syntax request, options = nil
423
465
  raise ::ArgumentError, "request must be provided" if request.nil?
424
466
 
@@ -439,7 +481,9 @@ module Google
439
481
  options.apply_defaults timeout: @config.rpcs.analyze_syntax.timeout,
440
482
  metadata: metadata,
441
483
  retry_policy: @config.rpcs.analyze_syntax.retry_policy
442
- options.apply_defaults metadata: @config.metadata,
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
443
487
  retry_policy: @config.retry_policy
444
488
 
445
489
  @language_service_stub.call_rpc :analyze_syntax, request, options: options do |response, operation|
@@ -479,6 +523,21 @@ module Google
479
523
  #
480
524
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
481
525
  #
526
+ # @example Basic example
527
+ # require "google/cloud/language/v1"
528
+ #
529
+ # # Create a client object. The client can be reused for multiple calls.
530
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
531
+ #
532
+ # # Create a request. To set request fields, pass in keyword arguments.
533
+ # request = Google::Cloud::Language::V1::ClassifyTextRequest.new
534
+ #
535
+ # # Call the classify_text method.
536
+ # result = client.classify_text request
537
+ #
538
+ # # The returned object is of type Google::Cloud::Language::V1::ClassifyTextResponse.
539
+ # p result
540
+ #
482
541
  def classify_text request, options = nil
483
542
  raise ::ArgumentError, "request must be provided" if request.nil?
484
543
 
@@ -499,7 +558,9 @@ module Google
499
558
  options.apply_defaults timeout: @config.rpcs.classify_text.timeout,
500
559
  metadata: metadata,
501
560
  retry_policy: @config.rpcs.classify_text.retry_policy
502
- options.apply_defaults metadata: @config.metadata,
561
+
562
+ options.apply_defaults timeout: @config.timeout,
563
+ metadata: @config.metadata,
503
564
  retry_policy: @config.retry_policy
504
565
 
505
566
  @language_service_stub.call_rpc :classify_text, request, options: options do |response, operation|
@@ -544,6 +605,21 @@ module Google
544
605
  #
545
606
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
546
607
  #
608
+ # @example Basic example
609
+ # require "google/cloud/language/v1"
610
+ #
611
+ # # Create a client object. The client can be reused for multiple calls.
612
+ # client = Google::Cloud::Language::V1::LanguageService::Client.new
613
+ #
614
+ # # Create a request. To set request fields, pass in keyword arguments.
615
+ # request = Google::Cloud::Language::V1::AnnotateTextRequest.new
616
+ #
617
+ # # Call the annotate_text method.
618
+ # result = client.annotate_text request
619
+ #
620
+ # # The returned object is of type Google::Cloud::Language::V1::AnnotateTextResponse.
621
+ # p result
622
+ #
547
623
  def annotate_text request, options = nil
548
624
  raise ::ArgumentError, "request must be provided" if request.nil?
549
625
 
@@ -564,7 +640,9 @@ module Google
564
640
  options.apply_defaults timeout: @config.rpcs.annotate_text.timeout,
565
641
  metadata: metadata,
566
642
  retry_policy: @config.rpcs.annotate_text.retry_policy
567
- options.apply_defaults metadata: @config.metadata,
643
+
644
+ options.apply_defaults timeout: @config.timeout,
645
+ metadata: @config.metadata,
568
646
  retry_policy: @config.retry_policy
569
647
 
570
648
  @language_service_stub.call_rpc :annotate_text, request, options: options do |response, operation|
@@ -588,22 +666,21 @@ module Google
588
666
  # Configuration can be applied globally to all clients, or to a single client
589
667
  # on construction.
590
668
  #
591
- # # Examples
592
- #
593
- # To modify the global config, setting the timeout for analyze_sentiment
594
- # to 20 seconds, and all remaining timeouts to 10 seconds:
595
- #
596
- # ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
597
- # config.timeout = 10.0
598
- # config.rpcs.analyze_sentiment.timeout = 20.0
599
- # end
600
- #
601
- # To apply the above configuration only to a new client:
602
- #
603
- # client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
604
- # config.timeout = 10.0
605
- # config.rpcs.analyze_sentiment.timeout = 20.0
606
- # end
669
+ # @example
670
+ #
671
+ # # Modify the global config, setting the timeout for
672
+ # # analyze_sentiment to 20 seconds,
673
+ # # and all remaining timeouts to 10 seconds.
674
+ # ::Google::Cloud::Language::V1::LanguageService::Client.configure do |config|
675
+ # config.timeout = 10.0
676
+ # config.rpcs.analyze_sentiment.timeout = 20.0
677
+ # end
678
+ #
679
+ # # Apply the above configuration only to a new client.
680
+ # client = ::Google::Cloud::Language::V1::LanguageService::Client.new do |config|
681
+ # config.timeout = 10.0
682
+ # config.rpcs.analyze_sentiment.timeout = 20.0
683
+ # end
607
684
  #
608
685
  # @!attribute [rw] endpoint
609
686
  # The hostname or hostname:port of the service endpoint.
@@ -1,11 +1,11 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/language/v1/language_service.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/api/annotations_pb'
7
5
  require 'google/api/client_pb'
8
6
  require 'google/api/field_behavior_pb'
7
+ require 'google/protobuf'
8
+
9
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
10
10
  add_file("google/cloud/language/v1/language_service.proto", :syntax => :proto3) do
11
11
  add_message "google.cloud.language.v1.Document" do
@@ -29,7 +29,7 @@ module Google
29
29
  # recognition.
30
30
  class Service
31
31
 
32
- include GRPC::GenericService
32
+ include ::GRPC::GenericService
33
33
 
34
34
  self.marshal_class_method = :encode
35
35
  self.unmarshal_class_method = :decode
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Language
23
23
  module V1
24
- VERSION = "0.4.0"
24
+ VERSION = "0.4.4"
25
25
  end
26
26
  end
27
27
  end
@@ -57,9 +57,15 @@ module Google
57
57
 
58
58
  # Denotes that a (repeated) field is an unordered list.
59
59
  # This indicates that the service may provide the elements of the list
60
- # in any arbitrary order, rather than the order the user originally
60
+ # in any arbitrary order, rather than the order the user originally
61
61
  # provided. Additionally, the list's order may or may not be stable.
62
62
  UNORDERED_LIST = 6
63
+
64
+ # Denotes that this field returns a non-empty default value if not set.
65
+ # This indicates that if the user provides the empty value in a request,
66
+ # a non-empty value will be returned. The user will not be aware of what
67
+ # non-empty value to expect.
68
+ NON_EMPTY_DEFAULT = 7
63
69
  end
64
70
  end
65
71
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-language-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '0.3'
22
+ version: 2.a
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0.7'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '0.3'
32
+ version: 2.a
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: google-cloud-errors
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -195,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
201
  - !ruby/object:Gem::Version
196
202
  version: '0'
197
203
  requirements: []
198
- rubygems_version: 3.2.13
204
+ rubygems_version: 3.2.17
199
205
  signing_key:
200
206
  specification_version: 4
201
207
  summary: API Client library for the Natural Language V1 API