ibm_watson 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,16 +21,15 @@
21
21
  require "concurrent"
22
22
  require "erb"
23
23
  require "json"
24
- require_relative "./detailed_response"
25
- require_relative "./common.rb"
26
24
 
27
- require_relative "./watson_service"
25
+ require "ibm_cloud_sdk_core"
26
+ require_relative "./common.rb"
28
27
 
29
28
  # Module for the Watson APIs
30
29
  module IBMWatson
31
30
  ##
32
31
  # The Assistant V2 service.
33
- class AssistantV2 < WatsonService
32
+ class AssistantV2 < IBMCloudSdkCore::BaseService
34
33
  include Concurrent::Async
35
34
  ##
36
35
  # @!method initialize(args)
@@ -101,13 +100,13 @@ module IBMWatson
101
100
  # [documentation](https://console.bluemix.net/docs/services/assistant/create-assistant.html#creating-assistants).
102
101
  #
103
102
  # **Note:** Currently, the v2 API does not support creating assistants.
104
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
103
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
105
104
  def create_session(assistant_id:)
106
105
  raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
107
106
 
108
107
  headers = {
109
108
  }
110
- headers = Common.new.get_default_headers(headers: headers, service_name: "conversation", service_version: "V2", operation_id: "create_session")
109
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "conversation", service_version: "V2", operation_id: "create_session")
111
110
 
112
111
  params = {
113
112
  "version" => @version
@@ -144,7 +143,7 @@ module IBMWatson
144
143
 
145
144
  headers = {
146
145
  }
147
- headers = Common.new.get_default_headers(headers: headers, service_name: "conversation", service_version: "V2", operation_id: "delete_session")
146
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "conversation", service_version: "V2", operation_id: "delete_session")
148
147
 
149
148
  params = {
150
149
  "version" => @version
@@ -180,7 +179,7 @@ module IBMWatson
180
179
  # @param session_id [String] Unique identifier of the session.
181
180
  # @param input [MessageInput] An input object that includes the input text.
182
181
  # @param context [MessageContext] State information for the conversation.
183
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
182
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
184
183
  def message(assistant_id:, session_id:, input: nil, context: nil)
185
184
  raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
186
185
 
@@ -188,7 +187,7 @@ module IBMWatson
188
187
 
189
188
  headers = {
190
189
  }
191
- headers = Common.new.get_default_headers(headers: headers, service_name: "conversation", service_version: "V2", operation_id: "message")
190
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "conversation", service_version: "V2", operation_id: "message")
192
191
 
193
192
  params = {
194
193
  "version" => @version
@@ -5,7 +5,7 @@ module IBMWatson
5
5
  class Common
6
6
  def initialize(*); end
7
7
 
8
- def get_default_headers(headers: {}, service_name: nil, service_version: nil, operation_id: nil)
8
+ def get_sdk_headers(headers: {}, service_name: nil, service_version: nil, operation_id: nil)
9
9
  user_agent_string = "watson-apis-ruby-sdk-" + IBMWatson::VERSION + " #{RbConfig::CONFIG["host"]}"
10
10
  user_agent_string += " #{RbConfig::CONFIG["RUBY_BASE_NAME"]}-#{RbConfig::CONFIG["RUBY_PROGRAM_VERSION"]}"
11
11
 
@@ -20,16 +20,15 @@
20
20
  require "concurrent"
21
21
  require "erb"
22
22
  require "json"
23
- require_relative "./detailed_response"
24
- require_relative "./common.rb"
25
23
 
26
- require_relative "./watson_service"
24
+ require "ibm_cloud_sdk_core"
25
+ require_relative "./common.rb"
27
26
 
28
27
  # Module for the Watson APIs
29
28
  module IBMWatson
30
29
  ##
31
30
  # The Compare Comply V1 service.
32
- class CompareComplyV1 < WatsonService
31
+ class CompareComplyV1 < IBMCloudSdkCore::BaseService
33
32
  include Concurrent::Async
34
33
  ##
35
34
  # @!method initialize(args)
@@ -88,13 +87,13 @@ module IBMWatson
88
87
  # well as to the methods' use in batch-processing requests.
89
88
  # @param file_content_type [String] The content type of file.
90
89
  # @param filename [String] The filename for file.
91
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
90
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
92
91
  def convert_to_html(file:, model_id: nil, file_content_type: nil, filename: nil)
93
92
  raise ArgumentError.new("file must be provided") if file.nil?
94
93
 
95
94
  headers = {
96
95
  }
97
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "convert_to_html")
96
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "convert_to_html")
98
97
 
