ibm_watson 0.20.1 → 1.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.
- checksums.yaml +4 -4
- data/README.md +46 -60
- data/lib/ibm_watson.rb +0 -2
- data/lib/ibm_watson/assistant_v1.rb +82 -60
- data/lib/ibm_watson/assistant_v2.rb +8 -12
- data/lib/ibm_watson/compare_comply_v1.rb +21 -18
- data/lib/ibm_watson/discovery_v1.rb +107 -55
- data/lib/ibm_watson/language_translator_v3.rb +21 -23
- data/lib/ibm_watson/natural_language_classifier_v1.rb +15 -24
- data/lib/ibm_watson/natural_language_understanding_v1.rb +8 -12
- data/lib/ibm_watson/personality_insights_v3.rb +12 -24
- data/lib/ibm_watson/speech_to_text_v1.rb +90 -54
- data/lib/ibm_watson/text_to_speech_v1.rb +38 -32
- data/lib/ibm_watson/tone_analyzer_v3.rb +13 -24
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +37 -25
- data/test/integration/test_assistant_v1.rb +8 -4
- data/test/integration/test_assistant_v2.rb +6 -1
- data/test/integration/test_compare_comply_v1.rb +6 -2
- data/test/integration/test_discovery_v1.rb +4 -1
- data/test/integration/test_language_translator_v3.rb +4 -16
- data/test/integration/test_natural_language_classifier_v1.rb +4 -1
- data/test/integration/test_natural_language_understanding_v1.rb +4 -1
- data/test/integration/test_personality_insights_v3.rb +5 -2
- data/test/integration/test_speech_to_text_v1.rb +9 -3
- data/test/integration/test_text_to_speech_v1.rb +5 -2
- data/test/integration/test_tone_analyzer_v3.rb +5 -2
- data/test/integration/test_visual_recognition_v3.rb +5 -2
- data/test/test_helper.rb +2 -0
- data/test/unit/test_assistant_v1.rb +269 -133
- data/test/unit/test_assistant_v2.rb +18 -9
- data/test/unit/test_compare_comply_v1.rb +72 -40
- data/test/unit/test_configure_http_client.rb +4 -2
- data/test/unit/test_discovery_v1.rb +297 -152
- data/test/unit/test_language_translator_v3.rb +52 -13
- data/test/unit/test_natural_language_classifier_v1.rb +10 -4
- data/test/unit/test_natural_language_understanding_v1.rb +25 -10
- data/test/unit/test_personality_insights_v3.rb +20 -8
- data/test/unit/test_speech_to_text_v1.rb +84 -21
- data/test/unit/test_text_to_speech_v1.rb +30 -5
- data/test/unit/test_tone_analyzer_v3.rb +30 -12
- data/test/unit/test_vcap_using_personality_insights.rb +12 -4
- data/test/unit/test_visual_recognition_v3.rb +37 -10
- metadata +8 -8
- data/test/unit/test_watson_service.rb +0 -59
@@ -10,10 +10,13 @@ WebMock.disable_net_connect!(allow_localhost: true)
|
|
10
10
|
# Unit tests for the Watson Assistant V1 Service
|
11
11
|
class AssistantV2Test < Minitest::Test
|
12
12
|
def test_message
|
13
|
-
|
13
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
14
14
|
username: "username",
|
15
|
-
password: "password"
|
16
|
-
|
15
|
+
password: "password"
|
16
|
+
)
|
17
|
+
service = IBMWatson::AssistantV2.new(
|
18
|
+
version: "2018-02-16",
|
19
|
+
authenticator: authenticator
|
17
20
|
)
|
18
21
|
# service.set_default_headers("x-watson-learning-opt-out" => true)
|
19
22
|
assistant_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
|
@@ -106,10 +109,13 @@ class AssistantV2Test < Minitest::Test
|
|
106
109
|
"Host" => "gateway.watsonplatform.net"
|
107
110
|
}
|
108
111
|
).to_return(status: 200, body: "", headers: {})
|
109
|
-
|
112
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
110
113
|
username: "username",
|
111
|
-
password: "password"
|
112
|
-
|
114
|
+
password: "password"
|
115
|
+
)
|
116
|
+
service = IBMWatson::AssistantV2.new(
|
117
|
+
version: "2018-02-16",
|
118
|
+
authenticator: authenticator
|
113
119
|
)
|
114
120
|
service_response = service.create_session(
|
115
121
|
assistant_id: "pizza_app-e0f3"
|
@@ -126,10 +132,13 @@ class AssistantV2Test < Minitest::Test
|
|
126
132
|
"Host" => "gateway.watsonplatform.net"
|
127
133
|
}
|
128
134
|
).to_return(status: 200, body: "", headers: {})
|
129
|
-
|
135
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
130
136
|
username: "username",
|
131
|
-
password: "password"
|
132
|
-
|
137
|
+
password: "password"
|
138
|
+
)
|
139
|
+
service = IBMWatson::AssistantV2.new(
|
140
|
+
version: "2018-02-16",
|
141
|
+
authenticator: authenticator
|
133
142
|
)
|
134
143
|
service_response = service.delete_session(
|
135
144
|
assistant_id: "pizza_app-e0f3",
|
@@ -11,12 +11,15 @@ WebMock.disable_net_connect!(allow_localhost: true)
|
|
11
11
|
class CompareComplyV1 < Minitest::Test
|
12
12
|
def test_convert_to_html
|
13
13
|
# service.set_default_headers("x-watson-learning-opt-out" => true)
|
14
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
15
|
+
bearer_token: "token"
|
16
|
+
)
|
14
17
|
service = IBMWatson::CompareComplyV1.new(
|
15
|
-
|
16
|
-
|
18
|
+
version: "2018-10-15",
|
19
|
+
authenticator: authenticator
|
17
20
|
)
|
18
21
|
file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
|
19
|
-
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/html_conversion").with do |req|
|
22
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/html_conversion?version=2018-10-15").with do |req|
|
20
23
|
# Test the headers.
|
21
24
|
assert_equal(req.headers["Accept"], "application/json")
|
22
25
|
assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
|
@@ -24,20 +27,19 @@ class CompareComplyV1 < Minitest::Test
|
|
24
27
|
service.convert_to_html(
|
25
28
|
file: file
|
26
29
|
)
|
27
|
-
service.convert_to_html(
|
28
|
-
file: "dummy",
|
29
|
-
filename: "file"
|
30
|
-
)
|
31
30
|
end
|
32
31
|
|
33
32
|
def test_classify_elements
|
34
33
|
# service.set_default_headers("x-watson-learning-opt-out" => true)
|
34
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
35
|
+
bearer_token: "token"
|
36
|
+
)
|
35
37
|
service = IBMWatson::CompareComplyV1.new(
|
36
|
-
|
37
|
-
|
38
|
+
version: "2018-10-15",
|
39
|
+
authenticator: authenticator
|
38
40
|
)
|
39
41
|
file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
|
40
|
-
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/element_classification").with do |req|
|
42
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/element_classification?version=2018-10-15").with do |req|
|
41
43
|
assert_equal(req.headers["Accept"], "application/json")
|
42
44
|
assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
|
43
45
|
assert_match(/Content-Disposition: form-data/, req.body)
|
@@ -52,12 +54,15 @@ class CompareComplyV1 < Minitest::Test
|
|
52
54
|
|
53
55
|
def test_extract_tables
|
54
56
|
# service.set_default_headers("x-watson-learning-opt-out" => true)
|
57
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
58
|
+
bearer_token: "token"
|
59
|
+
)
|
55
60
|
service = IBMWatson::CompareComplyV1.new(
|
56
|
-
|
57
|
-
|
61
|
+
version: "2018-10-15",
|
62
|
+
authenticator: authenticator
|
58
63
|
)
|
59
64
|
file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
|
60
|
-
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/tables").with do |req|
|
65
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/tables?version=2018-10-15").with do |req|
|
61
66
|
assert_equal(req.headers["Accept"], "application/json")
|
62
67
|
assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
|
63
68
|
assert_match(/Content-Disposition: form-data/, req.body)
|
@@ -72,12 +77,15 @@ class CompareComplyV1 < Minitest::Test
|
|
72
77
|
|
73
78
|
def test_compare_documents
|
74
79
|
# service.set_default_headers("x-watson-learning-opt-out" => true)
|
80
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
81
|
+
bearer_token: "token"
|
82
|
+
)
|
75
83
|
service = IBMWatson::CompareComplyV1.new(
|
76
|
-
|
77
|
-
|
84
|
+
version: "2018-10-15",
|
85
|
+
authenticator: authenticator
|
78
86
|
)
|
79
87
|
file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
|
80
|
-
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/comparison").with do |req|
|
88
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/comparison?version=2018-10-15").with do |req|
|
81
89
|
assert_equal(req.headers["Accept"], "application/json")
|
82
90
|
assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
|
83
91
|
assert_match(/Content-Disposition: form-data/, req.body)
|
@@ -93,9 +101,12 @@ class CompareComplyV1 < Minitest::Test
|
|
93
101
|
end
|
94
102
|
|
95
103
|
def test_list_feedback
|
104
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
105
|
+
bearer_token: "token"
|
106
|
+
)
|
96
107
|
service = IBMWatson::CompareComplyV1.new(
|
97
|
-
|
98
|
-
|
108
|
+
version: "2018-10-15",
|
109
|
+
authenticator: authenticator
|
99
110
|
)
|
100
111
|
message_response = {
|
101
112
|
"feedback" => [
|
@@ -108,7 +119,7 @@ class CompareComplyV1 < Minitest::Test
|
|
108
119
|
headers = {
|
109
120
|
"Content-Type" => "application/json"
|
110
121
|
}
|
111
|
-
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback")
|
122
|
+
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback?version=2018-10-15")
|
112
123
|
.with(
|
113
124
|
headers: {
|
114
125
|
"Accept" => "application/json",
|
@@ -122,9 +133,12 @@ class CompareComplyV1 < Minitest::Test
|
|
122
133
|
end
|
123
134
|
|
124
135
|
def test_add_feedback
|
136
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
137
|
+
bearer_token: "token"
|
138
|
+
)
|
125
139
|
service = IBMWatson::CompareComplyV1.new(
|
126
|
-
|
127
|
-
|
140
|
+
version: "2018-10-15",
|
141
|
+
authenticator: authenticator
|
128
142
|
)
|
129
143
|
message_response = {
|
130
144
|
"feedback_id" => "another_one"
|
@@ -132,7 +146,7 @@ class CompareComplyV1 < Minitest::Test
|
|
132
146
|
headers = {
|
133
147
|
"Content-Type" => "application/json"
|
134
148
|
}
|
135
|
-
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback")
|
149
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback?version=2018-10-15")
|
136
150
|
.with(
|
137
151
|
headers: {
|
138
152
|
"Accept" => "application/json",
|
@@ -148,9 +162,12 @@ class CompareComplyV1 < Minitest::Test
|
|
148
162
|
end
|
149
163
|
|
150
164
|
def test_get_feedback
|
165
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
166
|
+
bearer_token: "token"
|
167
|
+
)
|
151
168
|
service = IBMWatson::CompareComplyV1.new(
|
152
|
-
|
153
|
-
|
169
|
+
version: "2018-10-15",
|
170
|
+
authenticator: authenticator
|
154
171
|
)
|
155
172
|
message_response = {
|
156
173
|
"feedback_id" => "messi"
|
@@ -158,7 +175,7 @@ class CompareComplyV1 < Minitest::Test
|
|
158
175
|
headers = {
|
159
176
|
"Content-Type" => "application/json"
|
160
177
|
}
|
161
|
-
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi")
|
178
|
+
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi?version=2018-10-15")
|
162
179
|
.with(
|
163
180
|
headers: {
|
164
181
|
"Accept" => "application/json",
|
@@ -174,12 +191,15 @@ class CompareComplyV1 < Minitest::Test
|
|
174
191
|
end
|
175
192
|
|
176
193
|
def test_delete_feedback
|
194
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
195
|
+
bearer_token: "token"
|
196
|
+
)
|
177
197
|
service = IBMWatson::CompareComplyV1.new(
|
178
|
-
|
179
|
-
|
198
|
+
version: "2018-10-15",
|
199
|
+
authenticator: authenticator
|
180
200
|
)
|
181
201
|
message_response = "200"
|
182
|
-
stub_request(:delete, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi")
|
202
|
+
stub_request(:delete, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi?version=2018-10-15")
|
183
203
|
.with(
|
184
204
|
headers: {
|
185
205
|
"Accept" => "application/json",
|
@@ -195,11 +215,14 @@ class CompareComplyV1 < Minitest::Test
|
|
195
215
|
end
|
196
216
|
|
197
217
|
def test_create_batch
|
218
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
219
|
+
bearer_token: "token"
|
220
|
+
)
|
198
221
|
service = IBMWatson::CompareComplyV1.new(
|
199
|
-
|
200
|
-
|
222
|
+
version: "2018-10-15",
|
223
|
+
authenticator: authenticator
|
201
224
|
)
|
202
|
-
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches?function=tables")
|
225
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches?function=tables&version=2018-10-15")
|
203
226
|
.with do |req|
|
204
227
|
assert_equal req.headers["Accept"], "application/json"
|
205
228
|
assert_match %r{\Amultipart/form-data}, req.headers["Content-Type"]
|
@@ -217,9 +240,12 @@ class CompareComplyV1 < Minitest::Test
|
|
217
240
|
end
|
218
241
|
|
219
242
|
def test_list_batches
|
243
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
244
|
+
bearer_token: "token"
|
245
|
+
)
|
220
246
|
service = IBMWatson::CompareComplyV1.new(
|
221
|
-
|
222
|
-
|
247
|
+
version: "2018-10-15",
|
248
|
+
authenticator: authenticator
|
223
249
|
)
|
224
250
|
message_response = {
|
225
251
|
"batches" => []
|
@@ -227,7 +253,7 @@ class CompareComplyV1 < Minitest::Test
|
|
227
253
|
headers = {
|
228
254
|
"Content-Type" => "application/json"
|
229
255
|
}
|
230
|
-
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches")
|
256
|
+
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches?version=2018-10-15")
|
231
257
|
.with(
|
232
258
|
headers: {
|
233
259
|
"Accept" => "application/json",
|
@@ -241,12 +267,15 @@ class CompareComplyV1 < Minitest::Test
|
|
241
267
|
end
|
242
268
|
|
243
269
|
def test_get_batch
|
270
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
271
|
+
bearer_token: "token"
|
272
|
+
)
|
244
273
|
service = IBMWatson::CompareComplyV1.new(
|
245
|
-
|
246
|
-
|
274
|
+
version: "2018-10-15",
|
275
|
+
authenticator: authenticator
|
247
276
|
)
|
248
277
|
message_response = "200"
|
249
|
-
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo")
|
278
|
+
stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?version=2018-10-15")
|
250
279
|
.with(
|
251
280
|
headers: {
|
252
281
|
"Accept" => "application/json",
|
@@ -262,12 +291,15 @@ class CompareComplyV1 < Minitest::Test
|
|
262
291
|
end
|
263
292
|
|
264
293
|
def test_update_batch
|
294
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
295
|
+
bearer_token: "token"
|
296
|
+
)
|
265
297
|
service = IBMWatson::CompareComplyV1.new(
|
266
|
-
|
267
|
-
|
298
|
+
version: "2018-10-15",
|
299
|
+
authenticator: authenticator
|
268
300
|
)
|
269
301
|
message_response = "200"
|
270
|
-
stub_request(:put, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?action=goal")
|
302
|
+
stub_request(:put, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?action=goal&version=2018-10-15")
|
271
303
|
.with(
|
272
304
|
headers: {
|
273
305
|
"Accept" => "application/json",
|
@@ -9,10 +9,12 @@ WebMock.disable_net_connect!(allow_localhost: true)
|
|
9
9
|
# Unit tests for the configure_http_client customizations, such as proxies and timeouts
|
10
10
|
class HTTPConfigTest < Minitest::Test
|
11
11
|
def test_proxy_address_port
|
12
|
+
authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
|
13
|
+
bearer_token: "token"
|
14
|
+
)
|
12
15
|
service = IBMWatson::NaturalLanguageUnderstandingV1.new(
|
13
16
|
version: "2018-03-16",
|
14
|
-
|
15
|
-
password: "password"
|
17
|
+
authenticator: authenticator
|
16
18
|
)
|
17
19
|
service.configure_http_client(
|
18
20
|
proxy: {
|
@@ -46,10 +46,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
46
46
|
"Host" => "gateway.watsonplatform.net"
|
47
47
|
}
|
48
48
|
).to_return(status: 200, body: discovery_response_body.to_json, headers: { "Content-Type" => "application/json" })
|
49
|
-
|
49
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
50
50
|
username: "username",
|
51
|
-
password: "password"
|
52
|
-
|
51
|
+
password: "password"
|
52
|
+
)
|
53
|
+
service = IBMWatson::DiscoveryV1.new(
|
54
|
+
version: "2018-03-05",
|
55
|
+
authenticator: authenticator
|
53
56
|
)
|
54
57
|
service_response = service.list_environments
|
55
58
|
assert_equal(discovery_response_body, service_response.result)
|
@@ -64,10 +67,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
64
67
|
"Host" => "gateway.watsonplatform.net"
|
65
68
|
}
|
66
69
|
).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
|
67
|
-
|
70
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
68
71
|
username: "username",
|
69
|
-
password: "password"
|
70
|
-
|
72
|
+
password: "password"
|
73
|
+
)
|
74
|
+
service = IBMWatson::DiscoveryV1.new(
|
75
|
+
version: "2018-03-05",
|
76
|
+
authenticator: authenticator
|
71
77
|
)
|
72
78
|
service_response = service.get_environment(
|
73
79
|
environment_id: "envid"
|
@@ -86,10 +92,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
86
92
|
"Host" => "gateway.watsonplatform.net"
|
87
93
|
}
|
88
94
|
).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
|
89
|
-
|
95
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
90
96
|
username: "username",
|
91
|
-
password: "password"
|
92
|
-
|
97
|
+
password: "password"
|
98
|
+
)
|
99
|
+
service = IBMWatson::DiscoveryV1.new(
|
100
|
+
version: "2018-03-05",
|
101
|
+
authenticator: authenticator
|
93
102
|
)
|
94
103
|
service_response = service.create_environment(
|
95
104
|
name: "my name",
|
@@ -109,10 +118,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
109
118
|
"Host" => "gateway.watsonplatform.net"
|
110
119
|
}
|
111
120
|
).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
|
112
|
-
|
121
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
113
122
|
username: "username",
|
114
|
-
password: "password"
|
115
|
-
|
123
|
+
password: "password"
|
124
|
+
)
|
125
|
+
service = IBMWatson::DiscoveryV1.new(
|
126
|
+
version: "2018-03-05",
|
127
|
+
authenticator: authenticator
|
116
128
|
)
|
117
129
|
service_response = service.update_environment(
|
118
130
|
environment_id: "envid",
|
@@ -131,10 +143,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
131
143
|
"Host" => "gateway.watsonplatform.net"
|
132
144
|
}
|
133
145
|
).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
|
134
|
-
|
146
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
135
147
|
username: "username",
|
136
|
-
password: "password"
|
137
|
-
|
148
|
+
password: "password"
|
149
|
+
)
|
150
|
+
service = IBMWatson::DiscoveryV1.new(
|
151
|
+
version: "2018-03-05",
|
152
|
+
authenticator: authenticator
|
138
153
|
)
|
139
154
|
service_response = service.delete_environment(
|
140
155
|
environment_id: "envid"
|
@@ -151,10 +166,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
151
166
|
"Host" => "gateway.watsonplatform.net"
|
152
167
|
}
|
153
168
|
).to_return(status: 200, body: { "body" => "hello" }.to_json, headers: { "Content-Type" => "application/json" })
|
154
|
-
|
169
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
155
170
|
username: "username",
|
156
|
-
password: "password"
|
157
|
-
|
171
|
+
password: "password"
|
172
|
+
)
|
173
|
+
service = IBMWatson::DiscoveryV1.new(
|
174
|
+
version: "2018-03-05",
|
175
|
+
authenticator: authenticator
|
158
176
|
)
|
159
177
|
service_response = service.list_collections(
|
160
178
|
environment_id: "envid"
|
@@ -163,10 +181,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
163
181
|
end
|
164
182
|
|
165
183
|
def test_collection
|
166
|
-
|
184
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
167
185
|
username: "username",
|
168
|
-
password: "password"
|
169
|
-
|
186
|
+
password: "password"
|
187
|
+
)
|
188
|
+
service = IBMWatson::DiscoveryV1.new(
|
189
|
+
version: "2018-03-05",
|
190
|
+
authenticator: authenticator
|
170
191
|
)
|
171
192
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections?version=2018-03-05")
|
172
193
|
.with(
|
@@ -249,10 +270,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
249
270
|
end
|
250
271
|
|
251
272
|
def test_query
|
252
|
-
|
273
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
253
274
|
username: "username",
|
254
|
-
password: "password"
|
255
|
-
|
275
|
+
password: "password"
|
276
|
+
)
|
277
|
+
service = IBMWatson::DiscoveryV1.new(
|
278
|
+
version: "2018-03-05",
|
279
|
+
authenticator: authenticator
|
256
280
|
)
|
257
281
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/query?version=2018-03-05")
|
258
282
|
.with(
|
@@ -260,15 +284,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
260
284
|
headers: {
|
261
285
|
"Accept" => "application/json",
|
262
286
|
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
263
|
-
"Host" => "gateway.watsonplatform.net"
|
264
|
-
"X-Watson-Logging-Opt-Out" => true
|
287
|
+
"Host" => "gateway.watsonplatform.net"
|
265
288
|
}
|
266
289
|
).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
|
267
290
|
service_response = service.query(
|
268
291
|
environment_id: "envid",
|
269
292
|
collection_id: "collid",
|
270
|
-
count: 10
|
271
|
-
logging_opt_out: true
|
293
|
+
count: 10
|
272
294
|
)
|
273
295
|
assert_equal({ "body" => "hello" }, service_response.result)
|
274
296
|
end
|
@@ -284,10 +306,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
284
306
|
"Host" => "gateway.watsonplatform.net"
|
285
307
|
}
|
286
308
|
).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
|
287
|
-
|
309
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
288
310
|
username: "username",
|
289
|
-
password: "password"
|
290
|
-
|
311
|
+
password: "password"
|
312
|
+
)
|
313
|
+
service = IBMWatson::DiscoveryV1.new(
|
314
|
+
version: "2018-03-05",
|
315
|
+
authenticator: authenticator
|
291
316
|
)
|
292
317
|
service_response = service.query_relations(
|
293
318
|
environment_id: "envid",
|
@@ -308,10 +333,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
308
333
|
"Host" => "gateway.watsonplatform.net"
|
309
334
|
}
|
310
335
|
).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
|
311
|
-
|
336
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
312
337
|
username: "username",
|
313
|
-
password: "password"
|
314
|
-
|
338
|
+
password: "password"
|
339
|
+
)
|
340
|
+
service = IBMWatson::DiscoveryV1.new(
|
341
|
+
version: "2018-03-05",
|
342
|
+
authenticator: authenticator
|
315
343
|
)
|
316
344
|
service_response = service.query_entities(
|
317
345
|
environment_id: "envid",
|
@@ -330,10 +358,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
330
358
|
}
|
331
359
|
]
|
332
360
|
}
|
333
|
-
|
361
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
334
362
|
username: "username",
|
335
|
-
password: "password"
|
336
|
-
|
363
|
+
password: "password"
|
364
|
+
)
|
365
|
+
service = IBMWatson::DiscoveryV1.new(
|
366
|
+
version: "2018-03-05",
|
367
|
+
authenticator: authenticator
|
337
368
|
)
|
338
369
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations?version=2018-03-05")
|
339
370
|
.with(
|
@@ -411,10 +442,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
411
442
|
end
|
412
443
|
|
413
444
|
def test_document
|
414
|
-
|
445
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
415
446
|
username: "username",
|
416
|
-
password: "password"
|
417
|
-
|
447
|
+
password: "password"
|
448
|
+
)
|
449
|
+
service = IBMWatson::DiscoveryV1.new(
|
450
|
+
version: "2018-03-05",
|
451
|
+
authenticator: authenticator
|
418
452
|
)
|
419
453
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/preview?configuration_id=bogus&version=2018-03-05")
|
420
454
|
.with(
|
@@ -563,10 +597,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
563
597
|
end
|
564
598
|
|
565
599
|
def test_delete_all_training_data
|
566
|
-
|
600
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
567
601
|
username: "username",
|
568
|
-
password: "password"
|
569
|
-
|
602
|
+
password: "password"
|
603
|
+
)
|
604
|
+
service = IBMWatson::DiscoveryV1.new(
|
605
|
+
version: "2018-03-05",
|
606
|
+
authenticator: authenticator
|
570
607
|
)
|
571
608
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
|
572
609
|
.with(
|
@@ -583,10 +620,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
583
620
|
end
|
584
621
|
|
585
622
|
def test_list_training_data
|
586
|
-
|
623
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
587
624
|
username: "username",
|
588
|
-
password: "password"
|
589
|
-
|
625
|
+
password: "password"
|
626
|
+
)
|
627
|
+
service = IBMWatson::DiscoveryV1.new(
|
628
|
+
version: "2018-03-05",
|
629
|
+
authenticator: authenticator
|
590
630
|
)
|
591
631
|
mock_response = {
|
592
632
|
"environment_id" => "string",
|
@@ -647,10 +687,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
647
687
|
}
|
648
688
|
]
|
649
689
|
}
|
650
|
-
|
690
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
651
691
|
username: "username",
|
652
|
-
password: "password"
|
653
|
-
|
692
|
+
password: "password"
|
693
|
+
)
|
694
|
+
service = IBMWatson::DiscoveryV1.new(
|
695
|
+
version: "2018-03-05",
|
696
|
+
authenticator: authenticator
|
654
697
|
)
|
655
698
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
|
656
699
|
.with(
|
@@ -673,10 +716,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
673
716
|
end
|
674
717
|
|
675
718
|
def test_delete_training_data
|
676
|
-
|
719
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
677
720
|
username: "username",
|
678
|
-
password: "password"
|
679
|
-
|
721
|
+
password: "password"
|
722
|
+
)
|
723
|
+
service = IBMWatson::DiscoveryV1.new(
|
724
|
+
version: "2018-03-05",
|
725
|
+
authenticator: authenticator
|
680
726
|
)
|
681
727
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid?version=2018-03-05")
|
682
728
|
.with(
|
@@ -714,10 +760,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
714
760
|
"Host" => "gateway.watsonplatform.net"
|
715
761
|
}
|
716
762
|
).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
|
717
|
-
|
763
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
718
764
|
username: "username",
|
719
|
-
password: "password"
|
720
|
-
|
765
|
+
password: "password"
|
766
|
+
)
|
767
|
+
service = IBMWatson::DiscoveryV1.new(
|
768
|
+
version: "2018-03-05",
|
769
|
+
authenticator: authenticator
|
721
770
|
)
|
722
771
|
service_response = service.get_training_data(
|
723
772
|
environment_id: "envid",
|
@@ -736,10 +785,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
736
785
|
"cross_reference" => "string",
|
737
786
|
"relevance" => 0
|
738
787
|
}
|
739
|
-
|
788
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
740
789
|
username: "username",
|
741
|
-
password: "password"
|
742
|
-
|
790
|
+
password: "password"
|
791
|
+
)
|
792
|
+
service = IBMWatson::DiscoveryV1.new(
|
793
|
+
version: "2018-03-05",
|
794
|
+
authenticator: authenticator
|
743
795
|
)
|
744
796
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
|
745
797
|
.with(
|
@@ -763,10 +815,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
763
815
|
end
|
764
816
|
|
765
817
|
def test_delete_training_example
|
766
|
-
|
818
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
767
819
|
username: "username",
|
768
|
-
password: "password"
|
769
|
-
|
820
|
+
password: "password"
|
821
|
+
)
|
822
|
+
service = IBMWatson::DiscoveryV1.new(
|
823
|
+
version: "2018-03-05",
|
824
|
+
authenticator: authenticator
|
770
825
|
)
|
771
826
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
|
772
827
|
.with(
|
@@ -790,10 +845,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
790
845
|
"cross_reference" => "string",
|
791
846
|
"relevance" => 0
|
792
847
|
}
|
793
|
-
|
848
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
794
849
|
username: "username",
|
795
|
-
password: "password"
|
796
|
-
|
850
|
+
password: "password"
|
851
|
+
)
|
852
|
+
service = IBMWatson::DiscoveryV1.new(
|
853
|
+
version: "2018-03-05",
|
854
|
+
authenticator: authenticator
|
797
855
|
)
|
798
856
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
|
799
857
|
.with(
|
@@ -820,10 +878,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
820
878
|
"cross_reference" => "string",
|
821
879
|
"relevance" => 0
|
822
880
|
}
|
823
|
-
|
881
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
824
882
|
username: "username",
|
825
|
-
password: "password"
|
826
|
-
|
883
|
+
password: "password"
|
884
|
+
)
|
885
|
+
service = IBMWatson::DiscoveryV1.new(
|
886
|
+
version: "2018-03-05",
|
887
|
+
authenticator: authenticator
|
827
888
|
)
|
828
889
|
stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
|
829
890
|
.with(
|
@@ -847,10 +908,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
847
908
|
end
|
848
909
|
|
849
910
|
def test_expansions
|
850
|
-
|
911
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
851
912
|
username: "username",
|
852
|
-
password: "password"
|
853
|
-
|
913
|
+
password: "password"
|
914
|
+
)
|
915
|
+
service = IBMWatson::DiscoveryV1.new(
|
916
|
+
version: "2018-03-05",
|
917
|
+
authenticator: authenticator
|
854
918
|
)
|
855
919
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
|
856
920
|
.with(
|
@@ -903,10 +967,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
903
967
|
end
|
904
968
|
|
905
969
|
def test_tokenization_dictionary
|
906
|
-
|
970
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
907
971
|
username: "username",
|
908
|
-
password: "password"
|
909
|
-
|
972
|
+
password: "password"
|
973
|
+
)
|
974
|
+
service = IBMWatson::DiscoveryV1.new(
|
975
|
+
version: "2018-03-05",
|
976
|
+
authenticator: authenticator
|
910
977
|
)
|
911
978
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
|
912
979
|
.with(
|
@@ -959,10 +1026,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
959
1026
|
end
|
960
1027
|
|
961
1028
|
def test_delete_user_data
|
962
|
-
|
1029
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
963
1030
|
username: "username",
|
964
|
-
password: "password"
|
965
|
-
|
1031
|
+
password: "password"
|
1032
|
+
)
|
1033
|
+
service = IBMWatson::DiscoveryV1.new(
|
1034
|
+
version: "2018-03-05",
|
1035
|
+
authenticator: authenticator
|
966
1036
|
)
|
967
1037
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/user_data?customer_id=id&version=2018-03-05")
|
968
1038
|
.with(
|
@@ -978,10 +1048,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
978
1048
|
end
|
979
1049
|
|
980
1050
|
def test_query_notices
|
981
|
-
|
1051
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
982
1052
|
username: "username",
|
983
|
-
password: "password"
|
984
|
-
|
1053
|
+
password: "password"
|
1054
|
+
)
|
1055
|
+
service = IBMWatson::DiscoveryV1.new(
|
1056
|
+
version: "2018-03-05",
|
1057
|
+
authenticator: authenticator
|
985
1058
|
)
|
986
1059
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/notices?version=2018-03-05")
|
987
1060
|
.with(
|
@@ -999,10 +1072,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
999
1072
|
end
|
1000
1073
|
|
1001
1074
|
def test_federated_query
|
1002
|
-
|
1075
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1003
1076
|
username: "username",
|
1004
|
-
password: "password"
|
1005
|
-
|
1077
|
+
password: "password"
|
1078
|
+
)
|
1079
|
+
service = IBMWatson::DiscoveryV1.new(
|
1080
|
+
version: "2018-03-05",
|
1081
|
+
authenticator: authenticator
|
1006
1082
|
)
|
1007
1083
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/query?&version=2018-03-05")
|
1008
1084
|
.with(
|
@@ -1022,10 +1098,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1022
1098
|
end
|
1023
1099
|
|
1024
1100
|
def test_federated_query_notices
|
1025
|
-
|
1101
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1026
1102
|
username: "username",
|
1027
|
-
password: "password"
|
1028
|
-
|
1103
|
+
password: "password"
|
1104
|
+
)
|
1105
|
+
service = IBMWatson::DiscoveryV1.new(
|
1106
|
+
version: "2018-03-05",
|
1107
|
+
authenticator: authenticator
|
1029
1108
|
)
|
1030
1109
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/notices?collection_ids=collid&version=2018-03-05")
|
1031
1110
|
.with(
|
@@ -1043,10 +1122,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1043
1122
|
end
|
1044
1123
|
|
1045
1124
|
def test_list_training_examples
|
1046
|
-
|
1125
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1047
1126
|
username: "username",
|
1048
|
-
password: "password"
|
1049
|
-
|
1127
|
+
password: "password"
|
1128
|
+
)
|
1129
|
+
service = IBMWatson::DiscoveryV1.new(
|
1130
|
+
version: "2018-03-05",
|
1131
|
+
authenticator: authenticator
|
1050
1132
|
)
|
1051
1133
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
|
1052
1134
|
.with(
|
@@ -1075,10 +1157,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1075
1157
|
"type" => "click",
|
1076
1158
|
"data" => "data"
|
1077
1159
|
}
|
1078
|
-
|
1160
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1079
1161
|
username: "username",
|
1080
|
-
password: "password"
|
1081
|
-
|
1162
|
+
password: "password"
|
1163
|
+
)
|
1164
|
+
service = IBMWatson::DiscoveryV1.new(
|
1165
|
+
version: "2018-05-23",
|
1166
|
+
authenticator: authenticator
|
1082
1167
|
)
|
1083
1168
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/events?version=2018-05-23")
|
1084
1169
|
.with(
|
@@ -1099,12 +1184,15 @@ class DiscoveryV1Test < Minitest::Test
|
|
1099
1184
|
end
|
1100
1185
|
|
1101
1186
|
def test_query_log
|
1102
|
-
|
1187
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1103
1188
|
username: "username",
|
1104
|
-
password: "password"
|
1105
|
-
|
1189
|
+
password: "password"
|
1190
|
+
)
|
1191
|
+
service = IBMWatson::DiscoveryV1.new(
|
1192
|
+
version: "2018-03-05",
|
1193
|
+
authenticator: authenticator
|
1106
1194
|
)
|
1107
|
-
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/logs?count=10&query=test&version=2018-05
|
1195
|
+
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/logs?count=10&query=test&version=2018-03-05")
|
1108
1196
|
.with(
|
1109
1197
|
headers: {
|
1110
1198
|
"Accept" => "application/json",
|
@@ -1121,10 +1209,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1121
1209
|
end
|
1122
1210
|
|
1123
1211
|
def test_metrics_query
|
1124
|
-
|
1212
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1125
1213
|
username: "username",
|
1126
|
-
password: "password"
|
1127
|
-
|
1214
|
+
password: "password"
|
1215
|
+
)
|
1216
|
+
service = IBMWatson::DiscoveryV1.new(
|
1217
|
+
version: "2018-05-23",
|
1218
|
+
authenticator: authenticator
|
1128
1219
|
)
|
1129
1220
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/metrics/number_of_queries?end_time=2018-01-01T00:10:00Z&start_time=2018-01-01T00:00:00Z&version=2018-05-23")
|
1130
1221
|
.with(
|
@@ -1143,10 +1234,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1143
1234
|
end
|
1144
1235
|
|
1145
1236
|
def test_metrics_query_event
|
1146
|
-
|
1237
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1147
1238
|
username: "username",
|
1148
|
-
password: "password"
|
1149
|
-
|
1239
|
+
password: "password"
|
1240
|
+
)
|
1241
|
+
service = IBMWatson::DiscoveryV1.new(
|
1242
|
+
version: "2018-05-23",
|
1243
|
+
authenticator: authenticator
|
1150
1244
|
)
|
1151
1245
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/metrics/number_of_queries_with_event?end_time=2018-01-01T00:10:00Z&start_time=2018-01-01T00:00:00Z&version=2018-05-23")
|
1152
1246
|
.with(
|
@@ -1165,10 +1259,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1165
1259
|
end
|
1166
1260
|
|
1167
1261
|
def test_metrics_query_token_event
|
1168
|
-
|
1262
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1169
1263
|
username: "username",
|
1170
|
-
password: "password"
|
1171
|
-
|
1264
|
+
password: "password"
|
1265
|
+
)
|
1266
|
+
service = IBMWatson::DiscoveryV1.new(
|
1267
|
+
version: "2018-05-23",
|
1268
|
+
authenticator: authenticator
|
1172
1269
|
)
|
1173
1270
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/metrics/top_query_tokens_with_event_rate?count=10&version=2018-05-23")
|
1174
1271
|
.with(
|
@@ -1186,10 +1283,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1186
1283
|
end
|
1187
1284
|
|
1188
1285
|
def test_metrics_event_rate
|
1189
|
-
|
1286
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1190
1287
|
username: "username",
|
1191
|
-
password: "password"
|
1192
|
-
|
1288
|
+
password: "password"
|
1289
|
+
)
|
1290
|
+
service = IBMWatson::DiscoveryV1.new(
|
1291
|
+
version: "2018-05-23",
|
1292
|
+
authenticator: authenticator
|
1193
1293
|
)
|
1194
1294
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/metrics/event_rate?end_time=2018-01-01T00:10:00Z&start_time=2018-01-01T00:00:00Z&version=2018-05-23")
|
1195
1295
|
.with(
|
@@ -1208,10 +1308,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1208
1308
|
end
|
1209
1309
|
|
1210
1310
|
def test_metrics_query_no_results
|
1211
|
-
|
1311
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1212
1312
|
username: "username",
|
1213
|
-
password: "password"
|
1214
|
-
|
1313
|
+
password: "password"
|
1314
|
+
)
|
1315
|
+
service = IBMWatson::DiscoveryV1.new(
|
1316
|
+
version: "2018-05-23",
|
1317
|
+
authenticator: authenticator
|
1215
1318
|
)
|
1216
1319
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/metrics/number_of_queries_with_no_search_results?end_time=2018-01-01T00:10:00Z&start_time=2018-01-01T00:00:00Z&version=2018-05-23")
|
1217
1320
|
.with(
|
@@ -1230,10 +1333,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1230
1333
|
end
|
1231
1334
|
|
1232
1335
|
def test_list_credentials
|
1233
|
-
|
1336
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1234
1337
|
username: "username",
|
1235
|
-
password: "password"
|
1236
|
-
|
1338
|
+
password: "password"
|
1339
|
+
)
|
1340
|
+
service = IBMWatson::DiscoveryV1.new(
|
1341
|
+
version: "2018-03-05",
|
1342
|
+
authenticator: authenticator
|
1237
1343
|
)
|
1238
1344
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials?version=2018-03-05")
|
1239
1345
|
.with(
|
@@ -1250,10 +1356,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1250
1356
|
end
|
1251
1357
|
|
1252
1358
|
def test_create_credentials
|
1253
|
-
|
1359
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1254
1360
|
username: "username",
|
1255
|
-
password: "password"
|
1256
|
-
|
1361
|
+
password: "password"
|
1362
|
+
)
|
1363
|
+
service = IBMWatson::DiscoveryV1.new(
|
1364
|
+
version: "2018-03-05",
|
1365
|
+
authenticator: authenticator
|
1257
1366
|
)
|
1258
1367
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials?version=2018-03-05")
|
1259
1368
|
.with(
|
@@ -1273,10 +1382,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1273
1382
|
end
|
1274
1383
|
|
1275
1384
|
def test_get_credentials
|
1276
|
-
|
1385
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1277
1386
|
username: "username",
|
1278
|
-
password: "password"
|
1279
|
-
|
1387
|
+
password: "password"
|
1388
|
+
)
|
1389
|
+
service = IBMWatson::DiscoveryV1.new(
|
1390
|
+
version: "2018-03-05",
|
1391
|
+
authenticator: authenticator
|
1280
1392
|
)
|
1281
1393
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
|
1282
1394
|
.with(
|
@@ -1294,10 +1406,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1294
1406
|
end
|
1295
1407
|
|
1296
1408
|
def test_update_credentials
|
1297
|
-
|
1409
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1298
1410
|
username: "username",
|
1299
|
-
password: "password"
|
1300
|
-
|
1411
|
+
password: "password"
|
1412
|
+
)
|
1413
|
+
service = IBMWatson::DiscoveryV1.new(
|
1414
|
+
version: "2018-03-05",
|
1415
|
+
authenticator: authenticator
|
1301
1416
|
)
|
1302
1417
|
stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
|
1303
1418
|
.with(
|
@@ -1318,10 +1433,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1318
1433
|
end
|
1319
1434
|
|
1320
1435
|
def test_delete_credentials
|
1321
|
-
|
1436
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1322
1437
|
username: "username",
|
1323
|
-
password: "password"
|
1324
|
-
|
1438
|
+
password: "password"
|
1439
|
+
)
|
1440
|
+
service = IBMWatson::DiscoveryV1.new(
|
1441
|
+
version: "2018-03-05",
|
1442
|
+
authenticator: authenticator
|
1325
1443
|
)
|
1326
1444
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
|
1327
1445
|
.with(
|
@@ -1339,10 +1457,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1339
1457
|
end
|
1340
1458
|
|
1341
1459
|
def test_update_collection
|
1342
|
-
|
1460
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1343
1461
|
username: "username",
|
1344
|
-
password: "password"
|
1345
|
-
|
1462
|
+
password: "password"
|
1463
|
+
)
|
1464
|
+
service = IBMWatson::DiscoveryV1.new(
|
1465
|
+
version: "2018-03-05",
|
1466
|
+
authenticator: authenticator
|
1346
1467
|
)
|
1347
1468
|
stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid?version=2018-03-05")
|
1348
1469
|
.with(
|
@@ -1364,10 +1485,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1364
1485
|
end
|
1365
1486
|
|
1366
1487
|
def test_get_stopword_list_status
|
1367
|
-
|
1488
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1368
1489
|
username: "username",
|
1369
|
-
password: "password"
|
1370
|
-
|
1490
|
+
password: "password"
|
1491
|
+
)
|
1492
|
+
service = IBMWatson::DiscoveryV1.new(
|
1493
|
+
version: "2018-03-05",
|
1494
|
+
authenticator: authenticator
|
1371
1495
|
)
|
1372
1496
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/stopwords?version=2018-03-05")
|
1373
1497
|
.with(
|
@@ -1385,10 +1509,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1385
1509
|
end
|
1386
1510
|
|
1387
1511
|
def test_list_fields
|
1388
|
-
|
1512
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1389
1513
|
username: "username",
|
1390
|
-
password: "password"
|
1391
|
-
|
1514
|
+
password: "password"
|
1515
|
+
)
|
1516
|
+
service = IBMWatson::DiscoveryV1.new(
|
1517
|
+
version: "2018-03-05",
|
1518
|
+
authenticator: authenticator
|
1392
1519
|
)
|
1393
1520
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/fields?collection_ids=collid&version=2018-03-05")
|
1394
1521
|
.with(
|
@@ -1406,10 +1533,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1406
1533
|
end
|
1407
1534
|
|
1408
1535
|
def test_create_stopword_list
|
1409
|
-
|
1536
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1410
1537
|
username: "username",
|
1411
|
-
password: "password"
|
1412
|
-
|
1538
|
+
password: "password"
|
1539
|
+
)
|
1540
|
+
service = IBMWatson::DiscoveryV1.new(
|
1541
|
+
version: "2018-03-05",
|
1542
|
+
authenticator: authenticator
|
1413
1543
|
)
|
1414
1544
|
|
1415
1545
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05").with do |req|
|
@@ -1425,10 +1555,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1425
1555
|
end
|
1426
1556
|
|
1427
1557
|
def test_delete_stopword_list
|
1428
|
-
|
1558
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1429
1559
|
username: "username",
|
1430
|
-
password: "password"
|
1431
|
-
|
1560
|
+
password: "password"
|
1561
|
+
)
|
1562
|
+
service = IBMWatson::DiscoveryV1.new(
|
1563
|
+
version: "2018-03-05",
|
1564
|
+
authenticator: authenticator
|
1432
1565
|
)
|
1433
1566
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05")
|
1434
1567
|
.with(
|
@@ -1445,10 +1578,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1445
1578
|
end
|
1446
1579
|
|
1447
1580
|
def test_list_gateways
|
1448
|
-
|
1581
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1449
1582
|
username: "username",
|
1450
|
-
password: "password"
|
1451
|
-
|
1583
|
+
password: "password"
|
1584
|
+
)
|
1585
|
+
service = IBMWatson::DiscoveryV1.new(
|
1586
|
+
version: "2018-03-05",
|
1587
|
+
authenticator: authenticator
|
1452
1588
|
)
|
1453
1589
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
|
1454
1590
|
.with(
|
@@ -1465,10 +1601,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1465
1601
|
end
|
1466
1602
|
|
1467
1603
|
def test_create_gateway
|
1468
|
-
|
1604
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1469
1605
|
username: "username",
|
1470
|
-
password: "password"
|
1471
|
-
|
1606
|
+
password: "password"
|
1607
|
+
)
|
1608
|
+
service = IBMWatson::DiscoveryV1.new(
|
1609
|
+
version: "2018-03-05",
|
1610
|
+
authenticator: authenticator
|
1472
1611
|
)
|
1473
1612
|
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
|
1474
1613
|
.with(
|
@@ -1485,10 +1624,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1485
1624
|
end
|
1486
1625
|
|
1487
1626
|
def test_get_gateway
|
1488
|
-
|
1627
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1489
1628
|
username: "username",
|
1490
|
-
password: "password"
|
1491
|
-
|
1629
|
+
password: "password"
|
1630
|
+
)
|
1631
|
+
service = IBMWatson::DiscoveryV1.new(
|
1632
|
+
version: "2018-03-05",
|
1633
|
+
authenticator: authenticator
|
1492
1634
|
)
|
1493
1635
|
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
|
1494
1636
|
.with(
|
@@ -1506,10 +1648,13 @@ class DiscoveryV1Test < Minitest::Test
|
|
1506
1648
|
end
|
1507
1649
|
|
1508
1650
|
def test_delete_gateway
|
1509
|
-
|
1651
|
+
authenticator = IBMCloudSdkCore::BasicAuthenticator.new(
|
1510
1652
|
username: "username",
|
1511
|
-
password: "password"
|
1512
|
-
|
1653
|
+
password: "password"
|
1654
|
+
)
|
1655
|
+
service = IBMWatson::DiscoveryV1.new(
|
1656
|
+
version: "2018-03-05",
|
1657
|
+
authenticator: authenticator
|
1513
1658
|
)
|
1514
1659
|
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
|
1515
1660
|
.with(
|