Class: IBMWatson::CompareComplyV1

Inherits:
IBMCloudSdkCore::BaseService
  • Object
show all
Includes:
Concurrent::Async
Defined in:
lib/ibm_watson/compare_comply_v1.rb

Overview

The Compare Comply V1 service.

Constant Summary collapse

DEFAULT_SERVICE_NAME =
"compare_comply"
DEFAULT_SERVICE_URL =
"https://api.us-south.compare-comply.watson.cloud.ibm.com"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ CompareComplyV1

Construct a new client for the Compare Comply service.

Parameters:

  • args (Hash)

    The args to initialize with

Options Hash (args):

  • version (String)

    Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is ‘2018-10-15`.

  • service_url (String)

    The base service URL to use when contacting the service. The base service_url may differ between IBM Cloud regions.

  • authenticator (Object)

    The Authenticator instance to be configured for this service.

  • service_name (String)

    The name of the service to configure. Will be used as the key to load any external configuration, if applicable.

Raises:

  • (ArgumentError)


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/ibm_watson/compare_comply_v1.rb', line 56

def initialize(args = {})
  warn "On 30 November 2021, Compare and Comply will no longer be available. For more information, see https://github.com/watson-developer-cloud/ruby-sdk#compare-and-comply-deprecation."
  @__async_initialized__ = false
  defaults = {}
  defaults[:service_url] = DEFAULT_SERVICE_URL
  defaults[:service_name] = DEFAULT_SERVICE_NAME
  defaults[:authenticator] = nil
  defaults[:version] = nil
  user_service_url = args[:service_url] unless args[:service_url].nil?
  args = defaults.merge(args)
  @version = args[:version]
  raise ArgumentError.new("version must be provided") if @version.nil?

  args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
  super
  @service_url = user_service_url unless user_service_url.nil?
end

Instance Attribute Details

#versionObject

Returns the value of attribute version.



43
44
45
# File 'lib/ibm_watson/compare_comply_v1.rb', line 43

def version
  @version
end

Instance Method Details

#add_feedback(feedback_data: , user_id: nil, comment: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Add feedback. Adds feedback in the form of labels from a subject-matter expert (SME) to a

governing document.
**Important:** Feedback is not immediately incorporated into the training model,
nor is it guaranteed to be incorporated at a later date. Instead, submitted
feedback is used to suggest future updates to the training model.

Parameters:

  • feedback_data (FeedbackDataInput) (defaults to: )

    Feedback data for submission.

  • user_id (String) (defaults to: nil)

    An optional string identifying the user.

  • comment (String) (defaults to: nil)

    An optional comment on or description of the feedback.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/ibm_watson/compare_comply_v1.rb', line 299

def add_feedback(feedback_data:, user_id: nil, comment: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("feedback_data must be provided") if feedback_data.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "add_feedback")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version
  }

  data = {
    "feedback_data" => feedback_data,
    "user_id" => user_id,
    "comment" => comment
  }

  method_url = "/v1/feedback"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    params: params,
    json: data,
    accept_json: true
  )
  response
end

#classify_elements(file: , file_content_type: nil, model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Classify the elements of a document. Analyzes the structural and semantic elements of a document.

Parameters:

  • file (File) (defaults to: )

    The document to classify.

  • file_content_type (String) (defaults to: nil)

    The content type of file.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/ibm_watson/compare_comply_v1.rb', line 138

def classify_elements(file:, file_content_type: nil, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("file must be provided") if file.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "classify_elements")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "model" => model
  }

  form_data = {}

  unless file.instance_of?(StringIO) || file.instance_of?(File)
    file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
  end
  form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: file.respond_to?(:path) ? file.path : nil)

  method_url = "/v1/element_classification"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    params: params,
    form: form_data,
    accept_json: true
  )
  response
end

#compare_documents(file_1: , file_2: , file_1_content_type: nil, file_2_content_type: nil, file_1_label: nil, file_2_label: nil, model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Compare two documents. Compares two input documents. Documents must be in the same format.

Parameters:

  • file_1 (File) (defaults to: )

    The first document to compare.

  • file_2 (File) (defaults to: )

    The second document to compare.

  • file_1_content_type (String) (defaults to: nil)

    The content type of file_1.

  • file_2_content_type (String) (defaults to: nil)

    The content type of file_2.

  • file_1_label (String) (defaults to: nil)

    A text label for the first document.

  • file_2_label (String) (defaults to: nil)

    A text label for the second document.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/ibm_watson/compare_comply_v1.rb', line 240

def compare_documents(file_1:, file_2:, file_1_content_type: nil, file_2_content_type: nil, file_1_label: nil, file_2_label: nil, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("file_1 must be provided") if file_1.nil?

  raise ArgumentError.new("file_2 must be provided") if file_2.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "compare_documents")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "file_1_label" => file_1_label,
    "file_2_label" => file_2_label,
    "model" => model
  }

  form_data = {}

  unless file_1.instance_of?(StringIO) || file_1.instance_of?(File)
    file_1 = file_1.respond_to?(:to_json) ? StringIO.new(file_1.to_json) : StringIO.new(file_1)
  end
  form_data[:file_1] = HTTP::FormData::File.new(file_1, content_type: file_1_content_type.nil? ? "application/octet-stream" : file_1_content_type, filename: file_1.respond_to?(:path) ? file_1.path : nil)

  unless file_2.instance_of?(StringIO) || file_2.instance_of?(File)
    file_2 = file_2.respond_to?(:to_json) ? StringIO.new(file_2.to_json) : StringIO.new(file_2)
  end
  form_data[:file_2] = HTTP::FormData::File.new(file_2, content_type: file_2_content_type.nil? ? "application/octet-stream" : file_2_content_type, filename: file_2.respond_to?(:path) ? file_2.path : nil)

  method_url = "/v1/comparison"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    params: params,
    form: form_data,
    accept_json: true
  )
  response
end

#convert_to_html(file: , file_content_type: nil, model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Convert document to HTML. Converts a document to HTML.

Parameters:

  • file (File) (defaults to: )

    The document to convert.

  • file_content_type (String) (defaults to: nil)

    The content type of file.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/ibm_watson/compare_comply_v1.rb', line 89

def convert_to_html(file:, file_content_type: nil, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("file must be provided") if file.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "convert_to_html")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "model" => model
  }

  form_data = {}

  unless file.instance_of?(StringIO) || file.instance_of?(File)
    file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
  end
  form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: file.respond_to?(:path) ? file.path : nil)

  method_url = "/v1/html_conversion"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    params: params,
    form: form_data,
    accept_json: true
  )
  response
end

#create_batch(function: , input_credentials_file: , input_bucket_location: , input_bucket_name: , output_credentials_file: , output_bucket_location: , output_bucket_name: , model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Submit a batch-processing request. Run Compare and Comply methods over a collection of input documents.

**Important:** Batch processing requires the use of the [IBM Cloud Object Storage
service](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-about#about-ibm-cloud-object-storage).
The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using
batch
processing](https://cloud.ibm.com/docs/compare-comply?topic=compare-comply-batching#before-you-batch).

Parameters:

  • function (String) (defaults to: )

    The Compare and Comply method to run across the submitted input documents.

  • input_credentials_file (File) (defaults to: )

    A JSON file containing the input Cloud Object Storage credentials. At a minimum, the credentials must enable ‘READ` permissions on the bucket defined by the `input_bucket_name` parameter.

  • input_bucket_location (String) (defaults to: )

    The geographical location of the Cloud Object Storage input bucket as listed on the Endpoint tab of your Cloud Object Storage instance; for example, ‘us-geo`, `eu-geo`, or `ap-geo`.

  • input_bucket_name (String) (defaults to: )

    The name of the Cloud Object Storage input bucket.

  • output_credentials_file (File) (defaults to: )

    A JSON file that lists the Cloud Object Storage output credentials. At a minimum, the credentials must enable ‘READ` and `WRITE` permissions on the bucket defined by the `output_bucket_name` parameter.

  • output_bucket_location (String) (defaults to: )

    The geographical location of the Cloud Object Storage output bucket as listed on the Endpoint tab of your Cloud Object Storage instance; for example, ‘us-geo`, `eu-geo`, or `ap-geo`.

  • output_bucket_name (String) (defaults to: )

    The name of the Cloud Object Storage output bucket.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
# File 'lib/ibm_watson/compare_comply_v1.rb', line 519

def create_batch(function:, input_credentials_file:, input_bucket_location:, input_bucket_name:, output_credentials_file:, output_bucket_location:, output_bucket_name:, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("function must be provided") if function.nil?

  raise ArgumentError.new("input_credentials_file must be provided") if input_credentials_file.nil?

  raise ArgumentError.new("input_bucket_location must be provided") if input_bucket_location.nil?

  raise ArgumentError.new("input_bucket_name must be provided") if input_bucket_name.nil?

  raise ArgumentError.new("output_credentials_file must be provided") if output_credentials_file.nil?

  raise ArgumentError.new("output_bucket_location must be provided") if output_bucket_location.nil?

  raise ArgumentError.new("output_bucket_name must be provided") if output_bucket_name.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "create_batch")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "function" => function,
    "model" => model
  }

  form_data = {}

  unless input_credentials_file.instance_of?(StringIO) || input_credentials_file.instance_of?(File)
    input_credentials_file = input_credentials_file.respond_to?(:to_json) ? StringIO.new(input_credentials_file.to_json) : StringIO.new(input_credentials_file)
  end
  form_data[:input_credentials_file] = HTTP::FormData::File.new(input_credentials_file, content_type: "application/json", filename: input_credentials_file.respond_to?(:path) ? input_credentials_file.path : nil)

  form_data[:input_bucket_location] = HTTP::FormData::Part.new(input_bucket_location.to_s, content_type: "text/plain")

  form_data[:input_bucket_name] = HTTP::FormData::Part.new(input_bucket_name.to_s, content_type: "text/plain")

  unless output_credentials_file.instance_of?(StringIO) || output_credentials_file.instance_of?(File)
    output_credentials_file = output_credentials_file.respond_to?(:to_json) ? StringIO.new(output_credentials_file.to_json) : StringIO.new(output_credentials_file)
  end
  form_data[:output_credentials_file] = HTTP::FormData::File.new(output_credentials_file, content_type: "application/json", filename: output_credentials_file.respond_to?(:path) ? output_credentials_file.path : nil)

  form_data[:output_bucket_location] = HTTP::FormData::Part.new(output_bucket_location.to_s, content_type: "text/plain")

  form_data[:output_bucket_name] = HTTP::FormData::Part.new(output_bucket_name.to_s, content_type: "text/plain")

  method_url = "/v1/batches"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    params: params,
    form: form_data,
    accept_json: true
  )
  response
end

#delete_feedback(feedback_id: , model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Delete a specified feedback entry. Deletes a feedback entry with a specified ‘feedback_id`.

