ibm_watson 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,16 +36,15 @@
36
36
  require "concurrent"
37
37
  require "erb"
38
38
  require "json"
39
- require_relative "./detailed_response"
40
- require_relative "./common.rb"
41
39
 
42
- require_relative "./watson_service"
40
+ require "ibm_cloud_sdk_core"
41
+ require_relative "./common.rb"
43
42
 
44
43
  # Module for the Watson APIs
45
44
  module IBMWatson
46
45
  ##
47
46
  # The Text to Speech V1 service.
48
- class TextToSpeechV1 < WatsonService
47
+ class TextToSpeechV1 < IBMCloudSdkCore::BaseService
49
48
  include Concurrent::Async
50
49
  ##
51
50
  # @!method initialize(args)
@@ -102,11 +101,11 @@ module IBMWatson
102
101
  #
103
102
  # **See also:** [Specifying a
104
103
  # voice](https://cloud.ibm.com/docs/services/text-to-speech/http.html#voices).
105
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
104
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
106
105
  def list_voices
107
106
  headers = {
108
107
  }
109
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_voices")
108
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_voices")
110
109
 
111
110
  method_url = "/v1/voices"
112
111
 
@@ -134,13 +133,13 @@ module IBMWatson
134
133
  # returned. You must make the request with service credentials created for the
135
134
  # instance of the service that owns the custom model. Omit the parameter to see
136
135
  # information about the specified voice with no customization.
137
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
136
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
138
137
  def get_voice(voice:, customization_id: nil)
139
138
  raise ArgumentError.new("voice must be provided") if voice.nil?
140
139
 
141
140
  headers = {
142
141
  }
143
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_voice")
142
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_voice")
144
143
 
145
144
  params = {
146
145
  "customization_id" => customization_id
@@ -263,14 +262,14 @@ module IBMWatson
263
262
  # language of the indicated voice. You must make the request with service
264
263
  # credentials created for the instance of the service that owns the custom model.
265
264
  # Omit the parameter to use the specified voice with no customization.
266
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
265
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
267
266
  def synthesize(text:, accept: nil, voice: nil, customization_id: nil)
268
267
  raise ArgumentError.new("text must be provided") if text.nil?
269
268
 
270
269
  headers = {
271
270
  "Accept" => accept
272
271
  }
273
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "synthesize")
272
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "synthesize")
274
273
 
275
274
  params = {
276
275
  "voice" => voice,
@@ -322,13 +321,13 @@ module IBMWatson
322
321
  # must make the request with service credentials created for the instance of the
323
322
  # service that owns the custom model. Omit the parameter to see the translation for
324
323
  # the specified voice with no customization.
325
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
324
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
326
325
  def get_pronunciation(text:, voice: nil, format: nil, customization_id: nil)
327
326
  raise ArgumentError.new("text must be provided") if text.nil?
328
327
 
329
328
  headers = {
330
329
  }
331
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_pronunciation")
330
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_pronunciation")
332
331
 
333
332
  params = {
334
333
  "text" => text,
@@ -369,13 +368,13 @@ module IBMWatson
369
368
  # default language, `en-US`.
370
369
  # @param description [String] A description of the new custom voice model. Specifying a description is
371
370
  # recommended.
372
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
371
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
373
372
  def create_voice_model(name:, language: nil, description: nil)
374
373
  raise ArgumentError.new("name must be provided") if name.nil?
375
374
 
376
375
  headers = {
377
376
  }
378
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "create_voice_model")
377
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "create_voice_model")
379
378
 
380
379
  data = {
381
380
  "name" => name,
@@ -412,11 +411,11 @@ module IBMWatson
412
411
  # @param language [String] The language for which custom voice models that are owned by the requesting
413
412
  # service credentials are to be returned. Omit the parameter to see all custom voice
414
413
  # models that are owned by the requester.
415
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
414
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
416
415
  def list_voice_models(language: nil)
417
416
  headers = {
418
417
  }
419
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_voice_models")
418
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_voice_models")
420
419
 
421
420
  params = {
422
421
  "language" => language
@@ -481,7 +480,7 @@ module IBMWatson
481
480
 
482
481
  headers = {
483
482
  }
484
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "update_voice_model")
483
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "update_voice_model")
485
484
 
