ibm_watson 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +258 -0
  3. data/bin/console +14 -0
  4. data/bin/setup +8 -0
  5. data/lib/ibm_watson.rb +16 -0
  6. data/lib/ibm_watson/assistant_v1.rb +1997 -0
  7. data/lib/ibm_watson/detailed_response.rb +21 -0
  8. data/lib/ibm_watson/discovery_v1.rb +2039 -0
  9. data/lib/ibm_watson/iam_token_manager.rb +166 -0
  10. data/lib/ibm_watson/language_translator_v3.rb +411 -0
  11. data/lib/ibm_watson/natural_language_classifier_v1.rb +309 -0
  12. data/lib/ibm_watson/natural_language_understanding_v1.rb +297 -0
  13. data/lib/ibm_watson/personality_insights_v3.rb +260 -0
  14. data/lib/ibm_watson/speech_to_text_v1.rb +2153 -0
  15. data/lib/ibm_watson/text_to_speech_v1.rb +716 -0
  16. data/lib/ibm_watson/tone_analyzer_v3.rb +287 -0
  17. data/lib/ibm_watson/version.rb +3 -0
  18. data/lib/ibm_watson/visual_recognition_v3.rb +579 -0
  19. data/lib/ibm_watson/watson_api_exception.rb +41 -0
  20. data/lib/ibm_watson/watson_service.rb +180 -0
  21. data/lib/ibm_watson/websocket/recognize_callback.rb +32 -0
  22. data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +162 -0
  23. data/rakefile +45 -0
  24. data/test/integration/test_assistant_v1.rb +645 -0
  25. data/test/integration/test_discovery_v1.rb +200 -0
  26. data/test/integration/test_iam_assistant_v1.rb +707 -0
  27. data/test/integration/test_language_translator_v3.rb +81 -0
  28. data/test/integration/test_natural_language_classifier_v1.rb +69 -0
  29. data/test/integration/test_natural_language_understanding_v1.rb +98 -0
  30. data/test/integration/test_personality_insights_v3.rb +95 -0
  31. data/test/integration/test_speech_to_text_v1.rb +187 -0
  32. data/test/integration/test_text_to_speech_v1.rb +81 -0
  33. data/test/integration/test_tone_analyzer_v3.rb +72 -0
  34. data/test/integration/test_visual_recognition_v3.rb +64 -0
  35. data/test/test_helper.rb +22 -0
  36. data/test/unit/test_assistant_v1.rb +1598 -0
  37. data/test/unit/test_discovery_v1.rb +1144 -0
  38. data/test/unit/test_iam_token_manager.rb +165 -0
  39. data/test/unit/test_language_translator_v3.rb +461 -0
  40. data/test/unit/test_natural_language_classifier_v1.rb +187 -0
  41. data/test/unit/test_natural_language_understanding_v1.rb +132 -0
  42. data/test/unit/test_personality_insights_v3.rb +172 -0
  43. data/test/unit/test_speech_to_text_v1.rb +755 -0
  44. data/test/unit/test_text_to_speech_v1.rb +336 -0
  45. data/test/unit/test_tone_analyzer_v3.rb +200 -0
  46. data/test/unit/test_vcap_using_personality_insights.rb +150 -0
  47. data/test/unit/test_visual_recognition_v3.rb +345 -0
  48. metadata +302 -0