Parameters:

  • feedback_id (String) (defaults to: )

    A string that specifies the feedback entry to be deleted from the document.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
# File 'lib/ibm_watson/compare_comply_v1.rb', line 459

def delete_feedback(feedback_id:, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("feedback_id must be provided") if feedback_id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "delete_feedback")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "model" => model
  }

  method_url = "/v1/feedback/%s" % [ERB::Util.url_encode(feedback_id)]

  response = request(
    method: "DELETE",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#extract_tables(file: , file_content_type: nil, model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Extract a document’s tables. Analyzes the tables in a document.

Parameters:

  • file (File) (defaults to: )

    The document on which to run table extraction.

  • file_content_type (String) (defaults to: nil)

    The content type of file.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/ibm_watson/compare_comply_v1.rb', line 187

def extract_tables(file:, file_content_type: nil, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("file must be provided") if file.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "extract_tables")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "model" => model
  }

  form_data = {}

  unless file.instance_of?(StringIO) || file.instance_of?(File)
    file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
  end
  form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: file.respond_to?(:path) ? file.path : nil)

  method_url = "/v1/tables"

  response = request(
    method: "POST",
    url: method_url,
    headers: headers,
    params: params,
    form: form_data,
    accept_json: true
  )
  response
end

#get_batch(batch_id: ) ⇒ IBMCloudSdkCore::DetailedResponse

