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.
@@ -23,16 +23,15 @@
23
23
  require "concurrent"
24
24
  require "erb"
25
25
  require "json"
26
- require_relative "./detailed_response"
27
- require_relative "./common.rb"
28
26
 
29
- require_relative "./watson_service"
27
+ require "ibm_cloud_sdk_core"
28
+ require_relative "./common.rb"
30
29
 
31
30
  # Module for the Watson APIs
32
31
  module IBMWatson
33
32
  ##
34
33
  # The Language Translator V3 service.
35
- class LanguageTranslatorV3 < WatsonService
34
+ class LanguageTranslatorV3 < IBMCloudSdkCore::BaseService
36
35
  include Concurrent::Async
37
36
  ##
38
37
  # @!method initialize(args)
@@ -102,13 +101,13 @@ module IBMWatson
102
101
  # translation.
103
102
  # @param source [String] Translation source language code.
104
103
  # @param target [String] Translation target language code.
105
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
104
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
106
105
  def translate(text:, model_id: nil, source: nil, target: nil)
107
106
  raise ArgumentError.new("text must be provided") if text.nil?
108
107
 
109
108
  headers = {
110
109
  }
111
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "translate")
110
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "translate")
112
111
 
113
112
  params = {
114
113
  "version" => @version
@@ -142,11 +141,11 @@ module IBMWatson
142
141
  # List identifiable languages.
143
142
  # Lists the languages that the service can identify. Returns the language code (for
144
143
  # example, `en` for English or `es` for Spanish) and name of each language.
145
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
144
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
146
145
  def list_identifiable_languages
147
146
  headers = {
148
147
  }
149
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "list_identifiable_languages")
148
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "list_identifiable_languages")
150
149
 
151
150
  params = {
152
151
  "version" => @version
@@ -169,13 +168,13 @@ module IBMWatson
169
168
  # Identify language.
170
169
  # Identifies the language of the input text.
171
170
  # @param text [String] Input text in UTF-8 format.
172
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
171
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
173
172
  def identify(text:)
174
173
  raise ArgumentError.new("text must be provided") if text.nil?
175
174
 
176
175
  headers = {
177
176
  }
178
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "identify")
177
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "identify")
179
178
 
180
179
  params = {
181
180
  "version" => @version
@@ -210,11 +209,11 @@ module IBMWatson
210
209
  # (default and non-default) for each language pair. To return only default models,
211
210
  # set this to `true`. To return only non-default models, set this to `false`. There
212
211
  # is exactly one default model per language pair, the IBM provided base model.
213
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
212
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
214
213
  def list_models(source: nil, target: nil, default_models: nil)
215
214
  headers = {
216
215
  }
217
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "list_models")
216
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "list_models")
218
217
 
219
218
  params = {
220
219
  "version" => @version,
@@ -270,13 +269,13 @@ module IBMWatson
270
269
  # train successfully.
271
270
  # @param forced_glossary_filename [String] The filename for forced_glossary.
272
271
  # @param parallel_corpus_filename [String] The filename for parallel_corpus.
273
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
272
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
274
273
  def create_model(base_model_id:, name: nil, forced_glossary: nil, parallel_corpus: nil, forced_glossary_filename: nil, parallel_corpus_filename: nil)
275
274
  raise ArgumentError.new("base_model_id must be provided") if base_model_id.nil?
276
275
 
277
276
  headers = {
278
277
  }
279
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "create_model")
278
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "create_model")
280
279
 
281
280
  params = {
282
281
  "version" => @version,
@@ -320,13 +319,13 @@ module IBMWatson
320
319
  # Delete model.
321
320
  # Deletes a custom translation model.
322
321
  # @param model_id [String] Model ID of the model to delete.
323
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
322
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
324
323
  def delete_model(model_id:)
325
324
  raise ArgumentError.new("model_id must be provided") if model_id.nil?
326
325
 
327
326
  headers = {
328
327
  }
329
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "delete_model")
328
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "delete_model")
330
329
 
331
330
  params = {
332
331
  "version" => @version
@@ -351,13 +350,13 @@ module IBMWatson
351
350
  # models. Use this API call to poll the status of your customization request. A
352
351
  # successfully completed training will have a status of `available`.
353
352
  # @param model_id [String] Model ID of the model to get.
354
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
353
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
355
354
  def get_model(model_id:)
356
355
  raise ArgumentError.new("model_id must be provided") if model_id.nil?
357
356
 
358
357
  headers = {
359
358
  }
360
- headers = Common.new.get_default_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "get_model")
359
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "get_model")
361
360
 
