google-cloud-translate-v3 0.4.0 → 0.5.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: a8cfa4d08984860e5959afa7256f8f0f080f06ab005fa1d4b9d0faf0c8eb4bf1
4
- data.tar.gz: 352e5dca02bf816caa32be3aef72876ccbc730e5169bc4eb6927b8631421c911
3
+ metadata.gz: 6adf60984283996762a4e2606b937a3b539e9934f931cf61b7bc6b30888dfa15
4
+ data.tar.gz: 67488fbfeb205cab40d08e995b51ffd138c31cdfe2faac47db0713dbfa879621
5
5
  SHA512:
6
- metadata.gz: 488a8eb67f8215a8bdc46951ae63c0b0af83bcdfefde0125e3fcb7806c6208a50b85b9008c50a149a6737b8c6631102ee5bf61c2cb5e80341470c7ebca0657bf
7
- data.tar.gz: ff5fab29974c8902d18bc8a17b5438fa4b098bfccb6b73eab04ae72ac2c62327ec5c208641908d6a8b03a630071238887afdd89008f77627f52f515071de573d
6
+ metadata.gz: e6a645537bd9fef73d168456329aec67cade6880a3c35b09a97225d4e2d6b9f383adde531d8a19d7070c7134fed5b0de9dfe160386f64321792d97df2fc9d6bd
7
+ data.tar.gz: d3f566a604db965f0905954f25ef0bdabacde3b71961ab394059025045456bfaf94f80c2646d994896a04ab9316d8f503329652656ec8bc4c8f8beddcef8a3b1
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --no-private
2
- --title=Cloud Translation V3 API
2
+ --title="Cloud Translation V3 API"
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
5
  --markup-provider redcarpet
data/AUTHENTICATION.md CHANGED
@@ -120,15 +120,6 @@ To configure your system for this, simply:
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
121
121
  *should* only be used during development.
122
122
 
