ibm_watson 1.6.0 → 2.0.0.rc1

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.
@@ -382,6 +382,15 @@ if !ENV["ASSISTANT_APIKEY"].nil? && !ENV["ASSISTANT_URL"].nil?
382
382
  )
383
383
  assert(service_response.nil?)
384
384
  end
385
+
386
+ def test_bulk_classify
387
+ skip "Covered with the unit test. No need to run it here"
388
+
389
+ service_response = service.bulk_classify(
390
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"]
391
+ )
392
+ assert(service_response.nil?)
393
+ end
385
394
  end
386
395
  else
387
396
  class AssistantV1Test < Minitest::Test
@@ -82,5 +82,14 @@ if !ENV["ASSISTANT_APIKEY"].nil? && !ENV["ASSISTANT_URL"].nil?
82
82
  )
83
83
  assert(service_response.nil?)
84
84
  end
85
+
86
+ def test_bulk_classify
87
+ skip "Covered with the unit test. No need to run it here"
88
+
89
+ service_response = service.bulk_classify(
90
+ skill_id: ENV["ASSISTANT_WORKSPACE_ID"]
91
+ )
92
+ assert(service_response.nil?)
93
+ end
85
94
  end
86
95
  end
@@ -48,13 +48,13 @@ if !ENV["TEXT_TO_SPEECH_APIKEY"].nil? && !ENV["TEXT_TO_SPEECH_URL"].nil?
48
48
  end
49
49
 
50
50
  def test_customizations
51
- service_response = @service.list_voice_models
51
+ service_response = @service.list_custom_models
52
52
  refute(service_response.nil?)
53
53
  end
54
54
 
55
55
  def test_custom_words
56
56
  skip "Skip to allow for concurrent travis jobs"
57
- customization_id = @service.create_voice_model(
57
+ customization_id = @service.create_custom_model(
58
58
  name: "test_integration_customization",
59
59
  description: "customization for tests"
60
60
  ).result["customization_id"]
@@ -79,7 +79,7 @@ if !ENV["TEXT_TO_SPEECH_APIKEY"].nil? && !ENV["TEXT_TO_SPEECH_URL"].nil?
79
79
  word: "MACLs"
80
80
  ).result
81
81
  assert(word["translation"] == "mackles")
82
- @service.delete_voice_model(
82
+ @service.delete_custom_model(
83
83
  customization_id: customization_id
84
84
  )
85
85
  end
@@ -1401,4 +1401,55 @@ class AssistantV1Test < Minitest::Test
1401
1401
  )
1402
1402
  assert_equal({ "list_mentions_response" => "yes" }, service_response.result)
1403
1403
  end