486
485
  data = {
487
486
  "name" => name,
@@ -516,13 +515,13 @@ module IBMWatson
516
515
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
517
516
  # with service credentials created for the instance of the service that owns the
518
517
  # custom model.
519
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
518
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
520
519
  def get_voice_model(customization_id:)
521
520
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
522
521
 
523
522
  headers = {
524
523
  }
525
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_voice_model")
524
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_voice_model")
526
525
 
527
526
  method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
528
527
 
@@ -554,7 +553,7 @@ module IBMWatson
554
553
 
555
554
  headers = {
556
555
  }
557
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_voice_model")
556
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_voice_model")
558
557
 
559
558
  method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
560
559
 
@@ -621,7 +620,7 @@ module IBMWatson
621
620
 
622
621
  headers = {
623
622
  }
624
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "add_words")
623
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "add_words")
625
624
 
626
625
  data = {
627
626
  "words" => words
@@ -654,13 +653,13 @@ module IBMWatson
654
653
  # @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
655
654
  # with service credentials created for the instance of the service that owns the
656
655
  # custom model.
657
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
656
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
658
657
  def list_words(customization_id:)
659
658
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
660
659
 
661
660
  headers = {
662
661
  }
663
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_words")
662
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_words")
664
663
 
665
664
  method_url = "/v1/customizations/%s/words" % [ERB::Util.url_encode(customization_id)]
666
665
 
@@ -729,7 +728,7 @@ module IBMWatson
729
728
 
730
729
  headers = {
731
730
  }
732
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "add_word")
731
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "add_word")
733
732
 
734
733
  data = {
735
734
  "translation" => translation,
@@ -763,7 +762,7 @@ module IBMWatson
763
762
  # with service credentials created for the instance of the service that owns the
764
763
  # custom model.
765
764
  # @param word [String] The word that is to be queried from the custom voice model.
766
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
765
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
767
766
  def get_word(customization_id:, word:)
768
767
  raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
769
768
 
@@ -771,7 +770,7 @@ module IBMWatson
771
770
 
772
771
  headers = {
773
772
  }
774
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_word")
773
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_word")
775
774
 
776
775
  method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word)]
777
776
 
@@ -807,7 +806,7 @@ module IBMWatson
807
806
 
808
807
  headers = {
809
808
  }
810
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_word")
809
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_word")
811
810
 
812
811
  method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word)]
813
812
 
@@ -844,7 +843,7 @@ module IBMWatson
844
843
 
845
844
  headers = {
846
845
  }
847
- headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_user_data")
846
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_user_data")
848
847
 
849
848
  params = {
850
849
  "customer_id" => customer_id
@@ -29,16 +29,15 @@
29
29
  require "concurrent"
30
30
  require "erb"
31
31
  require "json"
32
- require_relative "./detailed_response"
33
- require_relative "./common.rb"
34
32
 
35
- require_relative "./watson_service"
33
+ require "ibm_cloud_sdk_core"
34
+ require_relative "./common.rb"
36
35
 
37
36
  # Module for the Watson APIs
38
37
  module IBMWatson
39
38
  ##
40
39
  # The Tone Analyzer V3 service.
41
- class ToneAnalyzerV3 < WatsonService
40
+ class ToneAnalyzerV3 < IBMCloudSdkCore::BaseService
42
41
  include Concurrent::Async
43
42
  ##
44
43
  # @!method initialize(args)
@@ -146,7 +145,7 @@ module IBMWatson
146
145
  # variants are treated as their parent language; for example, `en-US` is interpreted
147
146
  # as `en`. You can use different languages for **Content-Language** and
148
147
  # **Accept-Language**.
149
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
148
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
150
149
  def tone(tone_input:, content_type: nil, sentences: nil, tones: nil, content_language: nil, accept_language: nil)
151
150
  raise ArgumentError.new("tone_input must be provided") if tone_input.nil?
152
151
 
@@ -155,7 +154,7 @@ module IBMWatson
155
154
  "Content-Language" => content_language,
156
155
  "Accept-Language" => accept_language
157
156
  }
158
- headers = Common.new.get_default_headers(headers: headers, service_name: "tone_analyzer", service_version: "V3", operation_id: "tone")
157
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "tone_analyzer", service_version: "V3", operation_id: "tone")
159
158
 
160
159
  params = {
161
160
  "version" => @version,
@@ -212,7 +211,7 @@ module IBMWatson
212
211
  # variants are treated as their parent language; for example, `en-US` is interpreted
213
212
  # as `en`. You can use different languages for **Content-Language** and
214
213
  # **Accept-Language**.
215
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
214
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
216
215
  def tone_chat(utterances:, content_language: nil, accept_language: nil)
217
216
  raise ArgumentError.new("utterances must be provided") if utterances.nil?
218
217
 
@@ -220,7 +219,7 @@ module IBMWatson
220
219
  "Content-Language" => content_language,
221
220
  "Accept-Language" => accept_language
222
221
  }