123
- [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
124
- [dev-console]: https://console.cloud.google.com/project
125
-
126
- [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
127
-
128
- [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
129
- [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
130
- [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
131
-
132
123
  ## Creating a Service Account
133
124
 
134
125
  Google Cloud requires **Service Account Credentials** to
@@ -139,31 +130,22 @@ If you are not running this client within
139
130
  [Google Cloud Platform environments](#google-cloud-platform-environments), you
140
131
  need a Google Developers service account.
141
132
 
142
- 1. Visit the [Google Developers Console][dev-console].
133
+ 1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
143
134
  2. Create a new project or click on an existing project.
144
- 3. Activate the slide-out navigation tray and select **API Manager**. From
135
+ 3. Activate the menu in the upper left and select **APIs & Services**. From
145
136
  here, you will enable the APIs that your application requires.
146
137
 
147
- ![Enable the APIs that your application requires][enable-apis]
148
-
149
138
  *Note: You may need to enable billing in order to use these services.*
150
139
 
151
140
  4. Select **Credentials** from the side navigation.
152
141
 
153
- You should see a screen like one of the following.
154
-
155
- ![Create a new service account][create-new-service-account]
156
-
157
- ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
158
-
159
- Find the "Add credentials" drop down and select "Service account" to be
160
- guided through downloading a new JSON key file.
142
+ Find the "Create credentials" drop down near the top of the page, and select
143
+ "Service account" to be guided through downloading a new JSON key file.
161
144
 
162
145
  If you want to re-use an existing service account, you can easily generate a
163
- new key file. Just select the account you wish to re-use, and click "Generate
164
- new JSON key":
165
-
166
- ![Re-use an existing service account][reuse-service-account]
146
+ new key file. Just select the account you wish to re-use, click the pencil
147
+ tool on the right side to edit the service account, select the **Keys** tab,
148
+ and then select **Add Key**.
167
149
 
168
150
  The key file you download will be used by this library to authenticate API
169
151
  requests and should be stored in a secure location.
data/README.md CHANGED
@@ -37,7 +37,7 @@ request = ::Google::Cloud::Translate::V3::TranslateTextRequest.new # (request fi
37
37
  response = client.translate_text request
38
38
  ```
39
39
 
40
- View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-translate-v3/latest)
40
+ View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-translate-v3/latest)
41
41
  for class and method documentation.
42
42
 
43
43
  See also the [Product Documentation](https://cloud.google.com/translate)
@@ -69,16 +69,21 @@ module GRPC
69
69
  end
70
70
  ```
71
71
 
72
+
73
+ ## Google Cloud Samples
74
+
75
+ To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
+
72
77
  ## Supported Ruby Versions
73
78
 
74
- This library is supported on Ruby 2.5+.
79
+ This library is supported on Ruby 2.6+.
75
80
 
76
81
  Google provides official support for Ruby versions that are actively supported
77
82
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
78
- in security maintenance, and not end of life. Currently, this means Ruby 2.5
79
- and later. Older versions of Ruby _may_ still work, but are unsupported and not
80
- recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
81
- about the Ruby support schedule.
83
+ in security maintenance, and not end of life. Older versions of Ruby _may_
84
+ still work, but are unsupported and not recommended. See
85
+ https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
86
+ support schedule.
82
87
 
83
88
  ## Which client should I use?
84
89
 
@@ -167,6 +167,7 @@ module Google
167
167
 
168
168
  @operations_client = Operations.new do |config|
169
169
  config.credentials = credentials
170
+ config.quota_project = @quota_project_id
170
171
  config.endpoint = @config.endpoint
171
172
  end
172
173
 
@@ -278,6 +279,21 @@ module Google
278
279
  #
279
280
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
280
281
  #
282
+ # @example Basic example
283
+ # require "google/cloud/translate/v3"
284
+ #
285
+ # # Create a client object. The client can be reused for multiple calls.
286
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
287
+ #
288
+ # # Create a request. To set request fields, pass in keyword arguments.
289
+ # request = Google::Cloud::Translate::V3::TranslateTextRequest.new
290
+ #
291
+ # # Call the translate_text method.
292
+ # result = client.translate_text request
293
+ #
294
+ # # The returned object is of type Google::Cloud::Translate::V3::TranslateTextResponse.
295
+ # p result
296
+ #
281
297
  def translate_text request, options = nil
282
298
  raise ::ArgumentError, "request must be provided" if request.nil?
283
299
 
@@ -295,9 +311,11 @@ module Google
295
311
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
296
312
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
297
313
 
298
- header_params = {
299
- "parent" => request.parent
300
- }
314
+ header_params = {}
315
+ if request.parent
316
+ header_params["parent"] = request.parent
317
+ end
318
+
301
319
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
302
320
  metadata[:"x-goog-request-params"] ||= request_params_header
303
321
 
@@ -381,6 +399,21 @@ module Google
381
399
  #
382
400
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
383
401
  #
402
+ # @example Basic example
403
+ # require "google/cloud/translate/v3"
404
+ #
405
+ # # Create a client object. The client can be reused for multiple calls.
406
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
407
+ #
408
+ # # Create a request. To set request fields, pass in keyword arguments.
409
+ # request = Google::Cloud::Translate::V3::DetectLanguageRequest.new
410
+ #
411
+ # # Call the detect_language method.
412
+ # result = client.detect_language request
413
+ #
414
+ # # The returned object is of type Google::Cloud::Translate::V3::DetectLanguageResponse.
415
+ # p result
416
+ #
384
417
  def detect_language request, options = nil
385
418
  raise ::ArgumentError, "request must be provided" if request.nil?
386
419
 
@@ -398,9 +431,11 @@ module Google
398
431
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
399
432
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
400
433
 
401
- header_params = {
402
- "parent" => request.parent
403
- }
434
+ header_params = {}
435
+ if request.parent
436
+ header_params["parent"] = request.parent
437
+ end
438
+
404
439
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
405
440
  metadata[:"x-goog-request-params"] ||= request_params_header
406
441
 
@@ -479,6 +514,21 @@ module Google
479
514
  #
480
515
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
481
516
  #
517
+ # @example Basic example
518
+ # require "google/cloud/translate/v3"
519
+ #
520
+ # # Create a client object. The client can be reused for multiple calls.
521
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
522
+ #
523
+ # # Create a request. To set request fields, pass in keyword arguments.
524
+ # request = Google::Cloud::Translate::V3::GetSupportedLanguagesRequest.new
525
+ #
526
+ # # Call the get_supported_languages method.
527
+ # result = client.get_supported_languages request
528
+ #
529
+ # # The returned object is of type Google::Cloud::Translate::V3::SupportedLanguages.
530
+ # p result
531
+ #
482
532
  def get_supported_languages request, options = nil
483
533
  raise ::ArgumentError, "request must be provided" if request.nil?
484
534
 
@@ -496,9 +546,11 @@ module Google
496
546
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
497
547
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
498
548
 
499
- header_params = {
500
- "parent" => request.parent
501
- }
549
+ header_params = {}
550
+ if request.parent
551
+ header_params["parent"] = request.parent
552
+ end
553
+
502
554
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
503
555
  metadata[:"x-goog-request-params"] ||= request_params_header
504
556
 
@@ -604,6 +656,21 @@ module Google
604
656
  #
605
657
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
606
658
  #
659
+ # @example Basic example
660
+ # require "google/cloud/translate/v3"
661
+ #
662
+ # # Create a client object. The client can be reused for multiple calls.
663
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
664
+ #
665
+ # # Create a request. To set request fields, pass in keyword arguments.
666
+ # request = Google::Cloud::Translate::V3::TranslateDocumentRequest.new
667
+ #
668
+ # # Call the translate_document method.
669
+ # result = client.translate_document request
670
+ #
671
+ # # The returned object is of type Google::Cloud::Translate::V3::TranslateDocumentResponse.
672
+ # p result
673
+ #
607
674
  def translate_document request, options = nil
608
675
  raise ::ArgumentError, "request must be provided" if request.nil?
609
676
 
@@ -621,9 +688,11 @@ module Google
621
688
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
622
689
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
623
690
 
624
- header_params = {
625
- "parent" => request.parent
626
- }
691
+ header_params = {}
692
+ if request.parent
693
+ header_params["parent"] = request.parent
694
+ end
695
+
627
696
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
628
697
  metadata[:"x-goog-request-params"] ||= request_params_header
629
698
 
@@ -728,6 +797,28 @@ module Google
728
797
  #
729
798
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
730
799
  #
800
+ # @example Basic example
801
+ # require "google/cloud/translate/v3"
802
+ #
803
+ # # Create a client object. The client can be reused for multiple calls.
804
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
805
+ #
806
+ # # Create a request. To set request fields, pass in keyword arguments.
807
+ # request = Google::Cloud::Translate::V3::BatchTranslateTextRequest.new
808
+ #
809
+ # # Call the batch_translate_text method.
810
+ # result = client.batch_translate_text request
811
+ #
812
+ # # The returned object is of type Gapic::Operation. You can use this
813
+ # # object to check the status of an operation, cancel it, or wait
814
+ # # for results. Here is how to block until completion:
815
+ # result.wait_until_done! timeout: 60
816
+ # if result.response?
817
+ # p result.response
818
+ # else
819
+ # puts "Error!"
820
+ # end
821
+ #
731
822
  def batch_translate_text request, options = nil
732
823
  raise ::ArgumentError, "request must be provided" if request.nil?
733
824
 
@@ -745,9 +836,11 @@ module Google
745
836
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
746
837
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
747
838
 
748
- header_params = {
749
- "parent" => request.parent
750
- }
839
+ header_params = {}
840
+ if request.parent
841
+ header_params["parent"] = request.parent
842
+ end
843
+
751
844
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
752
845
  metadata[:"x-goog-request-params"] ||= request_params_header
753
846
 
@@ -856,6 +949,28 @@ module Google
856
949
  #
857
950
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
858
951
  #
952
+ # @example Basic example
953
+ # require "google/cloud/translate/v3"
954
+ #
955
+ # # Create a client object. The client can be reused for multiple calls.
956
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
957
+ #
958
+ # # Create a request. To set request fields, pass in keyword arguments.
959
+ # request = Google::Cloud::Translate::V3::BatchTranslateDocumentRequest.new
960
+ #
961
+ # # Call the batch_translate_document method.
962
+ # result = client.batch_translate_document request
963
+ #
964
+ # # The returned object is of type Gapic::Operation. You can use this
965
+ # # object to check the status of an operation, cancel it, or wait
966
+ # # for results. Here is how to block until completion:
967
+ # result.wait_until_done! timeout: 60
968
+ # if result.response?
969
+ # p result.response
970
+ # else
971
+ # puts "Error!"
972
+ # end
973
+ #
859
974
  def batch_translate_document request, options = nil
860
975
  raise ::ArgumentError, "request must be provided" if request.nil?
861
976
 
@@ -873,9 +988,11 @@ module Google
873
988
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
874
989
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
875
990
 
876
- header_params = {
877
- "parent" => request.parent
878
- }
991
+ header_params = {}
992
+ if request.parent
993
+ header_params["parent"] = request.parent
994
+ end
995
+
879
996
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
880
997
  metadata[:"x-goog-request-params"] ||= request_params_header
881
998
 
@@ -928,6 +1045,28 @@ module Google
928
1045
  #
929
1046
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
930
1047
  #
1048
+ # @example Basic example
1049
+ # require "google/cloud/translate/v3"
1050
+ #
1051
+ # # Create a client object. The client can be reused for multiple calls.
1052
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
1053
+ #
1054
+ # # Create a request. To set request fields, pass in keyword arguments.
1055
+ # request = Google::Cloud::Translate::V3::CreateGlossaryRequest.new
1056
+ #
1057
+ # # Call the create_glossary method.
1058
+ # result = client.create_glossary request
1059
+ #
1060
+ # # The returned object is of type Gapic::Operation. You can use this
1061
+ # # object to check the status of an operation, cancel it, or wait
1062
+ # # for results. Here is how to block until completion:
1063
+ # result.wait_until_done! timeout: 60
1064
+ # if result.response?
1065
+ # p result.response
1066
+ # else
1067
+ # puts "Error!"
1068
+ # end
1069
+ #
931
1070
  def create_glossary request, options = nil
932
1071
  raise ::ArgumentError, "request must be provided" if request.nil?
933
1072
 
@@ -945,9 +1084,11 @@ module Google
945
1084
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
946
1085
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
947
1086
 
948
- header_params = {
949
- "parent" => request.parent
950
- }
1087
+ header_params = {}
1088
+ if request.parent
1089
+ header_params["parent"] = request.parent
1090
+ end
1091
+
951
1092
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
952
1093
  metadata[:"x-goog-request-params"] ||= request_params_header
953
1094
 
@@ -1023,6 +1164,27 @@ module Google
1023
1164
  #
1024
1165
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1025
1166
  #
1167
+ # @example Basic example
1168
+ # require "google/cloud/translate/v3"
1169
+ #
1170
+ # # Create a client object. The client can be reused for multiple calls.
1171
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
1172
+ #
1173
+ # # Create a request. To set request fields, pass in keyword arguments.
1174
+ # request = Google::Cloud::Translate::V3::ListGlossariesRequest.new
1175
+ #
1176
+ # # Call the list_glossaries method.
1177
+ # result = client.list_glossaries request
1178
+ #
1179
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1180
+ # # iterate over all elements by calling #each, and the enumerable
1181
+ # # will lazily make API calls to fetch subsequent pages. Other
1182
+ # # methods are also available for managing paging directly.
1183
+ # result.each do |response|
1184
+ # # Each element is of type ::Google::Cloud::Translate::V3::Glossary.
1185
+ # p response
1186
+ # end
1187
+ #
1026
1188
  def list_glossaries request, options = nil
1027
1189
  raise ::ArgumentError, "request must be provided" if request.nil?
1028
1190
 
@@ -1040,9 +1202,11 @@ module Google
1040
1202
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
1041
1203
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1042
1204
 
1043
- header_params = {
1044
- "parent" => request.parent
1045
- }
1205
+ header_params = {}
1206
+ if request.parent
1207
+ header_params["parent"] = request.parent
1208
+ end
1209
+
1046
1210
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1047
1211
  metadata[:"x-goog-request-params"] ||= request_params_header
1048
1212
 
@@ -1093,6 +1257,21 @@ module Google
1093
1257
  #
1094
1258
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1095
1259
  #
1260
+ # @example Basic example
1261
+ # require "google/cloud/translate/v3"
1262
+ #
1263
+ # # Create a client object. The client can be reused for multiple calls.
1264
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
1265
+ #
1266
+ # # Create a request. To set request fields, pass in keyword arguments.
1267
+ # request = Google::Cloud::Translate::V3::GetGlossaryRequest.new
1268
+ #
1269
+ # # Call the get_glossary method.
1270
+ # result = client.get_glossary request
1271
+ #
1272
+ # # The returned object is of type Google::Cloud::Translate::V3::Glossary.
1273
+ # p result
1274
+ #
1096
1275
  def get_glossary request, options = nil
1097
1276
  raise ::ArgumentError, "request must be provided" if request.nil?
1098
1277
 
@@ -1110,9 +1289,11 @@ module Google
1110
1289
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
1111
1290
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1112
1291
 
1113
- header_params = {
1114
- "name" => request.name
1115
- }
1292
+ header_params = {}
1293
+ if request.name
1294
+ header_params["name"] = request.name
1295
+ end
1296
+
1116
1297
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1117
1298
  metadata[:"x-goog-request-params"] ||= request_params_header
1118
1299
 
@@ -1163,6 +1344,28 @@ module Google
1163
1344
  #
1164
1345
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1165
1346
  #
1347
+ # @example Basic example
1348
+ # require "google/cloud/translate/v3"
1349
+ #
1350
+ # # Create a client object. The client can be reused for multiple calls.
1351
+ # client = Google::Cloud::Translate::V3::TranslationService::Client.new
1352
+ #
1353
+ # # Create a request. To set request fields, pass in keyword arguments.
1354
+ # request = Google::Cloud::Translate::V3::DeleteGlossaryRequest.new
1355
+ #
1356
+ # # Call the delete_glossary method.
1357
+ # result = client.delete_glossary request
1358
+ #
1359
+ # # The returned object is of type Gapic::Operation. You can use this
1360
+ # # object to check the status of an operation, cancel it, or wait
1361
+ # # for results. Here is how to block until completion:
1362
+ # result.wait_until_done! timeout: 60
1363
+ # if result.response?
1364
+ # p result.response
1365
+ # else
1366
+ # puts "Error!"
1367
+ # end
1368
+ #
1166
1369
  def delete_glossary request, options = nil
1167
1370
  raise ::ArgumentError, "request must be provided" if request.nil?
1168
1371
 
@@ -1180,9 +1383,11 @@ module Google
1180
1383
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
1181
1384
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1182
1385
 
1183
- header_params = {
1184
- "name" => request.name
1185
- }
1386
+ header_params = {}
1387
+ if request.name
1388
+ header_params["name"] = request.name
1389
+ end
1390
+
1186
1391
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1187
1392
  metadata[:"x-goog-request-params"] ||= request_params_header
1188
1393
 
@@ -95,6 +95,9 @@ module Google
95
95
  channel_args: @config.channel_args,
96
96
  interceptors: @config.interceptors
97
97
  )
98
+
99
+ # Used by an LRO wrapper for some methods of this service
100
+ @operations_client = self
98
101
  end
99
102
 
100
103
  # Service calls
@@ -143,6 +146,27 @@ module Google
143
146
  #
144
147
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
145
148
  #
149
+ # @example Basic example
150
+ # require "google/longrunning"
151
+ #
152
+ # # Create a client object. The client can be reused for multiple calls.
153
+ # client = Google::Longrunning::Operations::Client.new
154
+ #
155
+ # # Create a request. To set request fields, pass in keyword arguments.
156
+ # request = Google::Longrunning::ListOperationsRequest.new
157
+ #
158
+ # # Call the list_operations method.
159
+ # result = client.list_operations request
160
+ #
161
+ # # The returned object is of type Gapic::PagedEnumerable. You can
162
+ # # iterate over all elements by calling #each, and the enumerable
163
+ # # will lazily make API calls to fetch subsequent pages. Other
164
+ # # methods are also available for managing paging directly.
165
+ # result.each do |response|
166
+ # # Each element is of type ::Google::Longrunning::Operation.
167
+ # p response
168
+ # end
169
+ #
146
170
  def list_operations request, options = nil
147
171
  raise ::ArgumentError, "request must be provided" if request.nil?
148
172
 
@@ -160,9 +184,11 @@ module Google
160
184
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
161
185
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
162
186
 
163
- header_params = {
164
- "name" => request.name
165
- }
187
+ header_params = {}
188
+ if request.name
189
+ header_params["name"] = request.name
190
+ end
191
+
166
192
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
167
193
  metadata[:"x-goog-request-params"] ||= request_params_header
168
194
 
@@ -215,6 +241,28 @@ module Google
215
241
  #
216
242
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
217
243
  #
244
+ # @example Basic example
245
+ # require "google/longrunning"
246
+ #
247
+ # # Create a client object. The client can be reused for multiple calls.
248
+ # client = Google::Longrunning::Operations::Client.new
249
+ #
250
+ # # Create a request. To set request fields, pass in keyword arguments.
251
+ # request = Google::Longrunning::GetOperationRequest.new
252
+ #
253
+ # # Call the get_operation method.
254
+ # result = client.get_operation request
255
+ #
256
+ # # The returned object is of type Gapic::Operation. You can use this
257
+ # # object to check the status of an operation, cancel it, or wait
258
+ # # for results. Here is how to block until completion:
259
+ # result.wait_until_done! timeout: 60
260
+ # if result.response?
261
+ # p result.response
262
+ # else
263
+ # puts "Error!"
264
+ # end
265
+ #
218
266
  def get_operation request, options = nil
219
267
  raise ::ArgumentError, "request must be provided" if request.nil?
220
268
 
@@ -232,9 +280,11 @@ module Google
232
280
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
233
281
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
234
282
 
235
- header_params = {
236
- "name" => request.name
237
- }
283
+ header_params = {}
284
+ if request.name
285
+ header_params["name"] = request.name
286
+ end
287
+
238
288
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
239
289
  metadata[:"x-goog-request-params"] ||= request_params_header
240
290
 
@@ -287,6 +337,21 @@ module Google
287
337
  #
288
338
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
289
339
  #
340
+ # @example Basic example
341
+ # require "google/longrunning"
342
+ #
343
+ # # Create a client object. The client can be reused for multiple calls.
344
+ # client = Google::Longrunning::Operations::Client.new
345
+ #
346
+ # # Create a request. To set request fields, pass in keyword arguments.
347
+ # request = Google::Longrunning::DeleteOperationRequest.new
348
+ #
349
+ # # Call the delete_operation method.
350
+ # result = client.delete_operation request
351
+ #
352
+ # # The returned object is of type Google::Protobuf::Empty.
353
+ # p result
354
+ #
290
355
  def delete_operation request, options = nil
291
356
  raise ::ArgumentError, "request must be provided" if request.nil?
292
357
 
@@ -304,9 +369,11 @@ module Google
304
369
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
305
370
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
306
371
 
307
- header_params = {
308
- "name" => request.name
309
- }
372
+ header_params = {}
373
+ if request.name
374
+ header_params["name"] = request.name
375
+ end
376
+
310
377
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
311
378
  metadata[:"x-goog-request-params"] ||= request_params_header
312
379
 
@@ -364,6 +431,21 @@ module Google
364
431
  #
365
432
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
366
433
  #
434
+ # @example Basic example
435
+ # require "google/longrunning"
436
+ #
437
+ # # Create a client object. The client can be reused for multiple calls.
438
+ # client = Google::Longrunning::Operations::Client.new
439
+ #
440
+ # # Create a request. To set request fields, pass in keyword arguments.
441
+ # request = Google::Longrunning::CancelOperationRequest.new
442
+ #
443
+ # # Call the cancel_operation method.
444
+ # result = client.cancel_operation request
445
+ #
446
+ # # The returned object is of type Google::Protobuf::Empty.
447
+ # p result
448
+ #
367
449
  def cancel_operation request, options = nil
368
450
  raise ::ArgumentError, "request must be provided" if request.nil?
369
451
 
@@ -381,9 +463,11 @@ module Google
381
463
  gapic_version: ::Google::Cloud::Translate::V3::VERSION
382
464
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
383
465
 
384
- header_params = {
385
- "name" => request.name
386
- }
466
+ header_params = {}
467
+ if request.name
468
+ header_params["name"] = request.name
469
+ end
470
+
387
471
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
388
472
  metadata[:"x-goog-request-params"] ||= request_params_header
389
473
 
@@ -444,6 +528,28 @@ module Google
444
528
  #
445
529
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
446
530
  #
531
+ # @example Basic example
532
+ # require "google/longrunning"
533
+ #
534
+ # # Create a client object. The client can be reused for multiple calls.
535
+ # client = Google::Longrunning::Operations::Client.new
536
+ #
537
+ # # Create a request. To set request fields, pass in keyword arguments.
538
+ # request = Google::Longrunning::WaitOperationRequest.new
539
+ #
540
+ # # Call the wait_operation method.
541
+ # result = client.wait_operation request
542
+ #
543
+ # # The returned object is of type Gapic::Operation. You can use this
544
+ # # object to check the status of an operation, cancel it, or wait
545
+ # # for results. Here is how to block until completion:
546
+ # result.wait_until_done! timeout: 60
547
+ # if result.response?
548
+ # p result.response
549
+ # else
550
+ # puts "Error!"
551
+ # end
552
+ #
447
553
  def wait_operation request, options = nil
448
554
  raise ::ArgumentError, "request must be provided" if request.nil?
449
555
 
@@ -11,6 +11,7 @@ require 'google/longrunning/operations_pb'
11
11
  require 'google/protobuf/empty_pb'
12
12
  require 'google/protobuf/timestamp_pb'
13
13
  require 'google/rpc/status_pb'
14
+
14
15
  Google::Protobuf::DescriptorPool.generated_pool.build do
15
16
  add_file("google/cloud/translate/v3/translation_service.proto", :syntax => :proto3) do
16
17
  add_message "google.cloud.translation.v3.TranslateTextGlossaryConfig" do
@@ -29,7 +29,7 @@ module Google
29
29
  # Provides natural language translation operations.
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 Translate
23
23
  module V3
24
- VERSION = "0.4.0"
24
+ VERSION = "0.5.0"
25
25
  end
26
26
  end
27
27
  end
@@ -25,6 +25,8 @@ module Google
25
25
  ##
26
26
  # To load this package, including all its services, and instantiate a client:
27
27
  #
28
+ # @example
29
+ #
28
30
  # require "google/cloud/translate/v3"
29
31
  # client = ::Google::Cloud::Translate::V3::TranslationService::Client.new
30
32
  #
@@ -33,11 +33,7 @@ module Google
33
33
  # // For Kubernetes resources, the format is {api group}/{kind}.
34
34
  # option (google.api.resource) = {
35
35
  # type: "pubsub.googleapis.com/Topic"
36
- # name_descriptor: {
37
- # pattern: "projects/{project}/topics/{topic}"
38
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
39
- # parent_name_extractor: "projects/{project}"
40
- # }
36
+ # pattern: "projects/{project}/topics/{topic}"
41
37
  # };
42
38
  # }
43
39
  #
@@ -45,10 +41,7 @@ module Google
45
41
  #
46
42
  # resources:
47
43
  # - type: "pubsub.googleapis.com/Topic"
48
- # name_descriptor:
49
- # - pattern: "projects/{project}/topics/{topic}"
50
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
- # parent_name_extractor: "projects/{project}"
44
+ # pattern: "projects/{project}/topics/{topic}"
52
45
  #
53
46
  # Sometimes, resources have multiple patterns, typically because they can
54
47
  # live under multiple parents.
@@ -58,26 +51,10 @@ module Google
58
51
  # message LogEntry {
59
52
  # option (google.api.resource) = {
60
53
  # type: "logging.googleapis.com/LogEntry"
61
- # name_descriptor: {
62
- # pattern: "projects/{project}/logs/{log}"
63
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
64
- # parent_name_extractor: "projects/{project}"
65
- # }
66
- # name_descriptor: {
67
- # pattern: "folders/{folder}/logs/{log}"
68
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
69
- # parent_name_extractor: "folders/{folder}"
70
- # }
71
- # name_descriptor: {
72
- # pattern: "organizations/{organization}/logs/{log}"
73
- # parent_type: "cloudresourcemanager.googleapis.com/Organization"
74
- # parent_name_extractor: "organizations/{organization}"
75
- # }
76
- # name_descriptor: {
77
- # pattern: "billingAccounts/{billing_account}/logs/{log}"
78
- # parent_type: "billing.googleapis.com/BillingAccount"
79
- # parent_name_extractor: "billingAccounts/{billing_account}"
80
- # }
54
+ # pattern: "projects/{project}/logs/{log}"
55
+ # pattern: "folders/{folder}/logs/{log}"
56
+ # pattern: "organizations/{organization}/logs/{log}"
57
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
81
58
  # };
82
59
  # }
83
60
  #
@@ -85,48 +62,10 @@ module Google
85
62
  #
86
63
  # resources:
87
64
  # - type: 'logging.googleapis.com/LogEntry'
88
- # name_descriptor:
89
- # - pattern: "projects/{project}/logs/{log}"
90
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
91
- # parent_name_extractor: "projects/{project}"
92
- # - pattern: "folders/{folder}/logs/{log}"
93
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
94
- # parent_name_extractor: "folders/{folder}"
95
- # - pattern: "organizations/{organization}/logs/{log}"
96
- # parent_type: "cloudresourcemanager.googleapis.com/Organization"
97
- # parent_name_extractor: "organizations/{organization}"
98
- # - pattern: "billingAccounts/{billing_account}/logs/{log}"
99
- # parent_type: "billing.googleapis.com/BillingAccount"
100
- # parent_name_extractor: "billingAccounts/{billing_account}"
101
- #
102
- # For flexible resources, the resource name doesn't contain parent names, but
103
- # the resource itself has parents for policy evaluation.
104
- #
105
- # Example:
106
- #
107
- # message Shelf {
108
- # option (google.api.resource) = {
109
- # type: "library.googleapis.com/Shelf"
110
- # name_descriptor: {
111
- # pattern: "shelves/{shelf}"
112
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
113
- # }
114
- # name_descriptor: {
115
- # pattern: "shelves/{shelf}"
116
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
117
- # }
118
- # };
119
- # }
120
- #
121
- # The ResourceDescriptor Yaml config will look like:
122
- #
123
- # resources:
124
- # - type: 'library.googleapis.com/Shelf'
125
- # name_descriptor:
126
- # - pattern: "shelves/{shelf}"
127
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
128
- # - pattern: "shelves/{shelf}"
129
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
65
+ # pattern: "projects/{project}/logs/{log}"
66
+ # pattern: "folders/{folder}/logs/{log}"
67
+ # pattern: "organizations/{organization}/logs/{log}"
68
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
130
69
  # @!attribute [rw] type
131
70
  # @return [::String]
132
71
  # The resource type. It must be in the format of
@@ -44,7 +44,7 @@ module Google
44
44
  # foo = any.unpack(Foo.class);
45
45
  # }
46
46
  #
47
- # Example 3: Pack and unpack a message in Python.
47
+ # Example 3: Pack and unpack a message in Python.
48
48
  #
49
49
  # foo = Foo(...)
50
50
  # any = Any()
@@ -54,7 +54,7 @@ module Google
54
54
  # any.Unpack(foo)
55
55
  # ...
56
56
  #
57
- # Example 4: Pack and unpack a message in Go
57
+ # Example 4: Pack and unpack a message in Go
58
58
  #
59
59
  # foo := &pb.Foo{...}
60
60
  # any, err := anypb.New(foo)
@@ -75,7 +75,7 @@ module Google
75
75
  #
76
76
  #
77
77
  # JSON
78
- # ====
78
+ #
79
79
  # The JSON representation of an `Any` value uses the regular
80
80
  # representation of the deserialized, embedded message, with an
81
81
  # additional field `@type` which contains the type URL. Example:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-translate-v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
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-08-31 00:00:00.000000000 Z
11
+ date: 2022-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.7'
19
+ version: '0.10'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '0.7'
29
+ version: '0.10'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -50,28 +50,28 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 1.25.1
53
+ version: 1.26.1
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 1.25.1
60
+ version: 1.26.1
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: minitest
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '5.14'
67
+ version: '5.16'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '5.14'
74
+ version: '5.16'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: minitest-focus
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: '12.0'
109
+ version: '13.0'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: '12.0'
116
+ version: '13.0'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: redcarpet
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -202,14 +202,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
202
  requirements:
203
203
  - - ">="
204
204
  - !ruby/object:Gem::Version
205
- version: '2.5'
205
+ version: '2.6'
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
208
  - - ">="
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubygems_version: 3.2.17
212
+ rubygems_version: 3.3.14
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: API Client library for the Cloud Translation V3 API