1404
+
1405
+ def test_bulk_classify
1406
+ workspace_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
1407
+ message_response = {
1408
+ "context" => {
1409
+ "conversation_id" => "1b7b67c0-90ed-45dc-8508-9488bc483d5b",
1410
+ "system" => {
1411
+ "dialog_stack" => ["root"],
1412
+ "dialog_turn_counter" => 1,
1413
+ "dialog_request_counter" => 1
1414
+ }
1415
+ },
1416
+ "intents" => [],
1417
+ "entities" => [],
1418
+ "input" => {},
1419
+ "output" => {
1420
+ "text" => "okay",
1421
+ "log_messages" => []
1422
+ }
1423
+ }
1424
+ headers = {
1425
+ "Content-Type" => "application/json"
1426
+ }
1427
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/bulk_classify?version=2018-02-16")
1428
+ .with(
1429
+ body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
1430
+ headers: {
1431
+ "Accept" => "application/json",
1432
+ "Content-Type" => "application/json",
1433
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1434
+ }
1435
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
1436
+ service_response = service.bulk_classify(
1437
+ workspace_id: workspace_id,
1438
+ input: { "text" => "Turn on the lights" }
1439
+ )
1440
+ assert_equal(message_response, service_response.result)
1441
+
1442
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/bulk_classify?version=2018-02-16")
1443
+ .with(
1444
+ headers: {
1445
+ "Accept" => "application/json",
1446
+ "Content-Type" => "application/json",
1447
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1448
+ }
1449
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
1450
+ service_response = service.bulk_classify(
1451
+ workspace_id: workspace_id
1452
+ )
1453
+ assert_equal(message_response, service_response.result)
1454
+ end
1404
1455
  end
@@ -222,4 +222,55 @@ class AssistantV2Test < Minitest::Test
222
222
  )
223
223
  assert_nil(service_response)
224
224
  end
225
+
226
+ def test_bulk_classify
227
+ skill_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
228
+ message_response = {
229
+ "context" => {
230
+ "conversation_id" => "1b7b67c0-90ed-45dc-8508-9488bc483d5b",
231
+ "system" => {
232
+ "dialog_stack" => ["root"],
233
+ "dialog_turn_counter" => 1,
234
+ "dialog_request_counter" => 1
235
+ }
236
+ },
237
+ "intents" => [],
238
+ "entities" => [],
239
+ "input" => {},
240
+ "output" => {
241
+ "text" => "okay",
242
+ "log_messages" => []
243
+ }
244
+ }
245
+ headers = {
246
+ "Content-Type" => "application/json"
247
+ }
248
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/skills/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/workspace/bulk_classify?version=2018-02-16")
249
+ .with(
250
+ body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
251
+ headers: {
252
+ "Accept" => "application/json",
253
+ "Content-Type" => "application/json",
254
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
255
+ }
256
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
257
+ service_response = service.bulk_classify(
258
+ skill_id: skill_id,
259
+ input: { "text" => "Turn on the lights" }
260
+ )
261
+ assert_equal(message_response, service_response.result)
262
+
263
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/skills/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/workspace/bulk_classify?version=2018-02-16")
264
+ .with(
265
+ headers: {
266
+ "Accept" => "application/json",
267
+ "Content-Type" => "application/json",
268
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
269
+ }
270
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
271
+ service_response = service.bulk_classify(
272
+ skill_id: skill_id
273
+ )
274
+ assert_equal(message_response, service_response.result)
275
+ end
225
276
  end
@@ -295,7 +295,7 @@ class DiscoveryV2Test < Minitest::Test
295
295
  end
296
296
 
297
297
  def test_analyze_document
298
- skip "not available yet"
298
+ # skip "not available yet"
299
299
 
300
300
  stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/discovery/api/v2/projects/project/collections/collid/analyze?version=2018-03-05")
301
301
  .with(
@@ -151,7 +151,7 @@ class TextToSpeechV1Test < Minitest::Test
151
151
  assert_equal(response, service_response.result)
152
152
  end
153
153
 
154
- def test_custom_voice_models
154
+ def test_custom_custom_models
155
155
  response = { "customizations" => "yep" }
156
156
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
157
157
  username: "username",
@@ -170,7 +170,7 @@ class TextToSpeechV1Test < Minitest::Test
170
170
  "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
171
171
  }
172
172
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
173
- service_response = service.list_voice_models
173
+ service_response = service.list_custom_models
174
174
  assert_equal(response, service_response.result)
175
175
 
176
176
  stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations?language=en-US")
@@ -181,7 +181,7 @@ class TextToSpeechV1Test < Minitest::Test
181
181
  "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
182
182
  }
183
183
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
184
- service_response = service.list_voice_models(
184
+ service_response = service.list_custom_models(
185
185
  language: "en-US"
186
186
  )
187
187
  assert_equal(response, service_response.result)
@@ -196,7 +196,7 @@ class TextToSpeechV1Test < Minitest::Test
196
196
  "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
197
197
  }
198
198
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
199
- service_response = service.create_voice_model(
199
+ service_response = service.create_custom_model(
200
200
  name: "name",
201
201
  description: "description"
202
202
  )
@@ -210,7 +210,7 @@ class TextToSpeechV1Test < Minitest::Test
210
210
  "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
211
211
  }
212
212
  ).to_return(status: 200, body: { "customization" => "yep, just one" }.to_json, headers: { "Content-Type" => "application/json" })
213
- service_response = service.get_voice_model(
213
+ service_response = service.get_custom_model(
214
214
  customization_id: "custid"
215
215
  )
216
216
  assert_equal({ "customization" => "yep, just one" }, service_response.result)
@@ -225,7 +225,7 @@ class TextToSpeechV1Test < Minitest::Test
225
225
  "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
226
226
  }
227
227
  ).to_return(status: 200, body: "", headers: {})
228
- service_response = service.update_voice_model(
228
+ service_response = service.update_custom_model(
229
229
  customization_id: "custid",
230
230
  name: "name",
231
231
  description: "description"
@@ -239,7 +239,7 @@ class TextToSpeechV1Test < Minitest::Test
239
239
  "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
240
240
  }
241
241
  ).to_return(status: 200, body: "", headers: {})
242
- service_response = service.delete_voice_model(
242
+ service_response = service.delete_custom_model(
243
243
  customization_id: "custid"
244
244
  )
245
245
  assert(service_response.nil?)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_watson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 2.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Nussbaum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -342,11 +342,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
342
342
  version: '2.3'
343
343
  required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  requirements:
345
- - - ">="
345
+ - - ">"
346
346
  - !ruby/object:Gem::Version
347
- version: '0'
347
+ version: 1.3.1
348
348
  requirements: []
349
- rubygems_version: 3.1.4
349
+ rubygems_version: 3.0.8
350
350
  signing_key:
351
351
  specification_version: 4
352
352
  summary: Official client library to use the IBM Watson Services