223
- headers = Common.new.get_default_headers(headers: headers, service_name: "tone_analyzer", service_version: "V3", operation_id: "tone_chat")
222
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "tone_analyzer", service_version: "V3", operation_id: "tone_chat")
224
223
 
225
224
  params = {
226
225
  "version" => @version
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IBMWatson
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
  end
@@ -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 Visual Recognition V3 service.
33
- class VisualRecognitionV3 < WatsonService
32
+ class VisualRecognitionV3 < IBMCloudSdkCore::BaseService
34
33
  include Concurrent::Async
35
34
  ##
36
35
  # @!method initialize(args)
@@ -116,12 +115,12 @@ module IBMWatson
116
115
  # - `explicit`: Evaluates whether the image might be pornographic.
117
116
  # @param images_file_content_type [String] The content type of images_file.
118
117
  # @param images_filename [String] The filename for images_file.
119
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
118
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
120
119
  def classify(images_file: nil, accept_language: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, images_file_content_type: nil, images_filename: nil)
121
120
  headers = {
122
121
  "Accept-Language" => accept_language
123
122
  }
124
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "classify")
123
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "classify")
125
124
 
126
125
  params = {
127
126
  "version" => @version
@@ -178,7 +177,8 @@ module IBMWatson
178
177
  # Detect faces method does not support general biometric facial recognition.
179
178
  #
180
179
  # Supported image formats include .gif, .jpg, .png, and .tif. The maximum image size
181
- # is 10 MB. The minimum recommended pixel density is 32X32 pixels per inch.
180
+ # is 10 MB. The minimum recommended pixel density is 32X32 pixels, but the service
181
+ # tends to perform better with images that are at least 224 x 224 pixels.
182
182
  # @param images_file [File] An image file (gif, .jpg, .png, .tif.) or .zip file with images. Limit the .zip
183
183
  # file to 100 MB. You can include a maximum of 15 images in a request.
184
184
  #
@@ -188,19 +188,20 @@ module IBMWatson
188
188
  #
189
189
  # You can also include an image with the **url** parameter.
190
190
  # @param url [String] The URL of an image to analyze. Must be in .gif, .jpg, .png, or .tif format. The
191
- # minimum recommended pixel density is 32X32 pixels per inch, and the maximum image
191
+ # minimum recommended pixel density is 32X32 pixels, but the service tends to
192
+ # perform better with images that are at least 224 x 224 pixels. The maximum image
192
193
  # size is 10 MB. Redirects are followed, so you can use a shortened URL.
193
194
  #
194
195
  # You can also include images with the **images_file** parameter.
195
196
  # @param images_file_content_type [String] The content type of images_file.
196
197
  # @param images_filename [String] The filename for images_file.
197
198
  # @param accept_language [String] The desired language of parts of the response. See the response for details.
198
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
199
- def detect_faces(images_file: nil, url: nil, images_file_content_type: nil, images_filename: nil, accept_language: nil)
199
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
200
+ def detect_faces(images_file: nil, url: nil, accept_language: nil, images_file_content_type: nil, images_filename: nil)
200
201
  headers = {
201
202
  "Accept-Language" => accept_language
202
203
  }
203
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "detect_faces")
204
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "detect_faces")
204
205
 
205
206
  params = {
206
207
  "version" => @version
@@ -264,7 +265,7 @@ module IBMWatson
264
265
  # Encode special characters in the file name in UTF-8.
265
266
  # @param positive_examples_filename [Hash] The filename for positive_examples.
266
267
  # @param negative_examples_filename [String] The filename for negative_examples.
267
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
268
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
268
269
  def create_classifier(name:, positive_examples:, negative_examples: nil, positive_examples_filename: nil, negative_examples_filename: nil)
269
270
  raise ArgumentError.new("name must be provided") if name.nil?
270
271
 
@@ -275,7 +276,7 @@ module IBMWatson
275
276
 
276
277
  headers = {
277
278
  }
278
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "create_classifier")
279
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "create_classifier")
279
280
 
280
281
  params = {
281
282
  "version" => @version
@@ -321,11 +322,11 @@ module IBMWatson
321
322
  # Retrieve a list of classifiers.
322
323
  # @param verbose [Boolean] Specify `true` to return details about the classifiers. Omit this parameter to
323
324
  # return a brief list of classifiers.
324
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
325
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
325
326
  def list_classifiers(verbose: nil)
326
327
  headers = {
327
328
  }
328
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "list_classifiers")
329
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "list_classifiers")
329
330
 