362
361
  params = {
363
362
  "version" => @version
@@ -22,16 +22,15 @@
22
22
  require "concurrent"
23
23
  require "erb"
24
24
  require "json"
25
- require_relative "./detailed_response"
26
- require_relative "./common.rb"
27
25
 
28
- require_relative "./watson_service"
26
+ require "ibm_cloud_sdk_core"
27
+ require_relative "./common.rb"
29
28
 
30
29
  # Module for the Watson APIs
31
30
  module IBMWatson
32
31
  ##
33
32
  # The Natural Language Classifier V1 service.
34
- class NaturalLanguageClassifierV1 < WatsonService
33
+ class NaturalLanguageClassifierV1 < IBMCloudSdkCore::BaseService
35
34
  include Concurrent::Async
36
35
  ##
37
36
  # @!method initialize(args)
@@ -86,7 +85,7 @@ module IBMWatson
86
85
  # can use the classifier to classify text.
87
86
  # @param classifier_id [String] Classifier ID to use.
88
87
  # @param text [String] The submitted phrase. The maximum length is 2048 characters.
89
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
88
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
90
89
  def classify(classifier_id:, text:)
91
90
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
92
91
 
@@ -94,7 +93,7 @@ module IBMWatson
94
93
 
95
94
  headers = {
96
95
  }
97
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify")
96
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify")
98
97
 
99
98
  data = {
100
99
  "text" => text
@@ -121,7 +120,7 @@ module IBMWatson
121
120
  # Note that classifying Japanese texts is a beta feature.
122
121
  # @param classifier_id [String] Classifier ID to use.
123
122
  # @param collection [Array[ClassifyInput]] The submitted phrases.
124
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
123
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
125
124
  def classify_collection(classifier_id:, collection:)
126
125
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
127
126
 
@@ -129,7 +128,7 @@ module IBMWatson
129
128
 
130
129
  headers = {
131
130
  }
132
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify_collection")
131
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify_collection")
133
132
 
134
133
  data = {
135
134
  "collection" => collection
@@ -167,7 +166,7 @@ module IBMWatson
167
166
  # preparation](https://cloud.ibm.com/docs/services/natural-language-classifier/using-your-data.html).
168
167
  # @param metadata_filename [String] The filename for training_metadata.
169
168
  # @param training_data_filename [String] The filename for training_data.
170
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
169
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
171
170
  def create_classifier(metadata:, training_data:, metadata_filename: nil, training_data_filename: nil)
172
171
  raise ArgumentError.new("metadata must be provided") if metadata.nil?
173
172
 
@@ -175,7 +174,7 @@ module IBMWatson
175
174
 
176
175
  headers = {
177
176
  }
178
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "create_classifier")
177
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "create_classifier")
179
178
 
180
179
  form_data = {}
181
180
 
@@ -207,11 +206,11 @@ module IBMWatson
207
206
  # @!method list_classifiers
208
207
  # List classifiers.
209
208
  # Returns an empty array if no classifiers are available.
210
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
209
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
211
210
  def list_classifiers
212
211
  headers = {
213
212
  }
214
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "list_classifiers")
213
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "list_classifiers")
215
214
 
216
215
  method_url = "/v1/classifiers"
217
216
 
@@ -229,13 +228,13 @@ module IBMWatson
229
228
  # Get information about a classifier.
230
229
  # Returns status and other information about a classifier.
231
230
  # @param classifier_id [String] Classifier ID to query.
232
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
231
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
233
232
  def get_classifier(classifier_id:)
234
233
  raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
235
234
 
236
235
  headers = {
237
236
  }
238
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "get_classifier")
237
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "get_classifier")
239
238
 
240
239
  method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
241
240
 
@@ -258,7 +257,7 @@ module IBMWatson
258
257
 
259
258
  headers = {
260
259
  }
261
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "delete_classifier")
260
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "delete_classifier")
262
261
 
263
262
  method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
264
263
 
@@ -27,16 +27,15 @@
27
27
  require "concurrent"
28
28
  require "erb"
