google-cloud-document_ai-v1 0.1.0 → 0.2.3

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: e135a1c1d1705ed69b0cda0ee44b859ce86d67facf10cb46020c7a012af68661
4
- data.tar.gz: 9d70cee5408d9e65ffc99f3e1c172f5b2c7fcb55797f2ed581441a95e3ed3c7c
3
+ metadata.gz: 24fbe2305962ad733b73b86b892f2cc056719f9b15ae68448b51af84f6f8e41e
4
+ data.tar.gz: 5ec64c940d4f4cee643127bcbf8574a87bceeebf170e2e329c9ba9d2ad9c28d2
5
5
  SHA512:
6
- metadata.gz: 7e9ec87315d2863124668d05c73d639a7e9d46bec117e000940add79d2cacee62232b5f0b6d3a260f40f1e9b41bd173832591d45faaa2d611a269a62e0eaf94b
7
- data.tar.gz: bae847834df1ed702d5946ee13ad02638db8aba3418d59cd8058e099c15762ac866d9b78a338888b2403846e43bd485d2f2e6d3aafa37671e2e8138e5ba6fc3a
6
+ metadata.gz: e0b706410acad88a8670fcd63053426d20a3de05d4aa97d1e573c583262af4bbe6394df875c26bcbe0c7e0cfa4550cf96988db55b1acbf8def5e9ac2e5b7eb30
7
+ data.tar.gz: 69bedf13c4c6362ca21903f79eafc347420b2222931a545679ecac9351e9df6dbb0224b09ae5ae2e87147028dbdc1e319a017910e3ae25a66e5ffb9bb9252d57
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-document_ai-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Credentials}):
68
68
 
69
- 1. `DOCUMENT_AI_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `DOCUMENT_AI_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
+ * `DOCUMENT_AI_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `DOCUMENT_AI_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/document_ai/v1"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::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/document_ai/v1"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new d
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/document_ai/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/document_ai/v1"
34
34
 
35
35
  client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::DocumentAI::V1::ProcessRequest.new # (request fields as keyword arguments...)
37
37
  response = client.process_document request