330
331
  params = {
331
332
  "version" => @version,
@@ -349,13 +350,13 @@ module IBMWatson
349
350
  # Retrieve classifier details.
350
351
  # Retrieve information about a custom classifier.
351
352
  # @param classifier_id [String] The ID of the classifier.
352
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
353
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
353
354
  def get_classifier(classifier_id:)
354
355
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
355
356
 
356
357
  headers = {
357
358
  }
358
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "get_classifier")
359
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "get_classifier")
359
360
 
360
361
  params = {
361
362
  "version" => @version
@@ -409,7 +410,7 @@ module IBMWatson
409
410
  # Encode special characters in the file name in UTF-8.
410
411
  # @param positive_examples_filename [Hash] The filename for positive_examples.
411
412
  # @param negative_examples_filename [String] The filename for negative_examples.
412
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
413
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
413
414
  def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, positive_examples_filename: nil, negative_examples_filename: nil)
414
415
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
415
416
 
@@ -419,7 +420,7 @@ module IBMWatson
419
420
 
420
421
  headers = {
421
422
  }
422
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "update_classifier")
423
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "update_classifier")
423
424
 
424
425
  params = {
425
426
  "version" => @version
@@ -468,7 +469,7 @@ module IBMWatson
468
469
 
469
470
  headers = {
470
471
  }
471
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "delete_classifier")
472
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "delete_classifier")
472
473
 
473
474
  params = {
474
475
  "version" => @version
@@ -495,13 +496,13 @@ module IBMWatson
495
496
  # Download a Core ML model file (.mlmodel) of a custom classifier that returns
496
497
  # <tt>\"core_ml_enabled\": true</tt> in the classifier details.
497
498
  # @param classifier_id [String] The ID of the classifier.
498
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
499
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
499
500
  def get_core_ml_model(classifier_id:)
500
501
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
501
502
 
502
503
  headers = {
503
504
  }
504
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "get_core_ml_model")
505
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "get_core_ml_model")
505
506
 
506
507
  params = {
507
508
  "version" => @version
@@ -539,7 +540,7 @@ module IBMWatson
539
540
 
540
541
  headers = {
541
542
  }
542
- headers = Common.new.get_default_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "delete_user_data")
543
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "watson_vision_combined", service_version: "V3", operation_id: "delete_user_data")
543
544
 
544
545
  params = {
545
546
  "version" => @version,
@@ -706,7 +706,7 @@ if !ENV["ASSISTANT_IAM_URL"].nil? && !ENV["ASSISTANT_IAM_APIKEY"].nil?
706
706
  begin
707
707
  service.iam_apikey(iam_apikey: "bogus_api_key")
708
708
  service.list_workspaces
709
- rescue WatsonApiException => e
709
+ rescue IBMCloudSdkCore::ApiException => e
710
710
  assert_equal("Provided API key could not be found", e.info["errorMessage"])
711
711
  error_received = true
712
712
  end
@@ -55,7 +55,7 @@ if !ENV["SPEECH_TO_TEXT_USERNAME"].nil? && !ENV["SPEECH_TO_TEXT_PASSWORD"].nil?
55
55
  model_id: "bogus"
56
56
  )
57
57
  rescue StandardError => e
58
- refute_nil(e.global_transaction_id)
58
+ refute_nil(e.error)
59
59
  end
60
60
  end
61
61
 
@@ -101,7 +101,7 @@ class AssistantV1Test < Minitest::Test
101
101
  workspace_id: "boguswid",
102
102
  text: "I want financial advice today."
103
103
  )
104
- rescue WatsonApiException => e
104
+ rescue IBMCloudSdkCore::ApiException => e
105
105
  assert_equal(error_code, e.code)
106
106
  assert_equal(error_msg, e.error)
107
107
  assert(e.to_s.instance_of?(String))
@@ -138,7 +138,7 @@ class AssistantV1Test < Minitest::Test
138
138
  workspace_id: "boguswid",
139
139
  text: "I want financial advice today."
140
140
  )
141
- rescue WatsonApiException => e
141
+ rescue IBMCloudSdkCore::ApiException => e
142
142
  assert_equal(error_code, e.code)
143
143
  assert_equal(error_msg, e.error)
144
144
  end
@@ -146,7 +146,7 @@ class HTTPConfigTest < Minitest::Test
146
146
  username: "username",
147
147
  password: "password"
148
148
  )
149
- service.configure_http_client(disable_ssl: true)
149
+ service.configure_http_client(disable_ssl_verification: true)
150
150
  refute_nil(service.conn.default_options.ssl_context)
151
151
  end
152
152
  end
@@ -14,7 +14,7 @@ class PersonalityInsightsV3Test < Minitest::Test
14
14
  headers = {
15
15
  "Content-Type" => "application/json"
16
16
  }
