ibm_watson 1.0.0.rc2 → 1.0.0.rc3
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.
- checksums.yaml +4 -4
- data/README.md +33 -27
- data/lib/ibm_watson/assistant_v1.rb +6 -80
- data/lib/ibm_watson/assistant_v2.rb +6 -38
- data/lib/ibm_watson/compare_comply_v1.rb +6 -47
- data/lib/ibm_watson/discovery_v1.rb +12 -297
- data/lib/ibm_watson/language_translator_v3.rb +6 -41
- data/lib/ibm_watson/natural_language_classifier_v1.rb +6 -35
- data/lib/ibm_watson/natural_language_understanding_v1.rb +6 -38
- data/lib/ibm_watson/personality_insights_v3.rb +6 -30
- data/lib/ibm_watson/speech_to_text_v1.rb +9 -130
- data/lib/ibm_watson/text_to_speech_v1.rb +6 -50
- data/lib/ibm_watson/tone_analyzer_v3.rb +6 -31
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +8 -103
- data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +5 -5
- data/lib/ibm_watson.rb +9 -0
- data/test/integration/test_assistant_v1.rb +1 -1
- data/test/integration/test_assistant_v2.rb +1 -1
- data/test/integration/test_compare_comply_v1.rb +1 -1
- data/test/integration/test_discovery_v1.rb +1 -4
- data/test/integration/test_language_translator_v3.rb +1 -1
- data/test/integration/test_natural_language_classifier_v1.rb +1 -1
- data/test/integration/test_natural_language_understanding_v1.rb +1 -1
- data/test/integration/test_personality_insights_v3.rb +1 -1
- data/test/integration/test_speech_to_text_v1.rb +2 -2
- data/test/integration/test_text_to_speech_v1.rb +1 -1
- data/test/integration/test_tone_analyzer_v3.rb +1 -1
- data/test/integration/test_visual_recognition_v3.rb +1 -8
- data/test/unit/test_assistant_v1.rb +45 -45
- data/test/unit/test_assistant_v2.rb +3 -3
- data/test/unit/test_compare_comply_v1.rb +12 -12
- data/test/unit/test_configure_http_client.rb +37 -13
- data/test/unit/test_discovery_v1.rb +47 -139
- data/test/unit/test_language_translator_v3.rb +13 -26
- data/test/unit/test_natural_language_classifier_v1.rb +2 -2
- data/test/unit/test_natural_language_understanding_v1.rb +5 -5
- data/test/unit/test_personality_insights_v3.rb +8 -8
- data/test/unit/test_speech_to_text_v1.rb +21 -21
- data/test/unit/test_text_to_speech_v1.rb +5 -5
- data/test/unit/test_tone_analyzer_v3.rb +9 -9
- data/test/unit/test_vcap_using_personality_insights.rb +8 -8
- data/test/unit/test_visual_recognition_v3.rb +8 -75
- metadata +4 -4
@@ -40,7 +40,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
40
40
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
41
41
|
headers: {
|
42
42
|
"Accept" => "application/json",
|
43
|
-
"Authorization" => "Basic Yng6Yng=",
|
44
43
|
"Content-Type" => "application/x-www-form-urlencoded",
|
45
44
|
"Host" => "iam.cloud.ibm.com"
|
46
45
|
}
|
@@ -49,7 +48,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
49
48
|
body: token_response.to_json,
|
50
49
|
headers: {}
|
51
50
|
)
|
52
|
-
authenticator =
|
51
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
53
52
|
apikey: "iam_apikey"
|
54
53
|
)
|
55
54
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -86,7 +85,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
86
85
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
87
86
|
headers: {
|
88
87
|
"Accept" => "application/json",
|
89
|
-
"Authorization" => "Basic Yng6Yng=",
|
90
88
|
"Content-Type" => "application/x-www-form-urlencoded",
|
91
89
|
"Host" => "iam.cloud.ibm.com"
|
92
90
|
}
|
@@ -95,7 +93,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
95
93
|
body: token_response.to_json,
|
96
94
|
headers: {}
|
97
95
|
)
|
98
|
-
authenticator =
|
96
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
99
97
|
apikey: "iam_apikey"
|
100
98
|
)
|
101
99
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -135,7 +133,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
135
133
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
136
134
|
headers: {
|
137
135
|
"Accept" => "application/json",
|
138
|
-
"Authorization" => "Basic Yng6Yng=",
|
139
136
|
"Content-Type" => "application/x-www-form-urlencoded",
|
140
137
|
"Host" => "iam.cloud.ibm.com"
|
141
138
|
}
|
@@ -144,7 +141,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
144
141
|
body: token_response.to_json,
|
145
142
|
headers: {}
|
146
143
|
)
|
147
|
-
authenticator =
|
144
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
148
145
|
apikey: "iam_apikey"
|
149
146
|
)
|
150
147
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -190,7 +187,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
190
187
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
191
188
|
headers: {
|
192
189
|
"Accept" => "application/json",
|
193
|
-
"Authorization" => "Basic Yng6Yng=",
|
194
190
|
"Content-Type" => "application/x-www-form-urlencoded",
|
195
191
|
"Host" => "iam.cloud.ibm.com"
|
196
192
|
}
|
@@ -199,7 +195,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
199
195
|
body: token_response.to_json,
|
200
196
|
headers: {}
|
201
197
|
)
|
202
|
-
authenticator =
|
198
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
203
199
|
apikey: "iam_apikey"
|
204
200
|
)
|
205
201
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -252,7 +248,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
252
248
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
253
249
|
headers: {
|
254
250
|
"Accept" => "application/json",
|
255
|
-
"Authorization" => "Basic Yng6Yng=",
|
256
251
|
"Content-Type" => "application/x-www-form-urlencoded",
|
257
252
|
"Host" => "iam.cloud.ibm.com"
|
258
253
|
}
|
@@ -261,7 +256,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
261
256
|
body: token_response.to_json,
|
262
257
|
headers: {}
|
263
258
|
)
|
264
|
-
authenticator =
|
259
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
265
260
|
apikey: "iam_apikey"
|
266
261
|
)
|
267
262
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -320,7 +315,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
320
315
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
321
316
|
headers: {
|
322
317
|
"Accept" => "application/json",
|
323
|
-
"Authorization" => "Basic Yng6Yng=",
|
324
318
|
"Content-Type" => "application/x-www-form-urlencoded",
|
325
319
|
"Host" => "iam.cloud.ibm.com"
|
326
320
|
}
|
@@ -329,7 +323,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
329
323
|
body: token_response.to_json,
|
330
324
|
headers: {}
|
331
325
|
)
|
332
|
-
authenticator =
|
326
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
333
327
|
apikey: "iam_apikey"
|
334
328
|
)
|
335
329
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -360,7 +354,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
360
354
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
361
355
|
headers: {
|
362
356
|
"Accept" => "application/json",
|
363
|
-
"Authorization" => "Basic Yng6Yng=",
|
364
357
|
"Content-Type" => "application/x-www-form-urlencoded",
|
365
358
|
"Host" => "iam.cloud.ibm.com"
|
366
359
|
}
|
@@ -369,7 +362,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
369
362
|
body: token_response.to_json,
|
370
363
|
headers: {}
|
371
364
|
)
|
372
|
-
authenticator =
|
365
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
373
366
|
apikey: "iam_apikey"
|
374
367
|
)
|
375
368
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -409,7 +402,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
409
402
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
410
403
|
headers: {
|
411
404
|
"Accept" => "application/json",
|
412
|
-
"Authorization" => "Basic Yng6Yng=",
|
413
405
|
"Content-Type" => "application/x-www-form-urlencoded",
|
414
406
|
"Host" => "iam.cloud.ibm.com"
|
415
407
|
}
|
@@ -418,7 +410,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
418
410
|
body: token.to_json,
|
419
411
|
headers: {}
|
420
412
|
)
|
421
|
-
authenticator =
|
413
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
422
414
|
apikey: "iam_apikey"
|
423
415
|
)
|
424
416
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -472,7 +464,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
472
464
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
473
465
|
headers: {
|
474
466
|
"Accept" => "application/json",
|
475
|
-
"Authorization" => "Basic Yng6Yng=",
|
476
467
|
"Content-Type" => "application/x-www-form-urlencoded",
|
477
468
|
"Host" => "iam.cloud.ibm.com"
|
478
469
|
}
|
@@ -481,7 +472,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
481
472
|
body: token_response.to_json,
|
482
473
|
headers: {}
|
483
474
|
)
|
484
|
-
authenticator =
|
475
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
485
476
|
apikey: "iam_apikey"
|
486
477
|
)
|
487
478
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -508,7 +499,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
508
499
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
509
500
|
headers: {
|
510
501
|
"Accept" => "application/json",
|
511
|
-
"Authorization" => "Basic Yng6Yng=",
|
512
502
|
"Content-Type" => "application/x-www-form-urlencoded",
|
513
503
|
"Host" => "iam.cloud.ibm.com"
|
514
504
|
}
|
@@ -517,7 +507,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
517
507
|
body: token_response.to_json,
|
518
508
|
headers: {}
|
519
509
|
)
|
520
|
-
authenticator =
|
510
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
521
511
|
apikey: "iam_apikey"
|
522
512
|
)
|
523
513
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -540,7 +530,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
540
530
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
541
531
|
headers: {
|
542
532
|
"Accept" => "application/json",
|
543
|
-
"Authorization" => "Basic Yng6Yng=",
|
544
533
|
"Content-Type" => "application/x-www-form-urlencoded",
|
545
534
|
"Host" => "iam.cloud.ibm.com"
|
546
535
|
}
|
@@ -549,7 +538,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
549
538
|
body: token_response.to_json,
|
550
539
|
headers: {}
|
551
540
|
)
|
552
|
-
authenticator =
|
541
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
553
542
|
apikey: "iam_apikey"
|
554
543
|
)
|
555
544
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -576,7 +565,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
576
565
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
577
566
|
headers: {
|
578
567
|
"Accept" => "application/json",
|
579
|
-
"Authorization" => "Basic Yng6Yng=",
|
580
568
|
"Content-Type" => "application/x-www-form-urlencoded",
|
581
569
|
"Host" => "iam.cloud.ibm.com"
|
582
570
|
}
|
@@ -585,7 +573,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
585
573
|
body: token_response.to_json,
|
586
574
|
headers: {}
|
587
575
|
)
|
588
|
-
authenticator =
|
576
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
589
577
|
apikey: "iam_apikey"
|
590
578
|
)
|
591
579
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -612,7 +600,6 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
612
600
|
body: { "apikey" => "iam_apikey", "grant_type" => "urn:ibm:params:oauth:grant-type:apikey", "response_type" => "cloud_iam" },
|
613
601
|
headers: {
|
614
602
|
"Accept" => "application/json",
|
615
|
-
"Authorization" => "Basic Yng6Yng=",
|
616
603
|
"Content-Type" => "application/x-www-form-urlencoded",
|
617
604
|
"Host" => "iam.cloud.ibm.com"
|
618
605
|
}
|
@@ -621,7 +608,7 @@ class LanguageTranslatorV3Test < Minitest::Test
|
|
621
608
|
body: token_response.to_json,
|
622
609
|
headers: {}
|
623
610
|
)
|
624
|
-
authenticator =
|
611
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
625
612
|
apikey: "iam_apikey"
|
626
613
|
)
|
627
614
|
service = IBMWatson::LanguageTranslatorV3.new(
|
@@ -9,7 +9,7 @@ WebMock.disable_net_connect!(allow_localhost: true)
|
|
9
9
|
# Unit tests for the Natural Language Classifier V1 Service
|
10
10
|
class NaturalLanguageClassifierV1Test < Minitest::Test
|
11
11
|
def test_success
|
12
|
-
authenticator =
|
12
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
13
13
|
username: "username",
|
14
14
|
password: "password"
|
15
15
|
)
|
@@ -129,7 +129,7 @@ class NaturalLanguageClassifierV1Test < Minitest::Test
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def test_classify_collection
|
132
|
-
authenticator =
|
132
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
133
133
|
username: "username",
|
134
134
|
password: "password"
|
135
135
|
)
|
@@ -9,7 +9,7 @@ WebMock.disable_net_connect!(allow_localhost: true)
|
|
9
9
|
# Unit tests for the Natural Language Understanding V1 Service
|
10
10
|
class NaturalLanguageUnderstandingV1Test < Minitest::Test
|
11
11
|
def test_text_analyze
|
12
|
-
authenticator =
|
12
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
13
13
|
username: "username",
|
14
14
|
password: "password"
|
15
15
|
)
|
@@ -37,7 +37,7 @@ class NaturalLanguageUnderstandingV1Test < Minitest::Test
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_html_analyze
|
40
|
-
authenticator =
|
40
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
41
41
|
username: "username",
|
42
42
|
password: "password"
|
43
43
|
)
|
@@ -68,7 +68,7 @@ class NaturalLanguageUnderstandingV1Test < Minitest::Test
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def test_url_analyze
|
71
|
-
authenticator =
|
71
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
72
72
|
username: "username",
|
73
73
|
password: "password"
|
74
74
|
)
|
@@ -101,7 +101,7 @@ class NaturalLanguageUnderstandingV1Test < Minitest::Test
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def test_list_models
|
104
|
-
authenticator =
|
104
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
105
105
|
username: "username",
|
106
106
|
password: "password"
|
107
107
|
)
|
@@ -123,7 +123,7 @@ class NaturalLanguageUnderstandingV1Test < Minitest::Test
|
|
123
123
|
|
124
124
|
def test_delete_model
|
125
125
|
model_id = "invalid_model_id"
|
126
|
-
authenticator =
|
126
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
127
127
|
username: "username",
|
128
128
|
password: "password"
|
129
129
|
)
|
@@ -14,7 +14,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
14
14
|
headers = {
|
15
15
|
"Content-Type" => "application/json"
|
16
16
|
}
|
17
|
-
expected_response =
|
17
|
+
expected_response = IBMWatson::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,
|
@@ -25,7 +25,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
25
25
|
"Host" => "gateway.watsonplatform.net"
|
26
26
|
}
|
27
27
|
).to_return(status: 200, body: profile_response, headers: headers)
|
28
|
-
authenticator =
|
28
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
29
29
|
username: "username",
|
30
30
|
password: "password"
|
31
31
|
)
|
@@ -69,7 +69,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
69
69
|
headers = {
|
70
70
|
"Content-Type" => "application/json"
|
71
71
|
}
|
72
|
-
expected_response =
|
72
|
+
expected_response = IBMWatson::DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
|
73
73
|
stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&raw_scores=true&version=2017-10-13")
|
74
74
|
.with(
|
75
75
|
body: personality_text,
|
@@ -80,7 +80,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
80
80
|
"Host" => "gateway.watsonplatform.net"
|
81
81
|
}
|
82
82
|
).to_return(status: 200, body: profile_response, headers: headers)
|
83
|
-
authenticator =
|
83
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
84
84
|
username: "username",
|
85
85
|
password: "password"
|
86
86
|
)
|
@@ -109,7 +109,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
109
109
|
headers = {
|
110
110
|
"Content-Type" => "text/csv"
|
111
111
|
}
|
112
|
-
expected_response =
|
112
|
+
expected_response = IBMWatson::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
|
113
113
|
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")
|
114
114
|
.with(
|
115
115
|
body: personality_text,
|
@@ -120,7 +120,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
120
120
|
"Host" => "gateway.watsonplatform.net"
|
121
121
|
}
|
122
122
|
).to_return(status: 200, body: profile_response, headers: headers)
|
123
|
-
authenticator =
|
123
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
124
124
|
username: "username",
|
125
125
|
password: "password"
|
126
126
|
)
|
@@ -150,7 +150,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
150
150
|
headers = {
|
151
151
|
"Content-Type" => "application/json"
|
152
152
|
}
|
153
|
-
expected_response =
|
153
|
+
expected_response = IBMWatson::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
|
154
154
|
stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
|
155
155
|
.with(
|
156
156
|
body: personality_text,
|
@@ -163,7 +163,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
163
163
|
"Host" => "gateway.watsonplatform.net"
|
164
164
|
}
|
165
165
|
).to_return(status: 200, body: profile_response.to_json, headers: headers)
|
166
|
-
authenticator =
|
166
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
167
167
|
username: "username",
|
168
168
|
password: "password"
|
169
169
|
)
|
@@ -36,7 +36,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
36
36
|
}
|
37
37
|
]
|
38
38
|
}
|
39
|
-
authenticator =
|
39
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
40
40
|
username: "username",
|
41
41
|
password: "password"
|
42
42
|
)
|
@@ -93,7 +93,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def test_recognize_using_websocket_disable_ssl_verification
|
96
|
-
authenticator =
|
96
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
97
97
|
username: "username",
|
98
98
|
password: "password"
|
99
99
|
)
|
@@ -127,7 +127,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def test_get_model
|
130
|
-
authenticator =
|
130
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
131
131
|
username: "username",
|
132
132
|
password: "password"
|
133
133
|
)
|
@@ -159,7 +159,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
159
159
|
}
|
160
160
|
]
|
161
161
|
}
|
162
|
-
authenticator =
|
162
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
163
163
|
username: "username",
|
164
164
|
password: "password"
|
165
165
|
)
|
@@ -220,7 +220,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
220
220
|
end
|
221
221
|
|
222
222
|
def test_callbacks
|
223
|
-
authenticator =
|
223
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
224
224
|
username: "username",
|
225
225
|
password: "password"
|
226
226
|
)
|
@@ -253,7 +253,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
253
253
|
end
|
254
254
|
|
255
255
|
def test_custom_model
|
256
|
-
authenticator =
|
256
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
257
257
|
username: "username",
|
258
258
|
password: "password"
|
259
259
|
)
|
@@ -328,7 +328,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
328
328
|
end
|
329
329
|
|
330
330
|
def test_acoustic_model
|
331
|
-
authenticator =
|
331
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
332
332
|
username: "username",
|
333
333
|
password: "password"
|
334
334
|
)
|
@@ -404,7 +404,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def test_custom_corpora
|
407
|
-
authenticator =
|
407
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
408
408
|
username: "username",
|
409
409
|
password: "password"
|
410
410
|
)
|
@@ -476,7 +476,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
476
476
|
end
|
477
477
|
|
478
478
|
def test_custom_words
|
479
|
-
authenticator =
|
479
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
480
480
|
username: "username",
|
481
481
|
password: "password"
|
482
482
|
)
|
@@ -623,7 +623,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
623
623
|
end
|
624
624
|
|
625
625
|
def test_list_grammars
|
626
|
-
authenticator =
|
626
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
627
627
|
username: "username",
|
628
628
|
password: "password"
|
629
629
|
)
|
@@ -645,7 +645,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
645
645
|
end
|
646
646
|
|
647
647
|
def test_add_grammar
|
648
|
-
authenticator =
|
648
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
649
649
|
username: "username",
|
650
650
|
password: "password"
|
651
651
|
)
|
@@ -670,7 +670,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
670
670
|
end
|
671
671
|
|
672
672
|
def test_get_grammar
|
673
|
-
authenticator =
|
673
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
674
674
|
username: "username",
|
675
675
|
password: "password"
|
676
676
|
)
|
@@ -693,7 +693,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
693
693
|
end
|
694
694
|
|
695
695
|
def test_delete_grammar
|
696
|
-
authenticator =
|
696
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
697
697
|
username: "username",
|
698
698
|
password: "password"
|
699
699
|
)
|
@@ -716,7 +716,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
716
716
|
end
|
717
717
|
|
718
718
|
def test_custom_audio_resources
|
719
|
-
authenticator =
|
719
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
720
720
|
username: "username",
|
721
721
|
password: "password"
|
722
722
|
)
|
@@ -784,7 +784,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
784
784
|
end
|
785
785
|
|
786
786
|
def test_delete_user_data
|
787
|
-
authenticator =
|
787
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
788
788
|
username: "username",
|
789
789
|
password: "password"
|
790
790
|
)
|
@@ -805,7 +805,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
805
805
|
end
|
806
806
|
|
807
807
|
def test_recognize_await
|
808
|
-
authenticator =
|
808
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
809
809
|
username: "username",
|
810
810
|
password: "password"
|
811
811
|
)
|
@@ -844,7 +844,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
844
844
|
end
|
845
845
|
|
846
846
|
def test_recognize_async
|
847
|
-
authenticator =
|
847
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
848
848
|
username: "username",
|
849
849
|
password: "password"
|
850
850
|
)
|
@@ -884,7 +884,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
884
884
|
end
|
885
885
|
|
886
886
|
def test_reset_language_model
|
887
|
-
authenticator =
|
887
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
888
888
|
username: "username",
|
889
889
|
password: "password"
|
890
890
|
)
|
@@ -904,7 +904,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
904
904
|
end
|
905
905
|
|
906
906
|
def test_upgrade_language_model
|
907
|
-
authenticator =
|
907
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
908
908
|
username: "username",
|
909
909
|
password: "password"
|
910
910
|
)
|
@@ -924,7 +924,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
924
924
|
end
|
925
925
|
|
926
926
|
def test_upgrade_acoustic_model
|
927
|
-
authenticator =
|
927
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
928
928
|
username: "username",
|
929
929
|
password: "password"
|
930
930
|
)
|
@@ -944,7 +944,7 @@ class SpeechToTextV1Test < Minitest::Test
|
|
944
944
|
end
|
945
945
|
|
946
946
|
def test_reset_acoustic_model
|
947
|
-
authenticator =
|
947
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
948
948
|
username: "username",
|
949
949
|
password: "password"
|
950
950
|
)
|
@@ -55,7 +55,7 @@ class TextToSpeechV1Test < Minitest::Test
|
|
55
55
|
"Host" => "stream.watsonplatform.net"
|
56
56
|
}
|
57
57
|
).to_return(status: 200, body: voices_response.to_json, headers: { "Content-Type" => "application/json" })
|
58
|
-
authenticator =
|
58
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
59
59
|
username: "username",
|
60
60
|
password: "password"
|
61
61
|
)
|
@@ -99,7 +99,7 @@ class TextToSpeechV1Test < Minitest::Test
|
|
99
99
|
response = {
|
100
100
|
"pronunciation" => "pronunciation info"
|
101
101
|
}
|
102
|
-
authenticator =
|
102
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
103
103
|
username: "username",
|
104
104
|
password: "password"
|
105
105
|
)
|
@@ -153,7 +153,7 @@ class TextToSpeechV1Test < Minitest::Test
|
|
153
153
|
|
154
154
|
def test_custom_voice_models
|
155
155
|
response = { "customizations" => "yep" }
|
156
|
-
authenticator =
|
156
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
157
157
|
username: "username",
|
158
158
|
password: "password"
|
159
159
|
)
|
@@ -247,7 +247,7 @@ class TextToSpeechV1Test < Minitest::Test
|
|
247
247
|
|
248
248
|
def test_custom_words
|
249
249
|
response = { "customizations" => "yep" }
|
250
|
-
authenticator =
|
250
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
251
251
|
username: "username",
|
252
252
|
password: "password"
|
253
253
|
)
|
@@ -333,7 +333,7 @@ class TextToSpeechV1Test < Minitest::Test
|
|
333
333
|
end
|
334
334
|
|
335
335
|
def test_delete_user_data
|
336
|
-
authenticator =
|
336
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
337
337
|
username: "username",
|
338
338
|
password: "password"
|
339
339
|
)
|
@@ -13,7 +13,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
13
13
|
headers = {
|
14
14
|
"Content-Type" => "application/json"
|
15
15
|
}
|
16
|
-
expected_response =
|
16
|
+
expected_response = IBMWatson::DetailedResponse.new(status: 200, headers: headers, body: tone_response)
|
17
17
|
tone_text = File.read(Dir.getwd + "/resources/personality.txt")
|
18
18
|
stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21")
|
19
19
|
.with(
|
@@ -25,7 +25,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
25
25
|
"Host" => "gateway.watsonplatform.net"
|
26
26
|
}
|
27
27
|
).to_return(status: 200, body: tone_response.to_json, headers: headers)
|
28
|
-
authenticator =
|
28
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
29
29
|
username: "username",
|
30
30
|
password: "password"
|
31
31
|
)
|
@@ -48,7 +48,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
48
48
|
"Content-Type" => "application/json"
|
49
49
|
}
|
50
50
|
tone_text = File.read(Dir.getwd + "/resources/personality.txt")
|
51
|
-
expected_response =
|
51
|
+
expected_response = IBMWatson::DetailedResponse.new(status: 200, headers: headers, body: tone_response)
|
52
52
|
stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?sentences=false&version=2017-09-21")
|
53
53
|
.with(
|
54
54
|
body: tone_text,
|
@@ -59,7 +59,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
59
59
|
"Host" => "gateway.watsonplatform.net"
|
60
60
|
}
|
61
61
|
).to_return(status: 200, body: tone_response.to_json, headers: headers)
|
62
|
-
authenticator =
|
62
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
63
63
|
username: "username",
|
64
64
|
password: "password"
|
65
65
|
)
|
@@ -81,7 +81,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
81
81
|
headers = {
|
82
82
|
"Content-Type" => "application/json"
|
83
83
|
}
|
84
|
-
expected_response =
|
84
|
+
expected_response = IBMWatson::DetailedResponse.new(body: tone_response, status: 200, headers: headers)
|
85
85
|
stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone_chat?version=2017-09-21")
|
86
86
|
.with(
|
87
87
|
body: "{\"utterances\":[{\"text\":\"I am very happy\",\"user\":\"glenn\"}]}",
|
@@ -92,7 +92,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
92
92
|
"Host" => "gateway.watsonplatform.net"
|
93
93
|
}
|
94
94
|
).to_return(status: 200, body: tone_response.to_json, headers: headers)
|
95
|
-
authenticator =
|
95
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
96
96
|
username: "username",
|
97
97
|
password: "password"
|
98
98
|
)
|
@@ -137,7 +137,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
137
137
|
"Host" => "gateway.watsonplatform.net"
|
138
138
|
}
|
139
139
|
).to_return(status: 400, body: tone_response.to_json, headers: headers)
|
140
|
-
authenticator =
|
140
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
141
141
|
username: "username",
|
142
142
|
password: "password"
|
143
143
|
)
|
@@ -172,7 +172,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
172
172
|
"Custom-Header-One" => "yes"
|
173
173
|
}
|
174
174
|
).to_return(status: 200, body: tone_response.to_json, headers: headers)
|
175
|
-
authenticator =
|
175
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
176
176
|
username: "username",
|
177
177
|
password: "password"
|
178
178
|
)
|
@@ -203,7 +203,7 @@ class ToneAnalyzerV3Test < Minitest::Test
|
|
203
203
|
"Host" => "gateway.watsonplatform.net"
|
204
204
|
}
|
205
205
|
).to_return(status: 200, body: tone_response.to_json, headers: headers)
|
206
|
-
authenticator =
|
206
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
207
207
|
username: "username",
|
208
208
|
password: "password"
|
209
209
|
)
|