99
98
  params = {
100
99
  "version" => @version,
@@ -136,13 +135,13 @@ module IBMWatson
136
135
  # well as to the methods' use in batch-processing requests.
137
136
  # @param file_content_type [String] The content type of file.
138
137
  # @param filename [String] The filename for file.
139
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
138
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
140
139
  def classify_elements(file:, model_id: nil, file_content_type: nil, filename: nil)
141
140
  raise ArgumentError.new("file must be provided") if file.nil?
142
141
 
143
142
  headers = {
144
143
  }
145
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "classify_elements")
144
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "classify_elements")
146
145
 
147
146
  params = {
148
147
  "version" => @version,
@@ -184,13 +183,13 @@ module IBMWatson
184
183
  # well as to the methods' use in batch-processing requests.
185
184
  # @param file_content_type [String] The content type of file.
186
185
  # @param filename [String] The filename for file.
187
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
186
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
188
187
  def extract_tables(file:, model_id: nil, file_content_type: nil, filename: nil)
189
188
  raise ArgumentError.new("file must be provided") if file.nil?
190
189
 
191
190
  headers = {
192
191
  }
193
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "extract_tables")
192
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "extract_tables")
194
193
 
195
194
  params = {
196
195
  "version" => @version,
@@ -237,7 +236,7 @@ module IBMWatson
237
236
  # @param file_1_filename [String] The filename for file_1.
238
237
  # @param file_2_content_type [String] The content type of file_2.
239
238
  # @param file_2_filename [String] The filename for file_2.
240
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
239
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
241
240
  def compare_documents(file_1:, file_2:, file_1_label: nil, file_2_label: nil, model_id: nil, file_1_content_type: nil, file_1_filename: nil, file_2_content_type: nil, file_2_filename: nil)
242
241
  raise ArgumentError.new("file_1 must be provided") if file_1.nil?
243
242
 
@@ -245,7 +244,7 @@ module IBMWatson
245
244
 
246
245
  headers = {
247
246
  }
248
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "compare_documents")
247
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "compare_documents")
249
248
 
250
249
  params = {
251
250
  "version" => @version,
@@ -295,13 +294,13 @@ module IBMWatson
295
294
  # @param feedback_data [FeedbackDataInput] Feedback data for submission.
296
295
  # @param user_id [String] An optional string identifying the user.
297
296
  # @param comment [String] An optional comment on or description of the feedback.
298
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
297
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
299
298
  def add_feedback(feedback_data:, user_id: nil, comment: nil)
300
299
  raise ArgumentError.new("feedback_data must be provided") if feedback_data.nil?
301
300
 
302
301
  headers = {
303
302
  }
304
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "add_feedback")
303
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "add_feedback")
305
304
 
306
305
  params = {
307
306
  "version" => @version
@@ -370,11 +369,11 @@ module IBMWatson
370
369
  # @param include_total [Boolean] An optional boolean value. If specified as `true`, the `pagination` object in the
371
370
  # output includes a value called `total` that gives the total count of feedback
372
371
  # created.
373
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
372
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
374
373
  def list_feedback(feedback_type: nil, before: nil, after: 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)
375
374
  headers = {
376
375
  }
377
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "list_feedback")
376
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "list_feedback")
378
377
 