17
- expected_response = DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
17
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
18
18
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
19
19
  .with(
20
20
  body: personality_text,
@@ -66,7 +66,7 @@ class PersonalityInsightsV3Test < Minitest::Test
66
66
  headers = {
67
67
  "Content-Type" => "application/json"
68
68
  }
69
- expected_response = DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
69
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
70
70
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&raw_scores=true&version=2017-10-13")
71
71
  .with(
72
72
  body: personality_text,
@@ -103,7 +103,7 @@ class PersonalityInsightsV3Test < Minitest::Test
103
103
  headers = {
104
104
  "Content-Type" => "text/csv"
105
105
  }
106
- expected_response = DetailedResponse.new(status: 200, body: profile_response, headers: headers)
106
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
107
107
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&csv_headers=true&raw_scores=true&version=2017-10-13")
108
108
  .with(
109
109
  body: personality_text,
@@ -141,7 +141,7 @@ class PersonalityInsightsV3Test < Minitest::Test
141
141
  headers = {
142
142
  "Content-Type" => "application/json"
143
143
  }
144
- expected_response = DetailedResponse.new(status: 200, body: profile_response, headers: headers)
144
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
145
145
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
146
146
  .with(
147
147
  body: personality_text,
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative("./../../lib/ibm_watson/watson_api_exception.rb")
4
3
  require("json")
5
4
  require_relative("./../test_helper.rb")
6
5
  require("webmock/minitest")
@@ -14,7 +13,7 @@ class ToneAnalyzerV3Test < Minitest::Test
14
13
  headers = {
15
14
  "Content-Type" => "application/json"
16
15
  }
17
- expected_response = DetailedResponse.new(status: 200, headers: headers, body: tone_response)
16
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, headers: headers, body: tone_response)
18
17
  tone_text = File.read(Dir.getwd + "/resources/personality.txt")
19
18
  stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21")
20
19
  .with(
@@ -46,7 +45,7 @@ class ToneAnalyzerV3Test < Minitest::Test
46
45
  "Content-Type" => "application/json"
47
46
  }
48
47
  tone_text = File.read(Dir.getwd + "/resources/personality.txt")
49
- expected_response = DetailedResponse.new(status: 200, headers: headers, body: tone_response)
48
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, headers: headers, body: tone_response)
50
49
  stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?sentences=false&version=2017-09-21")
51
50
  .with(
52
51
  body: tone_text,
@@ -76,7 +75,7 @@ class ToneAnalyzerV3Test < Minitest::Test
76
75
  headers = {
77
76
  "Content-Type" => "application/json"
78
77
  }
79
- expected_response = DetailedResponse.new(body: tone_response, status: 200, headers: headers)
78
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(body: tone_response, status: 200, headers: headers)
80
79
  stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone_chat?version=2017-09-21")
81
80
  .with(
82
81
  body: "{\"utterances\":[{\"text\":\"I am very happy\",\"user\":\"glenn\"}]}",
@@ -136,7 +135,7 @@ class ToneAnalyzerV3Test < Minitest::Test
136
135
  )
137
136
  begin
138
137
  service.tone(tone_input: text, content_type: "application/json")
139
- rescue WatsonApiException => e
138
+ rescue IBMCloudSdkCore::ApiException => e
140
139
  assert_equal(error_code, e.code)
141
140
  assert_equal(error_message, e.error)
142
141
  assert_equal("C00012", e.info["sub_code"])
@@ -16,7 +16,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
16
16
  headers = {
17
17
  "Content-Type" => "application/json"
18
18
  }
19
- expected_response = DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
19
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
20
20
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
21
21
  .with(
22
22
  body: personality_text,
@@ -49,7 +49,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
49
49
  headers = {
50
50
  "Content-Type" => "applicaiton/json"
51
51
  }
52
- expected_response = DetailedResponse.new(status: 200, body: profile_response, headers: headers)
52
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
53
53
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&raw_scores=true&version=2017-10-13")
54
54
  .with(
55
55
  body: personality_text,
@@ -84,7 +84,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
84
84
  headers = {
85
85
  "Content-Type" => "text/csv"
86
86
  }
87
- expected_response = DetailedResponse.new(status: 200, body: profile_response, headers: headers)
87
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
88
88
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&csv_headers=true&raw_scores=true&version=2017-10-13")
89
89
  .with(
90
90
  body: personality_text,
@@ -120,7 +120,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
120
120
  headers = {
121
121
  "Content-Type" => "application/json"
122
122
  }
123
- expected_response = DetailedResponse.new(status: 200, body: profile_response, headers: headers)
123
+ expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
124
124
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
125
125
  .with(
126
126
  body: personality_text,