Get information about a specific batch-processing job. Gets information about a batch-processing job with a specified ID.

Parameters:

  • batch_id (String) (defaults to: )

    The ID of the batch-processing job whose information you want to retrieve.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
# File 'lib/ibm_watson/compare_comply_v1.rb', line 615

def get_batch(batch_id:)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("batch_id must be provided") if batch_id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "get_batch")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version
  }

  method_url = "/v1/batches/%s" % [ERB::Util.url_encode(batch_id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#get_feedback(feedback_id: , model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Get a specified feedback entry. Gets a feedback entry with a specified ‘feedback_id`.

Parameters:

  • feedback_id (String) (defaults to: )

    A string that specifies the feedback entry to be included in the output.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
# File 'lib/ibm_watson/compare_comply_v1.rb', line 422

def get_feedback(feedback_id:, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("feedback_id must be provided") if feedback_id.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "get_feedback")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "model" => model
  }

  method_url = "/v1/feedback/%s" % [ERB::Util.url_encode(feedback_id)]

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_batchesIBMCloudSdkCore::DetailedResponse

List submitted batch-processing jobs. Lists batch-processing jobs submitted by users.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
# File 'lib/ibm_watson/compare_comply_v1.rb', line 585

def list_batches
  raise ArgumentError.new("version must be provided") if version.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "list_batches")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version
  }

  method_url = "/v1/batches"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#list_feedback(feedback_type: nil, document_title: nil, model_id: nil, model_version: nil, category_removed: nil, category_added: nil, category_not_changed: nil, type_removed: nil, type_added: nil, type_not_changed: nil, page_limit: nil, cursor: nil, sort: nil, include_total: nil) ⇒ IBMCloudSdkCore::DetailedResponse