379
378
  params = {
380
379
  "version" => @version,
@@ -416,13 +415,13 @@ module IBMWatson
416
415
  # and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables`
417
416
  # method, the default is `tables`. These defaults apply to the standalone methods as
418
417
  # well as to the methods' use in batch-processing requests.
419
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
418
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
420
419
  def get_feedback(feedback_id:, model_id: nil)
421
420
  raise ArgumentError.new("feedback_id must be provided") if feedback_id.nil?
422
421
 
423
422
  headers = {
424
423
  }
425
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "get_feedback")
424
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "get_feedback")
426
425
 
427
426
  params = {
428
427
  "version" => @version,
@@ -449,13 +448,13 @@ module IBMWatson
449
448
  # and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables`
450
449
  # method, the default is `tables`. These defaults apply to the standalone methods as
451
450
  # well as to the methods' use in batch-processing requests.
452
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
451
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
453
452
  def delete_feedback(feedback_id:, model_id: nil)
454
453
  raise ArgumentError.new("feedback_id must be provided") if feedback_id.nil?
455
454
 
456
455
  headers = {
457
456
  }
458
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "delete_feedback")
457
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "delete_feedback")
459
458
 
460
459
  params = {
461
460
  "version" => @version,
@@ -507,7 +506,7 @@ module IBMWatson
507
506
  # well as to the methods' use in batch-processing requests.
508
507
  # @param input_credentials_filename [String] The filename for input_credentials_file.
509
508
  # @param output_credentials_filename [String] The filename for output_credentials_file.
510
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
509
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
511
510
  def create_batch(function:, input_credentials_file:, input_bucket_location:, input_bucket_name:, output_credentials_file:, output_bucket_location:, output_bucket_name:, model_id: nil, input_credentials_filename: nil, output_credentials_filename: nil)
512
511
  raise ArgumentError.new("function must be provided") if function.nil?
513
512
 
@@ -525,7 +524,7 @@ module IBMWatson
525
524
 
526
525
  headers = {
527
526
  }
528
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "create_batch")
527
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "create_batch")
529
528
 
530
529
  params = {
531
530
  "version" => @version,
@@ -572,11 +571,11 @@ module IBMWatson
572
571
  # @!method list_batches
573
572
  # List submitted batch-processing jobs.
574
573
  # List the batch-processing jobs submitted by users.
575
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
574
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
576
575
  def list_batches
577
576
  headers = {
578
577
  }
579
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "list_batches")
578
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "list_batches")
580
579
 
581
580
  params = {
582
581
  "version" => @version
@@ -599,13 +598,13 @@ module IBMWatson
599
598
  # Get information about a specific batch-processing request.
600
599
  # Get information about a batch-processing request with a specified ID.
601
600
  # @param batch_id [String] The ID of the batch-processing request whose information you want to retrieve.
602
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
601
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
603
602
  def get_batch(batch_id:)
604
603
  raise ArgumentError.new("batch_id must be provided") if batch_id.nil?
605
604
 
606
605
  headers = {
607
606
  }
608
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "get_batch")
607
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "get_batch")
609
608
 
610
609
  params = {
611
610
  "version" => @version
@@ -634,7 +633,7 @@ module IBMWatson
634
633
  # and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables`
635
634
  # method, the default is `tables`. These defaults apply to the standalone methods as
636
635
  # well as to the methods' use in batch-processing requests.
637
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
636
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
638
637
  def update_batch(batch_id:, action:, model_id: nil)
639
638
  raise ArgumentError.new("batch_id must be provided") if batch_id.nil?
640
639
 
@@ -642,7 +641,7 @@ module IBMWatson
642
641
 
643
642
  headers = {
644
643
  }
645
- headers = Common.new.get_default_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "update_batch")
644
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "compare-comply", service_version: "V1", operation_id: "update_batch")
646
645
 
647
646
  params = {
648
647
  "version" => @version,