@@ -0,0 +1,645 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative("./../test_helper.rb")
4
+ SimpleCov.command_name "test:integration"
5
+
6
+ # Integration tests for the Watson Assistant V1 Service
7
+ class AssistantV1Test < Minitest::Test
8
+ def test_create_update_delete_workspace
9
+ service = IBMWatson::AssistantV1.new(
10
+ username: ENV["ASSISTANT_USERNAME"],
11
+ password: ENV["ASSISTANT_PASSWORD"],
12
+ version: "2018-02-16"
13
+ )
14
+ service.add_default_headers(
15
+ headers: {
16
+ "X-Watson-Learning-Opt-Out" => "1",
17
+ "X-Watson-Test" => "1"
18
+ }
19
+ )
20
+ service_response = service.create_workspace(
21
+ name: "Pizza app",
22
+ description: "Pizza app",
23
+ language: "en",
24
+ metadata: {}
25
+ )
26
+ workspace_id = service_response.result["workspace_id"]
27
+ assert((200..299).cover?(service_response.status))
28
+
29
+ service_response = service.update_workspace(
30
+ workspace_id: workspace_id,
31
+ name: "Pizza app",
32
+ description: "Pizza app",
33
+ language: "en",
34
+ metadata: {}
35
+ )
36
+ assert((200..299).cover?(service_response.status))
37
+
38
+ service_response = service.delete_workspace(
39
+ workspace_id: workspace_id
40
+ )
41
+ assert(service_response.nil?)
42
+ end
43
+
44
+ def test_get_workspace
45
+ service = IBMWatson::AssistantV1.new(
46
+ username: ENV["ASSISTANT_USERNAME"],
47
+ password: ENV["ASSISTANT_PASSWORD"],
48
+ version: "2018-02-16"
49
+ )
50
+ service.add_default_headers(
51
+ headers: {
52
+ "X-Watson-Learning-Opt-Out" => "1",
53
+ "X-Watson-Test" => "1"
54
+ }
55
+ )
56
+ service_response = service.get_workspace(
57
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
58
+ export: false
59
+ )
60
+ assert((200..299).cover?(service_response.status))
61
+ end
62
+
63
+ def test_list_workspaces
64
+ service = IBMWatson::AssistantV1.new(
65
+ username: ENV["ASSISTANT_USERNAME"],
66
+ password: ENV["ASSISTANT_PASSWORD"],
67
+ version: "2018-02-16"
68
+ )
69
+ service.add_default_headers(
70
+ headers: {
71
+ "X-Watson-Learning-Opt-Out" => "1",
72
+ "X-Watson-Test" => "1"
73
+ }
74
+ )
75
+ service_response = service.list_workspaces
76
+ assert((200..299).cover?(service_response.status))
77
+ end
78
+
79
+ def test_create_update_delete_counterexample
80
+ service = IBMWatson::AssistantV1.new(
81
+ version: "2018-02-16",
82
+ username: ENV["ASSISTANT_USERNAME"],
83
+ password: ENV["ASSISTANT_PASSWORD"]
84
+ )
85
+ service.add_default_headers(
86
+ headers: {
87
+ "X-Watson-Learning-Opt-Out" => "1",
88
+ "X-Watson-Test" => "1"
89
+ }
90
+ )
91
+ service_response = service.create_counterexample(
92
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
93
+ text: "I want a large pizza please."
94
+ )
95
+ assert((200..299).cover?(service_response.status))
96
+
97
+ service_response = service.update_counterexample(
98
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
99
+ text: "I want a large pizza please.",
100
+ new_text: "I want a large pizza please."
101
+ )
102
+ assert((200..299).cover?(service_response.status))
103
+
104
+ service_response = service.delete_counterexample(
105
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
106
+ text: "I want a large pizza please."
107
+ )
108
+ assert(service_response.nil?)
109
+ end
110
+
111
+ def test_get_counterexample
112
+ service = IBMWatson::AssistantV1.new(
113
+ username: ENV["ASSISTANT_USERNAME"],
114
+ password: ENV["ASSISTANT_PASSWORD"],
115
+ version: "2018-02-16"
116
+ )
117
+ service.add_default_headers(
118
+ headers: {
119
+ "X-Watson-Learning-Opt-Out" => "1",
120
+ "X-Watson-Test" => "1"
121
+ }
122
+ )
123
+ service_response = service.get_counterexample(
124
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
125
+ text: "what is your nickname"
126
+ )
127
+ assert((200..299).cover?(service_response.status))
128
+ end
129
+
130
+ def test_list_counterexamples
131
+ service = IBMWatson::AssistantV1.new(
132
+ username: ENV["ASSISTANT_USERNAME"],
133
+ password: ENV["ASSISTANT_PASSWORD"],
134
+ version: "2018-02-16"
135
+ )
136
+ service.add_default_headers(
137
+ headers: {
138
+ "X-Watson-Learning-Opt-Out" => "1",
139
+ "X-Watson-Test" => "1"
140
+ }
141
+ )
142
+ service_response = service.list_counterexamples(
143
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"]
144
+ )
145
+ assert((200..299).cover?(service_response.status))
146
+ end
147
+
148
+ def test_create_update_delete_entity
149
+ service = IBMWatson::AssistantV1.new(
150
+ username: ENV["ASSISTANT_USERNAME"],
151
+ password: ENV["ASSISTANT_PASSWORD"],
152
+ version: "2018-02-16"
153
+ )
154
+ service.add_default_headers(
155
+ headers: {
156
+ "X-Watson-Learning-Opt-Out" => "1",
157
+ "X-Watson-Test" => "1"
158
+ }
159
+ )
160
+ service_response = service.create_entity(
161
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
162
+ entity: "pizza_toppings",
163
+ description: "Tasty pizza toppings",
164
+ metadata: { "property" => "value" },
165
+ values: nil,
166
+ fuzzy_match: nil
167
+ )
168
+ assert((200..299).cover?(service_response.status))
169
+
170
+ service_response = service.update_entity(
171
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
172
+ entity: "pizza_toppings",
173
+ new_entity: "pizza_toppings"
174
+ )
175
+ assert((200..299).cover?(service_response.status))
176
+
177
+ service_response = service.delete_entity(
178
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
179
+ entity: "pizza_toppings"
180
+ )
181
+ assert(service_response.nil?)
182
+ end
183
+
184
+ def test_get_entity
185
+ service = IBMWatson::AssistantV1.new(
186
+ username: ENV["ASSISTANT_USERNAME"],
187
+ password: ENV["ASSISTANT_PASSWORD"],
188
+ version: "2018-02-16"
189
+ )
190
+ service.add_default_headers(
191
+ headers: {
192
+ "X-Watson-Learning-Opt-Out" => "1",
193
+ "X-Watson-Test" => "1"
194
+ }
195
+ )
196
+ service_response = service.get_entity(
197
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
198
+ entity: "holiday",
199
+ export: true
200
+ )
201
+ assert((200..299).cover?(service_response.status))
202
+ end
203
+
204
+ def test_list_entities
205
+ service = IBMWatson::AssistantV1.new(
206
+ username: ENV["ASSISTANT_USERNAME"],
207
+ password: ENV["ASSISTANT_PASSWORD"],
208
+ version: "2018-02-16"
209
+ )
210
+ service.add_default_headers(
211
+ headers: {
212
+ "X-Watson-Learning-Opt-Out" => "1",
213
+ "X-Watson-Test" => "1"
214
+ }
215
+ )
216
+ service_response = service.list_entities(
217
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
218
+ export: true
219
+ )
220
+ assert((200..299).cover?(service_response.status))
221
+ end
222
+
223
+ def test_create_update_delete_example
224
+ service = IBMWatson::AssistantV1.new(
225
+ username: ENV["ASSISTANT_USERNAME"],
226
+ password: ENV["ASSISTANT_PASSWORD"],
227
+ version: "2018-02-16"
228
+ )
229
+ service.add_default_headers(
230
+ headers: {
231
+ "X-Watson-Learning-Opt-Out" => "1",
232
+ "X-Watson-Test" => "1"
233
+ }
234
+ )
235
+ service_response = service.create_example(
236
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
237
+ intent: "Cancel",
238
+ text: "Gimme a pizza with pepperoni"
239
+ )
240
+ assert((200..299).cover?(service_response.status))
241
+
242
+ service_response = service.update_example(
243
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
244
+ intent: "Cancel",
245
+ text: "Gimme a pizza with pepperoni",
246
+ new_text: "Gimme a pizza with pepperoni"
247
+ )
248
+ assert((200..299).cover?(service_response.status))
249
+
250
+ service_response = service.delete_example(
251
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
252
+ intent: "Cancel",
253
+ text: "Gimme a pizza with pepperoni"
254
+ )
255
+ assert(service_response.nil?)
256
+ end
257
+
258
+ def test_get_example
259
+ service = IBMWatson::AssistantV1.new(
260
+ username: ENV["ASSISTANT_USERNAME"],
261
+ password: ENV["ASSISTANT_PASSWORD"],
262
+ version: "2018-02-16"
263
+ )
264
+ service.add_default_headers(
265
+ headers: {
266
+ "X-Watson-Learning-Opt-Out" => "1",
267
+ "X-Watson-Test" => "1"
268
+ }
269
+ )
270
+ service_response = service.get_example(
271
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
272
+ intent: "Cancel",
273
+ text: "forget it"
274
+ )
275
+ assert((200..299).cover?(service_response.status))
276
+ end
277
+
278
+ def test_list_examples
279
+ service = IBMWatson::AssistantV1.new(
280
+ username: ENV["ASSISTANT_USERNAME"],
281
+ password: ENV["ASSISTANT_PASSWORD"],
282
+ version: "2018-02-16"
283
+ )
284
+ service.add_default_headers(
285
+ headers: {
286
+ "X-Watson-Learning-Opt-Out" => "1",
287
+ "X-Watson-Test" => "1"
288
+ }
289
+ )
290
+ service_response = service.list_examples(
291
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
292
+ intent: "Cancel"
293
+ )
294
+ assert((200..299).cover?(service_response.status))
295
+ end
296
+
297
+ def test_create_update_delete_intent
298
+ service = IBMWatson::AssistantV1.new(
299
+ username: ENV["ASSISTANT_USERNAME"],
300
+ password: ENV["ASSISTANT_PASSWORD"],
301
+ version: "2018-02-16"
302
+ )
303
+ service.add_default_headers(
304
+ headers: {
305
+ "X-Watson-Learning-Opt-Out" => "1",
306
+ "X-Watson-Test" => "1"
307
+ }
308
+ )
309
+ service_response = service.create_intent(
310
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
311
+ intent: "pizza_order",
312
+ description: "User wants to start a new pizza order"
313
+ )
314
+ assert((200..299).cover?(service_response.status))
315
+
316
+ service_response = service.update_intent(
317
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
318
+ intent: "pizza_order",
319
+ new_intent: "pizza_order",
320
+ new_description: "User wants to start a new pizza order"
321
+ )
322
+ assert((200..299).cover?(service_response.status))
323
+
324
+ service_response = service.delete_intent(
325
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
326
+ intent: "pizza_order"
327
+ )
328
+ assert(service_response.nil?)
329
+ end
330
+
331
+ def test_get_intent
332
+ service = IBMWatson::AssistantV1.new(
333
+ username: ENV["ASSISTANT_USERNAME"],
334
+ password: ENV["ASSISTANT_PASSWORD"],
335
+ version: "2018-02-16"
336
+ )
337
+ service.add_default_headers(
338
+ headers: {
339
+ "X-Watson-Learning-Opt-Out" => "1",
340
+ "X-Watson-Test" => "1"
341
+ }
342
+ )
343
+ service_response = service.get_intent(
344
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
345
+ intent: "Cancel",
346
+ export: false
347
+ )
348
+ assert((200..299).cover?(service_response.status))
349
+ end
350
+
351
+ def test_list_intents
352
+ service = IBMWatson::AssistantV1.new(
353
+ username: ENV["ASSISTANT_USERNAME"],
354
+ password: ENV["ASSISTANT_PASSWORD"],
355
+ version: "2018-02-16"
356
+ )
357
+ service.add_default_headers(
358
+ headers: {
359
+ "X-Watson-Learning-Opt-Out" => "1",
360
+ "X-Watson-Test" => "1"
361
+ }
362
+ )
363
+ service_response = service.list_intents(
364
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
365
+ export: false
366
+ )
367
+ assert((200..299).cover?(service_response.status))
368
+ end
369
+
370
+ def test_list_logs
371
+ service = IBMWatson::AssistantV1.new(
372
+ username: ENV["ASSISTANT_USERNAME"],
373
+ password: ENV["ASSISTANT_PASSWORD"],
374
+ version: "2018-02-16"
375
+ )
376
+ service.add_default_headers(
377
+ headers: {
378
+ "X-Watson-Learning-Opt-Out" => "1",
379
+ "X-Watson-Test" => "1"
380
+ }
381
+ )
382
+ service_response = service.list_logs(
383
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"]
384
+ )
385
+ assert((200..299).cover?(service_response.status))
386
+ end
387
+
388
+ def test_list_all_logs
389
+ service = IBMWatson::AssistantV1.new(
390
+ username: ENV["ASSISTANT_USERNAME"],
391
+ password: ENV["ASSISTANT_PASSWORD"],
392
+ version: "2018-02-16"
393
+ )
394
+ service.add_default_headers(
395
+ headers: {
396
+ "X-Watson-Learning-Opt-Out" => "1",
397
+ "X-Watson-Test" => "1"
398
+ }
399
+ )
400
+ service_response = service.list_all_logs(
401
+ filter: "language::en,request.context.metadata.deployment::deployment_1"
402
+ )
403
+ assert((200..299).cover?(service_response.status))
404
+ end
405
+
406
+ def test_message
407
+ service = IBMWatson::AssistantV1.new(
408
+ username: ENV["ASSISTANT_USERNAME"],
409
+ password: ENV["ASSISTANT_PASSWORD"],
410
+ version: "2018-02-16"
411
+ )
412
+ service.add_default_headers(
413
+ headers: {
414
+ "X-Watson-Learning-Opt-Out" => "1",
415
+ "X-Watson-Test" => "1"
416
+ }
417
+ )
418
+ service_response = service.message(
419
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
420
+ input: { "text" => "Turn on the lights" },
421
+ context: nil
422
+ )
423
+ assert((200..299).cover?(service_response.status))
424
+
425
+ context = service_response.result["context"]
426
+ service_response = service.message(
427
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
428
+ input: { "text" => "Turn on the lights" },
429
+ context: context
430
+ )
431
+ assert((200..299).cover?(service_response.status))
432
+ end
433
+
434
+ def test_create_update_delete_synonym
435
+ service = IBMWatson::AssistantV1.new(
436
+ username: ENV["ASSISTANT_USERNAME"],
437
+ password: ENV["ASSISTANT_PASSWORD"],
438
+ version: "2018-02-16"
439
+ )
440
+ service.add_default_headers(
441
+ headers: {
442
+ "X-Watson-Learning-Opt-Out" => "1",
443
+ "X-Watson-Test" => "1"
444
+ }
445
+ )
446
+ service_response = service.create_synonym(
447
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
448
+ entity: "holiday",
449
+ value: "labor day",
450
+ synonym: "a"
451
+ )
452
+ assert((200..299).cover?(service_response.status))
453
+
454
+ service_response = service.update_synonym(
455
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
456
+ entity: "holiday",
457
+ value: "labor day",
458
+ synonym: "a",
459
+ new_synonym: "a"
460
+ )
461
+ assert((200..299).cover?(service_response.status))
462
+
463
+ service_response = service.delete_synonym(
464
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
465
+ entity: "holiday",
466
+ value: "labor day",
467
+ synonym: "a"
468
+ )
469
+ assert(service_response.nil?)
470
+ end
471
+
472
+ def test_get_synonym
473
+ service = IBMWatson::AssistantV1.new(
474
+ username: ENV["ASSISTANT_USERNAME"],
475
+ password: ENV["ASSISTANT_PASSWORD"],
476
+ version: "2018-02-16"
477
+ )
478
+ service.add_default_headers(
479
+ headers: {
480
+ "X-Watson-Learning-Opt-Out" => "1",
481
+ "X-Watson-Test" => "1"
482
+ }
483
+ )
484
+ service_response = service.get_synonym(
485
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
486
+ entity: "holiday",
487
+ value: "thanksgiving",
488
+ synonym: "turkey day"
489
+ )
490
+ assert((200..299).cover?(service_response.status))
491
+ end
492
+
493
+ def test_list_synonyms
494
+ service = IBMWatson::AssistantV1.new(
495
+ username: ENV["ASSISTANT_USERNAME"],
496
+ password: ENV["ASSISTANT_PASSWORD"],
497
+ version: "2018-02-16"
498
+ )
499
+ service.add_default_headers(
500
+ headers: {
501
+ "X-Watson-Learning-Opt-Out" => "1",
502
+ "X-Watson-Test" => "1"
503
+ }
504
+ )
505
+ service_response = service.list_synonyms(
506
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
507
+ entity: "holiday",
508
+ value: "new years eve"
509
+ )
510
+ assert((200..299).cover?(service_response.status))
511
+ end
512
+
513
+ def test_create_update_delete_value
514
+ service = IBMWatson::AssistantV1.new(
515
+ username: ENV["ASSISTANT_USERNAME"],
516
+ password: ENV["ASSISTANT_PASSWORD"],
517
+ version: "2018-02-16"
518
+ )
519
+ service.add_default_headers(
520
+ headers: {
521
+ "X-Watson-Learning-Opt-Out" => "1",
522
+ "X-Watson-Test" => "1"
523
+ }
524
+ )
525
+ service_response = service.create_value(
526
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
527
+ entity: "holiday",
528
+ value: "aeiou"
529
+ )
530
+ assert((200..299).cover?(service_response.status))
531
+
532
+ service_response = service.update_value(
533
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
534
+ entity: "holiday",
535
+ value: "aeiou",
536
+ new_value: "BBQ sauce",
537
+ new_metadata: { "code" => 1422 },
538
+ new_synonyms: nil
539
+ )
540
+ assert((200..299).cover?(service_response.status))
541
+
542
+ service_response = service.delete_value(
543
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
544
+ entity: "holiday",
545
+ value: "BBQ sauce"
546
+ )
547
+ assert(service_response.nil?)
548
+ end
549
+
550
+ def test_get_value
551
+ service = IBMWatson::AssistantV1.new(
552
+ username: ENV["ASSISTANT_USERNAME"],
553
+ password: ENV["ASSISTANT_PASSWORD"],
554
+ version: "2018-02-16"
555
+ )
556
+ service.add_default_headers(
557
+ headers: {
558
+ "X-Watson-Learning-Opt-Out" => "1",
559
+ "X-Watson-Test" => "1"
560
+ }
561
+ )
562
+ service_response = service.get_value(
563
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
564
+ entity: "holiday",
565
+ value: "christmas",
566
+ export: true
567
+ )
568
+ assert((200..299).cover?(service_response.status))
569
+ end
570
+
571
+ def test_list_values
572
+ service = IBMWatson::AssistantV1.new(
573
+ username: ENV["ASSISTANT_USERNAME"],
574
+ password: ENV["ASSISTANT_PASSWORD"],
575
+ version: "2018-02-16"
576
+ )
577
+ service.add_default_headers(
578
+ headers: {
579
+ "X-Watson-Learning-Opt-Out" => "1",
580
+ "X-Watson-Test" => "1"
581
+ }
582
+ )
583
+ service_response = service.list_values(
584
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
585
+ entity: "holiday",
586
+ export: true
587
+ )
588
+ assert((200..299).cover?(service_response.status))
589
+ end
590
+
591
+ def test_dialog_nodes
592
+ service = IBMWatson::AssistantV1.new(
593
+ username: ENV["ASSISTANT_USERNAME"],
594
+ password: ENV["ASSISTANT_PASSWORD"],
595
+ version: "2018-02-16"
596
+ )
597
+ service.add_default_headers(
598
+ headers: {
599
+ "X-Watson-Learning-Opt-Out" => "1",
600
+ "X-Watson-Test" => "1"
601
+ }
602
+ )
603
+
604
+ service_response = service.create_dialog_node(
605
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
606
+ dialog_node: "location-done"
607
+ )
608
+ assert((200..299).cover?(service_response.status))
609
+
610
+ service_response = service.delete_dialog_node(
611
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
612
+ dialog_node: "location-done"
613
+ )
614
+ assert(service_response.nil?)
615
+
616
+ service_response = service.get_dialog_node(
617
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"],
618
+ dialog_node: "Hours of Operation"
619
+ )
620
+ assert((200..299).cover?(service_response.status))
621
+
622
+ service_response = service.list_dialog_nodes(
623
+ workspace_id: ENV["ASSISTANT_WORKSPACE_ID"]
624
+ )
625
+ assert((200..299).cover?(service_response.status))
626
+ end
627
+
628
+ def test_delete_user_data
629
+ service = IBMWatson::AssistantV1.new(
630
+ username: ENV["ASSISTANT_USERNAME"],
631
+ password: ENV["ASSISTANT_PASSWORD"],
632
+ version: "2018-02-16"
633
+ )
634
+ service.add_default_headers(
635
+ headers: {
636
+ "X-Watson-Learning-Opt-Out" => "1",
637
+ "X-Watson-Test" => "1"
638
+ }
639
+ )
640
+ service_response = service.delete_user_data(
641
+ customer_id: "id"
642
+ )
643
+ assert(service_response.nil?)
644
+ end
645
+ end