38
38
  ```
39
39
 
@@ -44,13 +44,12 @@ module Google
44
44
  # See {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client::Configuration}
45
45
  # for a description of the configuration fields.
46
46
  #
47
- # ## Example
47
+ # @example
48
48
  #
49
- # To modify the configuration for all DocumentProcessorService clients:
50
- #
51
- # ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.configure do |config|
52
- # config.timeout = 10.0
53
- # end
49
+ # # Modify the configuration for all DocumentProcessorService clients
50
+ # ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
54
53
  #
55
54
  # @yield [config] Configure the Client client.
56
55
  # @yieldparam config [Client::Configuration]
@@ -70,26 +69,17 @@ module Google
70
69
 
71
70
  default_config.rpcs.process_document.timeout = 120.0
72
71
  default_config.rpcs.process_document.retry_policy = {
73
- initial_delay: 0.1,
74
- max_delay: 60.0,
75
- multiplier: 1.3,
76
- retry_codes: [4, 14]
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
77
73
  }
78
74
 
79
75
  default_config.rpcs.batch_process_documents.timeout = 120.0
80
76
  default_config.rpcs.batch_process_documents.retry_policy = {
81
- initial_delay: 0.1,
82
- max_delay: 60.0,
83
- multiplier: 1.3,
84
- retry_codes: [4, 14]
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
85
78
  }
86
79
 
87
80
  default_config.rpcs.review_document.timeout = 120.0
88
81
  default_config.rpcs.review_document.retry_policy = {
89
- initial_delay: 0.1,
90
- max_delay: 60.0,
91
- multiplier: 1.3,
92
- retry_codes: [4, 14]
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
93
83
  }
94
84
 
95
85
  default_config
@@ -121,19 +111,15 @@ module Google
121
111
  ##
122
112
  # Create a new DocumentProcessorService client object.
123
113
  #
124
- # ## Examples
125
- #
126
- # To create a new DocumentProcessorService client with the default
127
- # configuration:
114
+ # @example
128
115
  #
129
- # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
116
+ # # Create a client using the default configuration
117
+ # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
130
118
  #
131
- # To create a new DocumentProcessorService client with a custom
132
- # configuration:
133
- #
134
- # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new do |config|
135
- # config.timeout = 10.0
136
- # end
119
+ # # Create a client using a custom configuration
120
+ # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new do |config|
121
+ # config.timeout = 10.0
122
+ # end
137
123
  #
138
124
  # @yield [config] Configure the DocumentProcessorService client.
139
125
  # @yieldparam config [Client::Configuration]
@@ -153,14 +139,13 @@ module Google
153
139
 
154
140
  # Create credentials
155
141
  credentials = @config.credentials
156
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
157
143
  # but only if the default endpoint does not have a region prefix.
158
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
159
- @config.endpoint == Client.configure.endpoint &&
144
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
160
145
  !@config.endpoint.split(".").first.include?("-")
161
146
  credentials ||= Credentials.default scope: @config.scope,
162
147
  enable_self_signed_jwt: enable_self_signed_jwt
163
- if credentials.is_a?(String) || credentials.is_a?(Hash)
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
164
149
  credentials = Credentials.new credentials, scope: @config.scope
165
150
  end
166
151
  @quota_project_id = @config.quota_project
@@ -225,6 +210,21 @@ module Google
225
210
  #
226
211
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
227
212
  #
213
+ # @example Basic example
214
+ # require "google/cloud/document_ai/v1"
215
+ #
216
+ # # Create a client object. The client can be reused for multiple calls.
217
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
218
+ #
219
+ # # Create a request. To set request fields, pass in keyword arguments.
220
+ # request = Google::Cloud::DocumentAI::V1::ProcessRequest.new
221
+ #
222
+ # # Call the process_document method.
223
+ # result = client.process_document request
224
+ #
225
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::ProcessResponse.
226
+ # p result
227
+ #
228
228
  def process_document request, options = nil
229
229
  raise ::ArgumentError, "request must be provided" if request.nil?
230
230
 
@@ -242,16 +242,20 @@ module Google
242
242
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
243
243
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
244
244
 
245
- header_params = {
246
- "name" => request.name
247
- }
245
+ header_params = {}
246
+ if request.name
247
+ header_params["name"] = request.name
248
+ end
249
+
248
250
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
249
251
  metadata[:"x-goog-request-params"] ||= request_params_header
250
252
 
251
253
  options.apply_defaults timeout: @config.rpcs.process_document.timeout,
252
254
  metadata: metadata,
253
255
  retry_policy: @config.rpcs.process_document.retry_policy
254
- options.apply_defaults metadata: @config.metadata,
256
+
257
+ options.apply_defaults timeout: @config.timeout,
258
+ metadata: @config.metadata,
255
259
  retry_policy: @config.retry_policy
256
260
 
257
261
  @document_processor_service_stub.call_rpc :process_document, request, options: options do |response, operation|
@@ -299,6 +303,28 @@ module Google
299
303
  #
300
304
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
301
305
  #
306
+ # @example Basic example
307
+ # require "google/cloud/document_ai/v1"
308
+ #
309
+ # # Create a client object. The client can be reused for multiple calls.
310
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
311
+ #
312
+ # # Create a request. To set request fields, pass in keyword arguments.
313
+ # request = Google::Cloud::DocumentAI::V1::BatchProcessRequest.new
314
+ #
315
+ # # Call the batch_process_documents method.
316
+ # result = client.batch_process_documents request
317
+ #
318
+ # # The returned object is of type Gapic::Operation. You can use this
319
+ # # object to check the status of an operation, cancel it, or wait
320
+ # # for results. Here is how to block until completion:
321
+ # result.wait_until_done! timeout: 60
322
+ # if result.response?
323
+ # p result.response
324
+ # else
325
+ # puts "Error!"
326
+ # end
327
+ #
302
328
  def batch_process_documents request, options = nil
303
329
  raise ::ArgumentError, "request must be provided" if request.nil?
304
330
 
@@ -316,16 +342,20 @@ module Google
316
342
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
317
343
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
318
344
 
319
- header_params = {
320
- "name" => request.name
321
- }
345
+ header_params = {}
346
+ if request.name
347
+ header_params["name"] = request.name
348
+ end
349
+
322
350
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
323
351
  metadata[:"x-goog-request-params"] ||= request_params_header
324
352
 
325
353
  options.apply_defaults timeout: @config.rpcs.batch_process_documents.timeout,
326
354
  metadata: metadata,
327
355
  retry_policy: @config.rpcs.batch_process_documents.retry_policy
328
- options.apply_defaults metadata: @config.metadata,
356
+
357
+ options.apply_defaults timeout: @config.timeout,
358
+ metadata: @config.metadata,
329
359
  retry_policy: @config.retry_policy
330
360
 
331
361
  @document_processor_service_stub.call_rpc :batch_process_documents, request, options: options do |response, operation|
@@ -351,7 +381,7 @@ module Google
351
381
  # @param options [::Gapic::CallOptions, ::Hash]
352
382
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
353
383
  #
354
- # @overload review_document(inline_document: nil, human_review_config: nil)
384
+ # @overload review_document(inline_document: nil, human_review_config: nil, enable_schema_validation: nil, priority: nil)
355
385
  # Pass arguments to `review_document` via keyword arguments. Note that at
356
386
  # least one keyword argument is required. To specify no parameters, or to keep all
357
387
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -361,6 +391,10 @@ module Google
361
391
  # @param human_review_config [::String]
362
392
  # Required. The resource name of the HumanReviewConfig that the document will be
363
393
  # reviewed with.
394
+ # @param enable_schema_validation [::Boolean]
395
+ # Whether the validation should be performed on the ad-hoc review request.
396
+ # @param priority [::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest::Priority]
397
+ # The priority of the human review task.
364
398
  #
365
399
  # @yield [response, operation] Access the result along with the RPC operation
366
400
  # @yieldparam response [::Gapic::Operation]
@@ -370,6 +404,28 @@ module Google
370
404
  #
371
405
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
372
406
  #
407
+ # @example Basic example
408
+ # require "google/cloud/document_ai/v1"
409
+ #
410
+ # # Create a client object. The client can be reused for multiple calls.
411
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
412
+ #
413
+ # # Create a request. To set request fields, pass in keyword arguments.
414
+ # request = Google::Cloud::DocumentAI::V1::ReviewDocumentRequest.new
415
+ #
416
+ # # Call the review_document method.
417
+ # result = client.review_document request
418
+ #
419
+ # # The returned object is of type Gapic::Operation. You can use this
420
+ # # object to check the status of an operation, cancel it, or wait
421
+ # # for results. Here is how to block until completion:
422
+ # result.wait_until_done! timeout: 60
423
+ # if result.response?
424
+ # p result.response
425
+ # else
426
+ # puts "Error!"
427
+ # end
428
+ #
373
429
  def review_document request, options = nil
374
430
  raise ::ArgumentError, "request must be provided" if request.nil?
375
431
 
@@ -387,16 +443,20 @@ module Google
387
443
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
388
444
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
389
445
 
390
- header_params = {
391
- "human_review_config" => request.human_review_config
392
- }
446
+ header_params = {}
447
+ if request.human_review_config
448
+ header_params["human_review_config"] = request.human_review_config
449
+ end
450
+
393
451
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
394
452
  metadata[:"x-goog-request-params"] ||= request_params_header
395
453
 
396
454
  options.apply_defaults timeout: @config.rpcs.review_document.timeout,
397
455
  metadata: metadata,
398
456
  retry_policy: @config.rpcs.review_document.retry_policy
399
- options.apply_defaults metadata: @config.metadata,
457
+
458
+ options.apply_defaults timeout: @config.timeout,
459
+ metadata: @config.metadata,
400
460
  retry_policy: @config.retry_policy
401
461
 
402
462
  @document_processor_service_stub.call_rpc :review_document, request, options: options do |response, operation|
@@ -421,22 +481,21 @@ module Google
421
481
  # Configuration can be applied globally to all clients, or to a single client
422
482
  # on construction.
423
483
  #
424
- # # Examples
425
- #
426
- # To modify the global config, setting the timeout for process_document
427
- # to 20 seconds, and all remaining timeouts to 10 seconds:
428
- #
429
- # ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.configure do |config|
430
- # config.timeout = 10.0
431
- # config.rpcs.process_document.timeout = 20.0
432
- # end
433
- #
434
- # To apply the above configuration only to a new client:
435
- #
436
- # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new do |config|
437
- # config.timeout = 10.0
438
- # config.rpcs.process_document.timeout = 20.0
439
- # end
484
+ # @example
485
+ #
486
+ # # Modify the global config, setting the timeout for
487
+ # # process_document to 20 seconds,
488
+ # # and all remaining timeouts to 10 seconds.
489
+ # ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.configure do |config|
490
+ # config.timeout = 10.0
491
+ # config.rpcs.process_document.timeout = 20.0
492
+ # end
493
+ #
494
+ # # Apply the above configuration only to a new client.
495
+ # client = ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new do |config|
496
+ # config.timeout = 10.0
497
+ # config.rpcs.process_document.timeout = 20.0
498
+ # end
440
499
  #
441
500
  # @!attribute [rw] endpoint
442
501
  # The hostname or hostname:port of the service endpoint.
@@ -82,7 +82,7 @@ module Google
82
82
  # Create credentials
83
83
  credentials = @config.credentials
84
84
  credentials ||= Credentials.default scope: @config.scope
85
- if credentials.is_a?(String) || credentials.is_a?(Hash)
85
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
86
86
  credentials = Credentials.new credentials, scope: @config.scope
87
87
  end
88
88
  @quota_project_id = @config.quota_project
@@ -143,6 +143,27 @@ module Google
143
143
  #
144
144
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
145
145
  #
146
+ # @example Basic example
147
+ # require "google/longrunning"
148
+ #
149
+ # # Create a client object. The client can be reused for multiple calls.
150
+ # client = Google::Longrunning::Operations::Client.new
151
+ #
152
+ # # Create a request. To set request fields, pass in keyword arguments.
153
+ # request = Google::Longrunning::ListOperationsRequest.new
154
+ #
155
+ # # Call the list_operations method.
156
+ # result = client.list_operations request
157
+ #
158
+ # # The returned object is of type Gapic::PagedEnumerable. You can
159
+ # # iterate over all elements by calling #each, and the enumerable
160
+ # # will lazily make API calls to fetch subsequent pages. Other
161
+ # # methods are also available for managing paging directly.
162
+ # result.each do |response|
163
+ # # Each element is of type ::Google::Longrunning::Operation.
164
+ # p response
165
+ # end
166
+ #
146
167
  def list_operations request, options = nil
147
168
  raise ::ArgumentError, "request must be provided" if request.nil?
148
169
 
@@ -160,16 +181,20 @@ module Google
160
181
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
161
182
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
162
183
 
163
- header_params = {
164
- "name" => request.name
165
- }
184
+ header_params = {}
185
+ if request.name
186
+ header_params["name"] = request.name
187
+ end
188
+
166
189
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
167
190
  metadata[:"x-goog-request-params"] ||= request_params_header
168
191
 
169
192
  options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
170
193
  metadata: metadata,
171
194
  retry_policy: @config.rpcs.list_operations.retry_policy
172
- options.apply_defaults metadata: @config.metadata,
195
+
196
+ options.apply_defaults timeout: @config.timeout,
197
+ metadata: @config.metadata,
173
198
  retry_policy: @config.retry_policy
174
199
 
175
200
  @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
@@ -213,6 +238,28 @@ module Google
213
238
  #
214
239
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
215
240
  #
241
+ # @example Basic example
242
+ # require "google/longrunning"
243
+ #
244
+ # # Create a client object. The client can be reused for multiple calls.
245
+ # client = Google::Longrunning::Operations::Client.new
246
+ #
247
+ # # Create a request. To set request fields, pass in keyword arguments.
248
+ # request = Google::Longrunning::GetOperationRequest.new
249
+ #
250
+ # # Call the get_operation method.
251
+ # result = client.get_operation request
252
+ #
253
+ # # The returned object is of type Gapic::Operation. You can use this
254
+ # # object to check the status of an operation, cancel it, or wait
255
+ # # for results. Here is how to block until completion:
256
+ # result.wait_until_done! timeout: 60
257
+ # if result.response?
258
+ # p result.response
259
+ # else
260
+ # puts "Error!"
261
+ # end
262
+ #
216
263
  def get_operation request, options = nil
217
264
  raise ::ArgumentError, "request must be provided" if request.nil?
218
265
 
@@ -230,16 +277,20 @@ module Google
230
277
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
231
278
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
232
279
 
233
- header_params = {
234
- "name" => request.name
235
- }
280
+ header_params = {}
281
+ if request.name
282
+ header_params["name"] = request.name
283
+ end
284
+
236
285
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
237
286
  metadata[:"x-goog-request-params"] ||= request_params_header
238
287
 
239
288
  options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
240
289
  metadata: metadata,
241
290
  retry_policy: @config.rpcs.get_operation.retry_policy
242
- options.apply_defaults metadata: @config.metadata,
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
243
294
  retry_policy: @config.retry_policy
244
295
 
245
296
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
@@ -283,6 +334,21 @@ module Google
283
334
  #
284
335
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
285
336
  #
337
+ # @example Basic example
338
+ # require "google/longrunning"
339
+ #
340
+ # # Create a client object. The client can be reused for multiple calls.
341
+ # client = Google::Longrunning::Operations::Client.new
342
+ #
343
+ # # Create a request. To set request fields, pass in keyword arguments.
344
+ # request = Google::Longrunning::DeleteOperationRequest.new
345
+ #
346
+ # # Call the delete_operation method.
347
+ # result = client.delete_operation request
348
+ #
349
+ # # The returned object is of type Google::Protobuf::Empty.
350
+ # p result
351
+ #
286
352
  def delete_operation request, options = nil
287
353
  raise ::ArgumentError, "request must be provided" if request.nil?
288
354
 
@@ -300,16 +366,20 @@ module Google
300
366
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
301
367
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
302
368
 
303
- header_params = {
304
- "name" => request.name
305
- }
369
+ header_params = {}
370
+ if request.name
371
+ header_params["name"] = request.name
372
+ end
373
+
306
374
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
307
375
  metadata[:"x-goog-request-params"] ||= request_params_header
308
376
 
309
377
  options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
310
378
  metadata: metadata,
311
379
  retry_policy: @config.rpcs.delete_operation.retry_policy
312
- options.apply_defaults metadata: @config.metadata,
380
+
381
+ options.apply_defaults timeout: @config.timeout,
382
+ metadata: @config.metadata,
313
383
  retry_policy: @config.retry_policy
314
384
 
315
385
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
@@ -358,6 +428,21 @@ module Google
358
428
  #
359
429
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
360
430
  #
431
+ # @example Basic example
432
+ # require "google/longrunning"
433
+ #
434
+ # # Create a client object. The client can be reused for multiple calls.
435
+ # client = Google::Longrunning::Operations::Client.new
436
+ #
437
+ # # Create a request. To set request fields, pass in keyword arguments.
438
+ # request = Google::Longrunning::CancelOperationRequest.new
439
+ #
440
+ # # Call the cancel_operation method.
441
+ # result = client.cancel_operation request
442
+ #
443
+ # # The returned object is of type Google::Protobuf::Empty.
444
+ # p result
445
+ #
361
446
  def cancel_operation request, options = nil
362
447
  raise ::ArgumentError, "request must be provided" if request.nil?
363
448
 
@@ -375,16 +460,20 @@ module Google
375
460
  gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
376
461
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
377
462
 
378
- header_params = {
379
- "name" => request.name
380
- }
463
+ header_params = {}
464
+ if request.name
465
+ header_params["name"] = request.name
466
+ end
467
+
381
468
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
382
469
  metadata[:"x-goog-request-params"] ||= request_params_header
383
470
 
384
471
  options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
385
472
  metadata: metadata,
386
473
  retry_policy: @config.rpcs.cancel_operation.retry_policy
387
- options.apply_defaults metadata: @config.metadata,
474
+
475
+ options.apply_defaults timeout: @config.timeout,
476
+ metadata: @config.metadata,
388
477
  retry_policy: @config.retry_policy
389
478
 
390
479
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
@@ -436,6 +525,28 @@ module Google
436
525
  #
437
526
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
438
527
  #
528
+ # @example Basic example
529
+ # require "google/longrunning"
530
+ #
531
+ # # Create a client object. The client can be reused for multiple calls.
532
+ # client = Google::Longrunning::Operations::Client.new
533
+ #
534
+ # # Create a request. To set request fields, pass in keyword arguments.
535
+ # request = Google::Longrunning::WaitOperationRequest.new
536
+ #
537
+ # # Call the wait_operation method.
538
+ # result = client.wait_operation request
539
+ #
540
+ # # The returned object is of type Gapic::Operation. You can use this
541
+ # # object to check the status of an operation, cancel it, or wait
542
+ # # for results. Here is how to block until completion:
543
+ # result.wait_until_done! timeout: 60
544
+ # if result.response?
545
+ # p result.response
546
+ # else
547
+ # puts "Error!"
548
+ # end
549
+ #
439
550
  def wait_operation request, options = nil
440
551
  raise ::ArgumentError, "request must be provided" if request.nil?
441
552
 
@@ -456,7 +567,9 @@ module Google
456
567
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
457
568
  metadata: metadata,
458
569
  retry_policy: @config.rpcs.wait_operation.retry_policy
459
- options.apply_defaults metadata: @config.metadata,
570
+
571
+ options.apply_defaults timeout: @config.timeout,
572
+ metadata: @config.metadata,
460
573
  retry_policy: @config.retry_policy
461
574
 
462
575
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
@@ -481,22 +594,21 @@ module Google
481
594
  # Configuration can be applied globally to all clients, or to a single client
482
595
  # on construction.
483
596
  #
484
- # # Examples
485
- #
486
- # To modify the global config, setting the timeout for list_operations
487
- # to 20 seconds, and all remaining timeouts to 10 seconds:
488
- #
489
- # ::Google::Longrunning::Operations::Client.configure do |config|
490
- # config.timeout = 10.0
491
- # config.rpcs.list_operations.timeout = 20.0
492
- # end
493
- #
494
- # To apply the above configuration only to a new client:
495
- #
496
- # client = ::Google::Longrunning::Operations::Client.new do |config|
497
- # config.timeout = 10.0
498
- # config.rpcs.list_operations.timeout = 20.0
499
- # end
597
+ # @example
598
+ #
599
+ # # Modify the global config, setting the timeout for
600
+ # # list_operations to 20 seconds,
601
+ # # and all remaining timeouts to 10 seconds.
602
+ # ::Google::Longrunning::Operations::Client.configure do |config|
603
+ # config.timeout = 10.0
604
+ # config.rpcs.list_operations.timeout = 20.0
605
+ # end
606
+ #
607
+ # # Apply the above configuration only to a new client.
608
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
609
+ # config.timeout = 10.0
610
+ # config.rpcs.list_operations.timeout = 20.0
611
+ # end
500
612
  #
501
613
  # @!attribute [rw] endpoint
502
614
  # The hostname or hostname:port of the service endpoint.
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module DocumentAI
23
23
  module V1
24
- VERSION = "0.1.0"
24
+ VERSION = "0.2.3"
25
25
  end
26
26
  end
27
27
  end
@@ -1,9 +1,9 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/documentai/v1/document_io.proto
3
3
 
4
+ require 'google/api/annotations_pb'
4
5
  require 'google/protobuf'
5
6
 
6
- require 'google/api/annotations_pb'
7
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
8
8
  add_file("google/cloud/documentai/v1/document_io.proto", :syntax => :proto3) do
9
9
  add_message "google.cloud.documentai.v1.RawDocument" do
@@ -1,8 +1,6 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/documentai/v1/document.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/api/field_behavior_pb'
7
5
  require 'google/cloud/documentai/v1/geometry_pb'
8
6
  require 'google/protobuf/timestamp_pb'
@@ -13,6 +11,8 @@ require 'google/type/datetime_pb'
13
11
  require 'google/type/money_pb'
14
12
  require 'google/type/postal_address_pb'
15
13
  require 'google/api/annotations_pb'
14
+ require 'google/protobuf'
15
+
16
16
  Google::Protobuf::DescriptorPool.generated_pool.build do
17
17
  add_file("google/cloud/documentai/v1/document.proto", :syntax => :proto3) do
18
18
  add_message "google.cloud.documentai.v1.Document" do
@@ -63,6 +63,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
63
63
  repeated :visual_elements, :message, 9, "google.cloud.documentai.v1.Document.Page.VisualElement"
64
64
  repeated :tables, :message, 10, "google.cloud.documentai.v1.Document.Page.Table"
65
65
  repeated :form_fields, :message, 11, "google.cloud.documentai.v1.Document.Page.FormField"
66
+ optional :provenance, :message, 16, "google.cloud.documentai.v1.Document.Provenance"
66
67
  end
67
68
  add_message "google.cloud.documentai.v1.Document.Page.Dimension" do
68
69
  optional :width, :float, 1
@@ -150,6 +151,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
150
151
  repeated :name_detected_languages, :message, 3, "google.cloud.documentai.v1.Document.Page.DetectedLanguage"
151
152
  repeated :value_detected_languages, :message, 4, "google.cloud.documentai.v1.Document.Page.DetectedLanguage"
152
153
  optional :value_type, :string, 5
154
+ optional :provenance, :message, 8, "google.cloud.documentai.v1.Document.Provenance"
153
155
  end
154
156
  add_message "google.cloud.documentai.v1.Document.Page.DetectedLanguage" do
155
157
  optional :language_code, :string, 1
@@ -219,6 +221,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
219
221
  end
220
222
  add_message "google.cloud.documentai.v1.Document.Provenance.Parent" do
221
223
  optional :revision, :int32, 1
224
+ optional :index, :int32, 3
222
225
  optional :id, :int32, 2
223
226
  end
224
227
  add_enum "google.cloud.documentai.v1.Document.Provenance.OperationType" do
@@ -1,8 +1,6 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/documentai/v1/document_processor_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'
@@ -14,6 +12,8 @@ require 'google/longrunning/operations_pb'
14
12
  require 'google/protobuf/field_mask_pb'
15
13
  require 'google/protobuf/timestamp_pb'
16
14
  require 'google/rpc/status_pb'
15
+ require 'google/protobuf'
16
+
17
17
  Google::Protobuf::DescriptorPool.generated_pool.build do
18
18
  add_file("google/cloud/documentai/v1/document_processor_service.proto", :syntax => :proto3) do
19
19
  add_message "google.cloud.documentai.v1.ProcessRequest" do
@@ -72,10 +72,16 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
72
72
  end
73
73
  add_message "google.cloud.documentai.v1.ReviewDocumentRequest" do
74
74
  optional :human_review_config, :string, 1
75
+ optional :enable_schema_validation, :bool, 3
76
+ optional :priority, :enum, 5, "google.cloud.documentai.v1.ReviewDocumentRequest.Priority"
75
77
  oneof :source do
76
78
  optional :inline_document, :message, 4, "google.cloud.documentai.v1.Document"
77
79
  end
78
80
  end
81
+ add_enum "google.cloud.documentai.v1.ReviewDocumentRequest.Priority" do
82
+ value :DEFAULT, 0
83
+ value :URGENT, 1
84
+ end
79
85
  add_message "google.cloud.documentai.v1.ReviewDocumentResponse" do
80
86
  optional :gcs_destination, :string, 1
81
87
  end
@@ -99,6 +105,7 @@ module Google
99
105
  BatchProcessMetadata::IndividualProcessStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus").msgclass
100
106
  BatchProcessMetadata::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.documentai.v1.BatchProcessMetadata.State").enummodule
101
107
  ReviewDocumentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.documentai.v1.ReviewDocumentRequest").msgclass
108
+ ReviewDocumentRequest::Priority = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.documentai.v1.ReviewDocumentRequest.Priority").enummodule
102
109
  ReviewDocumentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.documentai.v1.ReviewDocumentResponse").msgclass
103
110
  ReviewDocumentOperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.documentai.v1.ReviewDocumentOperationMetadata").msgclass
104
111
  end
@@ -30,7 +30,7 @@ module Google
30
30
  # structured information from unstructured or semi-structured documents.
31
31
  class Service
32
32
 
33
- include GRPC::GenericService
33
+ include ::GRPC::GenericService
34
34
 
35
35
  self.marshal_class_method = :encode
36
36
  self.unmarshal_class_method = :decode
@@ -1,9 +1,9 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/documentai/v1/geometry.proto
3
3
 
4
+ require 'google/api/annotations_pb'
4
5
  require 'google/protobuf'
5
6
 
6
- require 'google/api/annotations_pb'
7
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
8
8
  add_file("google/cloud/documentai/v1/geometry.proto", :syntax => :proto3) do
9
9
  add_message "google.cloud.documentai.v1.Vertex" do
@@ -1,10 +1,10 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/documentai/v1/operation_metadata.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/protobuf/timestamp_pb'
7
5
  require 'google/api/annotations_pb'
6
+ require 'google/protobuf'
7
+
8
8
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
9
  add_file("google/cloud/documentai/v1/operation_metadata.proto", :syntax => :proto3) do
10
10
  add_message "google.cloud.documentai.v1.CommonOperationMetadata" do
@@ -60,6 +60,12 @@ module Google
60
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
@@ -190,6 +190,9 @@ module Google
190
190
  # @!attribute [rw] form_fields
191
191
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Page::FormField>]
192
192
  # A list of visually detected form fields on the page.
193
+ # @!attribute [rw] provenance
194
+ # @return [::Google::Cloud::DocumentAI::V1::Document::Provenance]
195
+ # The history of this page.
193
196
  class Page
194
197
  include ::Google::Protobuf::MessageExts
195
198
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -461,6 +464,9 @@ module Google
461
464
  # - blank (this indicates the field_value is normal text)
462
465
  # - "unfilled_checkbox"
463
466
  # - "filled_checkbox"
467
+ # @!attribute [rw] provenance
468
+ # @return [::Google::Cloud::DocumentAI::V1::Document::Provenance]
469
+ # The history of this annotation.
464
470
  class FormField
465
471
  include ::Google::Protobuf::MessageExts
466
472
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -621,6 +627,8 @@ module Google
621
627
  # @return [::Integer]
622
628
  # Required. Index into the {::Google::Cloud::DocumentAI::V1::Document#pages Document.pages} element, for example using
623
629
  # [Document.pages][page_refs.page] to locate the related page element.
630
+ # This field is skipped when its value is the default 0. See
631
+ # https://developers.google.com/protocol-buffers/docs/proto3#json.
624
632
  # @!attribute [rw] layout_type
625
633
  # @return [::Google::Cloud::DocumentAI::V1::Document::PageAnchor::PageRef::LayoutType]
626
634
  # Optional. The type of the layout element that is being referenced if any.
@@ -691,6 +699,10 @@ module Google
691
699
  # @!attribute [rw] revision
692
700
  # @return [::Integer]
693
701
  # The index of the [Document.revisions] identifying the parent revision.
702
+ # @!attribute [rw] index
703
+ # @return [::Integer]
704
+ # The index of the parent revisions corresponding collection of items
705
+ # (eg. list of entities, properties within entities, etc.)
694
706
  # @!attribute [rw] id
695
707
  # @return [::Integer]
696
708
  # The id of the parent provenance.
@@ -193,9 +193,25 @@ module Google
193
193
  # @return [::String]
194
194
  # Required. The resource name of the HumanReviewConfig that the document will be
195
195
  # reviewed with.
196
+ # @!attribute [rw] enable_schema_validation
197
+ # @return [::Boolean]
198
+ # Whether the validation should be performed on the ad-hoc review request.
199
+ # @!attribute [rw] priority
200
+ # @return [::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest::Priority]
201
+ # The priority of the human review task.
196
202
  class ReviewDocumentRequest
197
203
  include ::Google::Protobuf::MessageExts
198
204
  extend ::Google::Protobuf::MessageExts::ClassMethods
205
+
206
+ # The priority level of the human review task.
207
+ module Priority
208
+ # The default priority level.
209
+ DEFAULT = 0
210
+
211
+ # The urgent priority level. The labeling manager should allocate labeler
212
+ # resource to the urgent task queue to respect this priority level.
213
+ URGENT = 1
214
+ end
199
215
  end
200
216
 
201
217
  # Response message for review document method.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-document_ai-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.3
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-06-21 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
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.7'
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.5'
29
+ version: '0.7'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a