29
29
  require "json"
30
- require_relative "./detailed_response"
31
- require_relative "./common.rb"
32
30
 
33
- require_relative "./watson_service"
31
+ require "ibm_cloud_sdk_core"
32
+ require_relative "./common.rb"
34
33
 
35
34
  # Module for the Watson APIs
36
35
  module IBMWatson
37
36
  ##
38
37
  # The Natural Language Understanding V1 service.
39
- class NaturalLanguageUnderstandingV1 < WatsonService
38
+ class NaturalLanguageUnderstandingV1 < IBMCloudSdkCore::BaseService
40
39
  include Concurrent::Async
41
40
  ##
42
41
  # @!method initialize(args)
@@ -133,13 +132,13 @@ module IBMWatson
133
132
  # support](https://www.bluemix.net/docs/services/natural-language-understanding/language-support.html)
134
133
  # for more information.
135
134
  # @param limit_text_characters [Fixnum] Sets the maximum number of characters that are processed by the service.
136
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
135
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
137
136
  def analyze(features:, text: nil, html: nil, url: nil, clean: nil, xpath: nil, fallback_to_raw: nil, return_analyzed_text: nil, language: nil, limit_text_characters: nil)
138
137
  raise ArgumentError.new("features must be provided") if features.nil?
139
138
 
140
139
  headers = {
141
140
  }
142
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "analyze")
141
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "analyze")
143
142
 
144
143
  params = {
145
144
  "version" => @version
@@ -180,11 +179,11 @@ module IBMWatson
180
179
  # Lists Watson Knowledge Studio [custom
181
180
  # models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
182
181
  # that are deployed to your Natural Language Understanding service.
183
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
182
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
184
183
  def list_models
185
184
  headers = {
186
185
  }
187
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "list_models")
186
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "list_models")
188
187
 
189
188
  params = {
190
189
  "version" => @version
@@ -207,13 +206,13 @@ module IBMWatson
207
206
  # Delete model.
208
207
  # Deletes a custom model.
209
208
  # @param model_id [String] Model ID of the model to delete.
210
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
209
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
211
210
  def delete_model(model_id:)
212
211
  raise ArgumentError.new("model_id must be provided") if model_id.nil?
213
212
 
214
213
  headers = {
215
214
  }
216
- headers = Common.new.get_default_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "delete_model")
215
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "delete_model")
217
216
 
218
217
  params = {
219
218
  "version" => @version
@@ -38,16 +38,15 @@
38
38
  require "concurrent"
39
39
  require "erb"
40
40
  require "json"
41
- require_relative "./detailed_response"
42
- require_relative "./common.rb"
43
41
 
44
- require_relative "./watson_service"
42
+ require "ibm_cloud_sdk_core"
43
+ require_relative "./common.rb"
45
44
 
46
45
  # Module for the Watson APIs
47
46
  module IBMWatson
48
47
  ##
49
48
  # The Personality Insights V3 service.
50
- class PersonalityInsightsV3 < WatsonService
49
+ class PersonalityInsightsV3 < IBMCloudSdkCore::BaseService
51
50
  include Concurrent::Async
52
51
  ##
53
52
  # @!method initialize(args)
@@ -187,7 +186,7 @@ module IBMWatson
187
186
  # (`text/csv`).
188
187
  # @param consumption_preferences [Boolean] Indicates whether consumption preferences are returned with the results. By
189
188
  # default, no consumption preferences are returned.
190
- # @return [DetailedResponse] A `DetailedResponse` object representing the response.
189
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
191
190
  def profile(content:, accept:, content_type: nil, content_language: nil, accept_language: nil, raw_scores: nil, csv_headers: nil, consumption_preferences: nil)
192
191
  raise ArgumentError.new("content must be provided") if content.nil?
193
192
 
@@ -199,7 +198,7 @@ module IBMWatson
199
198
  "Content-Language" => content_language,
200
199
  "Accept-Language" => accept_language
201
200
  }
202
- headers = Common.new.get_default_headers(headers: headers, service_name: "personality_insights", service_version: "V3", operation_id: "profile")
201
+ headers = Common.new.get_sdk_headers(headers: headers, service_name: "personality_insights", service_version: "V3", operation_id: "profile")
203
202
 
204
203
  params = {
205
204
  "version" => @version,