List the feedback in a document. Lists the feedback in a document.

Parameters:

  • feedback_type (String) (defaults to: nil)

    An optional string that filters the output to include only feedback with the specified feedback type. The only permitted value is ‘element_classification`.

  • document_title (String) (defaults to: nil)

    An optional string that filters the output to include only feedback from the document with the specified ‘document_title`.

  • model_id (String) (defaults to: nil)

    An optional string that filters the output to include only feedback with the specified ‘model_id`. The only permitted value is `contracts`.

  • model_version (String) (defaults to: nil)

    An optional string that filters the output to include only feedback with the specified ‘model_version`.

  • category_removed (String) (defaults to: nil)

    An optional string in the form of a comma-separated list of categories. If it is specified, the service filters the output to include only feedback that has at least one category from the list removed.

  • category_added (String) (defaults to: nil)

    An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list added.

  • category_not_changed (String) (defaults to: nil)

    An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list unchanged.

  • type_removed (String) (defaults to: nil)

    An optional string of comma-separated ‘nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list removed.

  • type_added (String) (defaults to: nil)

    An optional string of comma-separated ‘nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list removed.

  • type_not_changed (String) (defaults to: nil)

    An optional string of comma-separated ‘nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list unchanged.

  • page_limit (Fixnum) (defaults to: nil)

    An optional integer specifying the number of documents that you want the service to return.

  • cursor (String) (defaults to: nil)

    An optional string that returns the set of documents after the previous set. Use this parameter with the ‘page_limit` parameter.

  • sort (String) (defaults to: nil)

    An optional comma-separated list of fields in the document to sort on. You can optionally specify the sort direction by prefixing the value of the field with ‘-` for descending order or `+` for ascending order (the default). Currently permitted sorting fields are `created`, `user_id`, and `document_title`.

  • include_total (Boolean) (defaults to: nil)

    An optional boolean value. If specified as ‘true`, the `pagination` object in the output includes a value called `total` that gives the total count of feedback created.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/ibm_watson/compare_comply_v1.rb', line 374

def list_feedback(feedback_type: nil, document_title: nil, model_id: nil, model_version: nil, category_removed: nil, category_added: nil, category_not_changed: nil, type_removed: nil, type_added: nil, type_not_changed: nil, page_limit: nil, cursor: nil, sort: nil, include_total: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "list_feedback")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "feedback_type" => feedback_type,
    "document_title" => document_title,
    "model_id" => model_id,
    "model_version" => model_version,
    "category_removed" => category_removed,
    "category_added" => category_added,
    "category_not_changed" => category_not_changed,
    "type_removed" => type_removed,
    "type_added" => type_added,
    "type_not_changed" => type_not_changed,
    "page_limit" => page_limit,
    "cursor" => cursor,
    "sort" => sort,
    "include_total" => include_total
  }

  method_url = "/v1/feedback"

  response = request(
    method: "GET",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end

#update_batch(batch_id: , action: , model: nil) ⇒ IBMCloudSdkCore::DetailedResponse

Update a pending or active batch-processing job. Updates a pending or active batch-processing job. You can rescan the input bucket

to check for new documents or cancel a job.

Parameters:

  • batch_id (String) (defaults to: )

    The ID of the batch-processing job you want to update.

  • action (String) (defaults to: )

    The action you want to perform on the specified batch-processing job.

  • model (String) (defaults to: nil)

    The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is ‘contracts`. For the **Extract tables** method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods’ use in batch-processing requests.

Returns:

  • (IBMCloudSdkCore::DetailedResponse)

    A ‘IBMCloudSdkCore::DetailedResponse` object representing the response.

Raises:

  • (ArgumentError)


653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
# File 'lib/ibm_watson/compare_comply_v1.rb', line 653

def update_batch(batch_id:, action:, model: nil)
  raise ArgumentError.new("version must be provided") if version.nil?

  raise ArgumentError.new("batch_id must be provided") if batch_id.nil?

  raise ArgumentError.new("action must be provided") if action.nil?

  headers = {
  }
  sdk_headers = Common.new.get_sdk_headers("compare-comply", "V1", "update_batch")
  headers.merge!(sdk_headers)

  params = {
    "version" => @version,
    "action" => action,
    "model" => model
  }

  method_url = "/v1/batches/%s" % [ERB::Util.url_encode(batch_id)]

  response = request(
    method: "PUT",
    url: method_url,
    headers: headers,
    params: params,
    accept_json: true
  )
  response
end