ibm_watson 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,15 +9,17 @@ WebMock.disable_net_connect!(allow_localhost: true)
9
9
 
10
10
  # Unit tests for the Watson Assistant V1 Service
11
11
  class AssistantV2Test < Minitest::Test
12
- def test_message
13
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
14
- username: "username",
15
- password: "password"
16
- )
17
- service = IBMWatson::AssistantV2.new(
12
+ include Minitest::Hooks
13
+ attr_accessor :service
14
+ def before_all
15
+ authenticator = IBMWatson::Authenticators::NoAuthAuthenticator.new
16
+ @service = IBMWatson::AssistantV2.new(
18
17
  version: "2018-02-16",
19
18
  authenticator: authenticator
20
19
  )
20
+ end
21
+
22
+ def test_message
21
23
  # service.set_default_headers("x-watson-learning-opt-out" => true)
22
24
  assistant_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
23
25
  session_id = "session"
@@ -46,7 +48,6 @@ class AssistantV2Test < Minitest::Test
46
48
  body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
47
49
  headers: {
48
50
  "Accept" => "application/json",
49
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
50
51
  "Content-Type" => "application/json",
51
52
  "Host" => "gateway.watsonplatform.net"
52
53
  }
@@ -74,7 +75,6 @@ class AssistantV2Test < Minitest::Test
74
75
  body: "{\"input\":{\"text\":\"Turn on the lights\"},\"context\":\"{\\\"conversation_id\\\":\\\"1b7b67c0-90ed-45dc-8508-9488bc483d5b\\\",\\\"system\\\":{\\\"dialog_stack\\\":[\\\"root\\\"],\\\"dialog_turn_counter\\\":2,\\\"dialog_request_counter\\\":1}}\"}",
75
76
  headers: {
76
77
  "Accept" => "application/json",
77
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
78
78
  "Content-Type" => "application/json",
79
79
  "Host" => "gateway.watsonplatform.net"
80
80
  }
@@ -105,18 +105,9 @@ class AssistantV2Test < Minitest::Test
105
105
  .with(
106
106
  headers: {
107
107
  "Accept" => "application/json",
108
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
109
108
  "Host" => "gateway.watsonplatform.net"
110
109
  }
111
110
  ).to_return(status: 200, body: "", headers: {})
112
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
113
- username: "username",
114
- password: "password"
115
- )
116
- service = IBMWatson::AssistantV2.new(
117
- version: "2018-02-16",
118
- authenticator: authenticator
119
- )
120
111
  service_response = service.create_session(
121
112
  assistant_id: "pizza_app-e0f3"
122
113
  )
@@ -128,18 +119,9 @@ class AssistantV2Test < Minitest::Test
128
119
  .with(
129
120
  headers: {
130
121
  "Accept" => "application/json",
131
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
132
122
  "Host" => "gateway.watsonplatform.net"
133
123
  }
134
124
  ).to_return(status: 200, body: "", headers: {})
135
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
136
- username: "username",
137
- password: "password"
138
- )
139
- service = IBMWatson::AssistantV2.new(
140
- version: "2018-02-16",
141
- authenticator: authenticator
142
- )
143
125
  service_response = service.delete_session(
144
126
  assistant_id: "pizza_app-e0f3",
145
127
  session_id: "session"
@@ -9,15 +9,17 @@ WebMock.disable_net_connect!(allow_localhost: true)
9
9
 
10
10
  # Unit tests for the Watson Assistant V1 Service
11
11
  class CompareComplyV1 < Minitest::Test
12
- def test_convert_to_html
13
- # service.set_default_headers("x-watson-learning-opt-out" => true)
14
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
15
- bearer_token: "token"
16
- )
17
- service = IBMWatson::CompareComplyV1.new(
12
+ include Minitest::Hooks
13
+ attr_accessor :service
14
+ def before_all
15
+ authenticator = IBMWatson::Authenticators::NoAuthAuthenticator.new
16
+ @service = IBMWatson::CompareComplyV1.new(
18
17
  version: "2018-10-15",
19
18
  authenticator: authenticator
20
19
  )
20
+ end
21
+
22
+ def test_convert_to_html
21
23
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
22
24
  stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/html_conversion?version=2018-10-15").with do |req|
23
25
  # Test the headers.
@@ -30,14 +32,6 @@ class CompareComplyV1 < Minitest::Test
30
32
  end
31
33
 
32
34
  def test_classify_elements
33
- # service.set_default_headers("x-watson-learning-opt-out" => true)
34
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
35
- bearer_token: "token"
36
- )
37
- service = IBMWatson::CompareComplyV1.new(
38
- version: "2018-10-15",
39
- authenticator: authenticator
40
- )
41
35
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
42
36
  stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/element_classification?version=2018-10-15").with do |req|
43
37
  assert_equal(req.headers["Accept"], "application/json")
@@ -53,14 +47,6 @@ class CompareComplyV1 < Minitest::Test
53
47
  end
54
48
 
55
49
  def test_extract_tables
56
- # service.set_default_headers("x-watson-learning-opt-out" => true)
57
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
58
- bearer_token: "token"
59
- )
60
- service = IBMWatson::CompareComplyV1.new(
61
- version: "2018-10-15",
62
- authenticator: authenticator
63
- )
64
50
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
65
51
  stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/tables?version=2018-10-15").with do |req|
66
52
  assert_equal(req.headers["Accept"], "application/json")
@@ -76,14 +62,6 @@ class CompareComplyV1 < Minitest::Test
76
62
  end
77
63
 
78
64
  def test_compare_documents
79
- # service.set_default_headers("x-watson-learning-opt-out" => true)
80
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
81
- bearer_token: "token"
82
- )
83
- service = IBMWatson::CompareComplyV1.new(
84
- version: "2018-10-15",
85
- authenticator: authenticator
86
- )
87
65
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
88
66
  stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/comparison?version=2018-10-15").with do |req|
89
67
  assert_equal(req.headers["Accept"], "application/json")
@@ -101,13 +79,6 @@ class CompareComplyV1 < Minitest::Test
101
79
  end
102
80
 
103
81
  def test_list_feedback
104
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
105
- bearer_token: "token"
106
- )
107
- service = IBMWatson::CompareComplyV1.new(
108
- version: "2018-10-15",
109
- authenticator: authenticator
110
- )
111
82
  message_response = {
112
83
  "feedback" => [
113
84
  {
@@ -123,7 +94,6 @@ class CompareComplyV1 < Minitest::Test
123
94
  .with(
124
95
  headers: {
125
96
  "Accept" => "application/json",
126
- "Authorization" => "Bearer token",
127
97
  "Host" => "gateway.watsonplatform.net"
128
98
  }
129
99
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
@@ -133,13 +103,6 @@ class CompareComplyV1 < Minitest::Test
133
103
  end
134
104
 
135
105
  def test_add_feedback
136
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
137
- bearer_token: "token"
138
- )
139
- service = IBMWatson::CompareComplyV1.new(
140
- version: "2018-10-15",
141
- authenticator: authenticator
142
- )
143
106
  message_response = {
144
107
  "feedback_id" => "another_one"
145
108
  }
@@ -150,7 +113,6 @@ class CompareComplyV1 < Minitest::Test
150
113
  .with(
151
114
  headers: {
152
115
  "Accept" => "application/json",
153
- "Authorization" => "Bearer token",
154
116
  "Host" => "gateway.watsonplatform.net"
155
117
  }
156
118
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
@@ -162,13 +124,6 @@ class CompareComplyV1 < Minitest::Test
162
124
  end
163
125
 
164
126
  def test_get_feedback
165
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
166
- bearer_token: "token"
167
- )
168
- service = IBMWatson::CompareComplyV1.new(
169
- version: "2018-10-15",
170
- authenticator: authenticator
171
- )
172
127
  message_response = {
173
128
  "feedback_id" => "messi"
174
129
  }
@@ -179,7 +134,6 @@ class CompareComplyV1 < Minitest::Test
179
134
  .with(
180
135
  headers: {
181
136
  "Accept" => "application/json",
182
- "Authorization" => "Bearer token",
183
137
  "Host" => "gateway.watsonplatform.net"
184
138
  }
185
139
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
@@ -191,19 +145,11 @@ class CompareComplyV1 < Minitest::Test
191
145
  end
192
146
 
193
147
  def test_delete_feedback
194
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
195
- bearer_token: "token"
196
- )
197
- service = IBMWatson::CompareComplyV1.new(
198
- version: "2018-10-15",
199
- authenticator: authenticator
200
- )
201
148
  message_response = "200"
202
149
  stub_request(:delete, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi?version=2018-10-15")
203
150
  .with(
204
151
  headers: {
205
152
  "Accept" => "application/json",
206
- "Authorization" => "Bearer token",
207
153
  "Host" => "gateway.watsonplatform.net"
208
154
  }
209
155
  ).to_return(status: 200, body: message_response, headers: {})
@@ -215,13 +161,6 @@ class CompareComplyV1 < Minitest::Test
215
161
  end
216
162
 
217
163
  def test_create_batch
218
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
219
- bearer_token: "token"
220
- )
221
- service = IBMWatson::CompareComplyV1.new(
222
- version: "2018-10-15",
223
- authenticator: authenticator
224
- )
225
164
  stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches?function=tables&version=2018-10-15")
226
165
  .with do |req|
227
166
  assert_equal req.headers["Accept"], "application/json"
@@ -240,13 +179,6 @@ class CompareComplyV1 < Minitest::Test
240
179
  end
241
180
 
242
181
  def test_list_batches
243
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
244
- bearer_token: "token"
245
- )
246
- service = IBMWatson::CompareComplyV1.new(
247
- version: "2018-10-15",
248
- authenticator: authenticator
249
- )
250
182
  message_response = {
251
183
  "batches" => []
252
184
  }
@@ -257,7 +189,6 @@ class CompareComplyV1 < Minitest::Test
257
189
  .with(
258
190
  headers: {
259
191
  "Accept" => "application/json",
260
- "Authorization" => "Bearer token",
261
192
  "Host" => "gateway.watsonplatform.net"
262
193
  }
263
194
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
@@ -267,19 +198,11 @@ class CompareComplyV1 < Minitest::Test
267
198
  end
268
199
 
269
200
  def test_get_batch
270
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
271
- bearer_token: "token"
272
- )
273
- service = IBMWatson::CompareComplyV1.new(
274
- version: "2018-10-15",
275
- authenticator: authenticator
276
- )
277
201
  message_response = "200"
278
202
  stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?version=2018-10-15")
279
203
  .with(
280
204
  headers: {
281
205
  "Accept" => "application/json",
282
- "Authorization" => "Bearer token",
283
206
  "Host" => "gateway.watsonplatform.net"
284
207
  }
285
208
  ).to_return(status: 200, body: message_response, headers: {})
@@ -291,19 +214,11 @@ class CompareComplyV1 < Minitest::Test
291
214
  end
292
215
 
293
216
  def test_update_batch
294
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
295
- bearer_token: "token"
296
- )
297
- service = IBMWatson::CompareComplyV1.new(
298
- version: "2018-10-15",
299
- authenticator: authenticator
300
- )
301
217
  message_response = "200"
302
218
  stub_request(:put, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?action=goal&version=2018-10-15")
303
219
  .with(
304
220
  headers: {
305
221
  "Accept" => "application/json",
306
- "Authorization" => "Bearer token",
307
222
  "Host" => "gateway.watsonplatform.net"
308
223
  }
309
224
  ).to_return(status: 200, body: message_response, headers: {})
@@ -9,6 +9,16 @@ WebMock.disable_net_connect!(allow_localhost: true)
9
9
 
10
10
  # Unit tests for the Discovery V1 Service
11
11
  class DiscoveryV1Test < Minitest::Test
12
+ include Minitest::Hooks
13
+ attr_accessor :service
14
+ def before_all
15
+ authenticator = IBMWatson::Authenticators::NoAuthAuthenticator.new
16
+ @service = IBMWatson::DiscoveryV1.new(
17
+ version: "2018-03-05",
18
+ authenticator: authenticator
19
+ )
20
+ end
21
+
12
22
  def test_environments
13
23
  discovery_response_body = {
14
24
  "environments" => [
@@ -42,18 +52,9 @@ class DiscoveryV1Test < Minitest::Test
42
52
  .with(
43
53
  headers: {
44
54
  "Accept" => "application/json",
45
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
46
55
  "Host" => "gateway.watsonplatform.net"
47
56
  }
48
57
  ).to_return(status: 200, body: discovery_response_body.to_json, headers: { "Content-Type" => "application/json" })
49
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
50
- username: "username",
51
- password: "password"
52
- )
53
- service = IBMWatson::DiscoveryV1.new(
54
- version: "2018-03-05",
55
- authenticator: authenticator
56
- )
57
58
  service_response = service.list_environments
58
59
  assert_equal(discovery_response_body, service_response.result)
59
60
  end
@@ -63,18 +64,9 @@ class DiscoveryV1Test < Minitest::Test
63
64
  .with(
64
65
  headers: {
65
66
  "Accept" => "application/json",
66
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
67
67
  "Host" => "gateway.watsonplatform.net"
68
68
  }
69
69
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
70
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
71
- username: "username",
72
- password: "password"
73
- )
74
- service = IBMWatson::DiscoveryV1.new(
75
- version: "2018-03-05",
76
- authenticator: authenticator
77
- )
78
70
  service_response = service.get_environment(
79
71
  environment_id: "envid"
80
72
  )
@@ -87,19 +79,10 @@ class DiscoveryV1Test < Minitest::Test
87
79
  body: "{\"name\":\"my name\",\"description\":\"my description\"}",
88
80
  headers: {
89
81
  "Accept" => "application/json",
90
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
91
82
  "Content-Type" => "application/json",
92
83
  "Host" => "gateway.watsonplatform.net"
93
84
  }
94
85
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
95
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
96
- username: "username",
97
- password: "password"
98
- )
99
- service = IBMWatson::DiscoveryV1.new(
100
- version: "2018-03-05",
101
- authenticator: authenticator
102
- )
103
86
  service_response = service.create_environment(
104
87
  name: "my name",
105
88
  description: "my description"
@@ -113,19 +96,10 @@ class DiscoveryV1Test < Minitest::Test
113
96
  body: "{\"name\":\"hello\",\"description\":\"new\"}",
114
97
  headers: {
115
98
  "Accept" => "application/json",
116
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
117
99
  "Content-Type" => "application/json",
118
100
  "Host" => "gateway.watsonplatform.net"
119
101
  }
120
102
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
121
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
122
- username: "username",
123
- password: "password"
124
- )
125
- service = IBMWatson::DiscoveryV1.new(
126
- version: "2018-03-05",
127
- authenticator: authenticator
128
- )
129
103
  service_response = service.update_environment(
130
104
  environment_id: "envid",
131
105
  name: "hello",
@@ -139,18 +113,9 @@ class DiscoveryV1Test < Minitest::Test
139
113
  .with(
140
114
  headers: {
141
115
  "Accept" => "application/json",
142
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
143
116
  "Host" => "gateway.watsonplatform.net"
144
117
  }
145
118
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
146
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
147
- username: "username",
148
- password: "password"
149
- )
150
- service = IBMWatson::DiscoveryV1.new(
151
- version: "2018-03-05",
152
- authenticator: authenticator
153
- )
154
119
  service_response = service.delete_environment(
155
120
  environment_id: "envid"
156
121
  )
@@ -162,18 +127,9 @@ class DiscoveryV1Test < Minitest::Test
162
127
  .with(
163
128
  headers: {
164
129
  "Accept" => "application/json",
165
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
166
130
  "Host" => "gateway.watsonplatform.net"
167
131
  }
168
132
  ).to_return(status: 200, body: { "body" => "hello" }.to_json, headers: { "Content-Type" => "application/json" })
169
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
170
- username: "username",
171
- password: "password"
172
- )
173
- service = IBMWatson::DiscoveryV1.new(
174
- version: "2018-03-05",
175
- authenticator: authenticator
176
- )
177
133
  service_response = service.list_collections(
178
134
  environment_id: "envid"
179
135
  )
@@ -181,20 +137,11 @@ class DiscoveryV1Test < Minitest::Test
181
137
  end
182
138
 
183
139
  def test_collection
184
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
185
- username: "username",
186
- password: "password"
187
- )
188
- service = IBMWatson::DiscoveryV1.new(
189
- version: "2018-03-05",
190
- authenticator: authenticator
191
- )
192
140
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections?version=2018-03-05")
193
141
  .with(
194
142
  body: "{\"name\":\"name\",\"description\":\"\",\"configuration_id\":\"confid\",\"language\":\"\"}",
195
143
  headers: {
196
144
  "Accept" => "application/json",
197
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
198
145
  "Content-Type" => "application/json",
199
146
  "Host" => "gateway.watsonplatform.net"
200
147
  }
@@ -213,7 +160,6 @@ class DiscoveryV1Test < Minitest::Test
213
160
  body: "{\"name\":\"name\",\"description\":\"\",\"language\":\"es\"}",
214
161
  headers: {
215
162
  "Accept" => "application/json",
216
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
217
163
  "Content-Type" => "application/json",
218
164
  "Host" => "gateway.watsonplatform.net"
219
165
  }
@@ -230,7 +176,6 @@ class DiscoveryV1Test < Minitest::Test
230
176
  .with(
231
177
  headers: {
232
178
  "Accept" => "application/json",
233
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
234
179
  "Host" => "gateway.watsonplatform.net"
235
180
  }
236
181
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -244,7 +189,6 @@ class DiscoveryV1Test < Minitest::Test
244
189
  .with(
245
190
  headers: {
246
191
  "Accept" => "application/json",
247
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
248
192
  "Host" => "gateway.watsonplatform.net"
249
193
  }
250
194
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -258,7 +202,6 @@ class DiscoveryV1Test < Minitest::Test
258
202
  .with(
259
203
  headers: {
260
204
  "Accept" => "application/json",
261
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
262
205
  "Host" => "gateway.watsonplatform.net"
263
206
  }
264
207
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -270,20 +213,11 @@ class DiscoveryV1Test < Minitest::Test
270
213
  end
271
214
 
272
215
  def test_query
273
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
274
- username: "username",
275
- password: "password"
276
- )
277
- service = IBMWatson::DiscoveryV1.new(
278
- version: "2018-03-05",
279
- authenticator: authenticator
280
- )
281
216
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/query?version=2018-03-05")
282
217
  .with(
283
218
  body: "{\"count\":10}",
284
219
  headers: {
285
220
  "Accept" => "application/json",
286
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
287
221
  "Host" => "gateway.watsonplatform.net"
288
222
  }
289
223
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -304,19 +238,10 @@ class DiscoveryV1Test < Minitest::Test
304
238
  }
305
239
  ]
306
240
  }
307
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
308
- username: "username",
309
- password: "password"
310
- )
311
- service = IBMWatson::DiscoveryV1.new(
312
- version: "2018-03-05",
313
- authenticator: authenticator
314
- )
315
241
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations?version=2018-03-05")
316
242
  .with(
317
243
  headers: {
318
244
  "Accept" => "application/json",
319
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
320
245
  "Host" => "gateway.watsonplatform.net"
321
246
  }
322
247
  ).to_return(status: 200, body: results.to_json, headers: { "Content-Type" => "application/json" })
@@ -329,7 +254,6 @@ class DiscoveryV1Test < Minitest::Test
329
254
  .with(
330
255
  headers: {
331
256
  "Accept" => "application/json",
332
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
333
257
  "Host" => "gateway.watsonplatform.net"
334
258
  }
335
259
  ).to_return(status: 200, body: results["configurations"][0].to_json, headers: { "Content-Type" => "application/json" })
@@ -344,7 +268,6 @@ class DiscoveryV1Test < Minitest::Test
344
268
  body: "{\"name\":\"my name\"}",
345
269
  headers: {
346
270
  "Accept" => "application/json",
347
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
348
271
  "Content-Type" => "application/json",
349
272
  "Host" => "gateway.watsonplatform.net"
350
273
  }
@@ -360,7 +283,6 @@ class DiscoveryV1Test < Minitest::Test
360
283
  body: "{\"name\":\"my new name\"}",
361
284
  headers: {
362
285
  "Accept" => "application/json",
363
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
364
286
  "Content-Type" => "application/json",
365
287
  "Host" => "gateway.watsonplatform.net"
366
288
  }
@@ -376,7 +298,6 @@ class DiscoveryV1Test < Minitest::Test
376
298
  .with(
377
299
  headers: {
378
300
  "Accept" => "application/json",
379
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
380
301
  "Host" => "gateway.watsonplatform.net"
381
302
  }
382
303
  ).to_return(status: 200, body: { "deleted" => "bogus -- ok" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -388,14 +309,6 @@ class DiscoveryV1Test < Minitest::Test
388
309
  end
389
310
 
390
311
  def test_document
391
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
392
- username: "username",
393
- password: "password"
394
- )
395
- service = IBMWatson::DiscoveryV1.new(
396
- version: "2018-03-05",
397
- authenticator: authenticator
398
- )
399
312
  doc_status = {
400
313
  "document_id" => "45556e23-f2b1-449d-8f27-489b514000ff",
401
314
  "configuration_id" => "2e079259-7dd2-40a9-998f-3e716f5a7b88",
@@ -409,7 +322,6 @@ class DiscoveryV1Test < Minitest::Test
409
322
  .with(
410
323
  headers: {
411
324
  "Accept" => "application/json",
412
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
413
325
  "Host" => "gateway.watsonplatform.net"
414
326
  }
415
327
  ).to_return(status: 200, body: { body: [] }.to_json, headers: { "Content-Type" => "application/json" })
@@ -425,7 +337,6 @@ class DiscoveryV1Test < Minitest::Test
425
337
  .with(
426
338
  headers: {
427
339
  "Accept" => "application/json",
428
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
429
340
  "Host" => "gateway.watsonplatform.net"
430
341
  }
431
342
  ).to_return(status: 200, body: doc_status.to_json, headers: { "Content-Type" => "application/json" })
@@ -440,7 +351,6 @@ class DiscoveryV1Test < Minitest::Test
440
351
  .with(
441
352
  headers: {
442
353
  "Accept" => "application/json",
443
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
444
354
  "Host" => "gateway.watsonplatform.net"
445
355
  }
446
356
  ).to_return(status: 200, body: { body: [] }.to_json, headers: { "Content-Type" => "application/json" })
@@ -465,7 +375,6 @@ class DiscoveryV1Test < Minitest::Test
465
375
  .with(
466
376
  headers: {
467
377
  "Accept" => "application/json",
468
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
469
378
  "Host" => "gateway.watsonplatform.net"
470
379
  }
471
380
  ).to_return(status: 200, body: { body: [] }.to_json, headers: { "Content-Type" => "application/json" })
@@ -505,18 +414,9 @@ class DiscoveryV1Test < Minitest::Test
505
414
  end
506
415
 
507
416
  def test_delete_all_training_data
508
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
509
- username: "username",
510
- password: "password"
511
- )
512
- service = IBMWatson::DiscoveryV1.new(
513
- version: "2018-03-05",
514
- authenticator: authenticator
515
- )
516
417
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
517
418
  .with(
518
419
  headers: {
519
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
520
420
  "Host" => "gateway.watsonplatform.net"
521
421
  }
522
422
  ).to_return(status: 204, body: "", headers: {})
@@ -528,14 +428,6 @@ class DiscoveryV1Test < Minitest::Test
528
428
  end
529
429
 
530
430
  def test_list_training_data
531
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
532
- username: "username",
533
- password: "password"
534
- )
535
- service = IBMWatson::DiscoveryV1.new(
536
- version: "2018-03-05",
537
- authenticator: authenticator
538
- )
539
431
  mock_response = {
540
432
  "environment_id" => "string",
541
433
  "collection_id" => "string",
@@ -558,7 +450,6 @@ class DiscoveryV1Test < Minitest::Test
558
450
  .with(
559
451
  headers: {
560
452
  "Accept" => "application/json",
561
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
562
453
  "Host" => "gateway.watsonplatform.net"
563
454
  }
564
455
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
@@ -595,20 +486,11 @@ class DiscoveryV1Test < Minitest::Test
595
486
  }
596
487
  ]
597
488
  }
598
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
599
- username: "username",
600
- password: "password"
601
- )
602
- service = IBMWatson::DiscoveryV1.new(
603
- version: "2018-03-05",
604
- authenticator: authenticator
605
- )
606
489
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
607
490
  .with(
608
491
  body: "{\"natural_language_query\":\"why is the sky blue\",\"filter\":\"text:meteorology\",\"examples\":[{\"document_id\":\"54f95ac0-3e4f-4756-bea6-7a67b2713c81\",\"relevance\":1},{\"document_id\":\"01bcca32-7300-4c9f-8d32-33ed7ea643da\",\"cross_reference\":\"my_id_field:1463\",\"relevance\":5}]}",
609
492
  headers: {
610
493
  "Accept" => "application/json",
611
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
612
494
  "Content-Type" => "application/json",
613
495
  "Host" => "gateway.watsonplatform.net"
614
496
  }
@@ -624,18 +506,9 @@ class DiscoveryV1Test < Minitest::Test
624
506
  end
625
507
 
626
508
  def test_delete_training_data
627
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
628
- username: "username",
629
- password: "password"
630
- )
631
- service = IBMWatson::DiscoveryV1.new(
632
- version: "2018-03-05",
633
- authenticator: authenticator
634
- )
635
509
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid?version=2018-03-05")
636
510
  .with(
637
511
  headers: {
638
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
639
512
  "Host" => "gateway.watsonplatform.net"
640
513
  }
641
514
  ).to_return(status: 200, body: "", headers: {})
@@ -664,18 +537,9 @@ class DiscoveryV1Test < Minitest::Test
664
537
  .with(
665
538
  headers: {
666
539
  "Accept" => "application/json",
667
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
668
540
  "Host" => "gateway.watsonplatform.net"
669
541
  }
670
542
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
671
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
672
- username: "username",
673
- password: "password"
674
- )
675
- service = IBMWatson::DiscoveryV1.new(
676
- version: "2018-03-05",
677
- authenticator: authenticator
678
- )
679
543
  service_response = service.get_training_data(
680
544
  environment_id: "envid",
681
545
  collection_id: "collid",
@@ -693,20 +557,11 @@ class DiscoveryV1Test < Minitest::Test
693
557
  "cross_reference" => "string",
694
558
  "relevance" => 0
695
559
  }
696
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
697
- username: "username",
698
- password: "password"
699
- )
700
- service = IBMWatson::DiscoveryV1.new(
701
- version: "2018-03-05",
702
- authenticator: authenticator
703
- )
704
560
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
705
561
  .with(
706
562
  body: "{\"document_id\":\"string\",\"cross_reference\":\"string\",\"relevance\":0}",
707
563
  headers: {
708
564
  "Accept" => "application/json",
709
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
710
565
  "Content-Type" => "application/json",
711
566
  "Host" => "gateway.watsonplatform.net"
712
567
  }
@@ -723,18 +578,9 @@ class DiscoveryV1Test < Minitest::Test
723
578
  end
724
579
 
725
580
  def test_delete_training_example
726
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
727
- username: "username",
728
- password: "password"
729
- )
730
- service = IBMWatson::DiscoveryV1.new(
731
- version: "2018-03-05",
732
- authenticator: authenticator
733
- )
734
581
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
735
582
  .with(
736
583
  headers: {
737
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
738
584
  "Host" => "gateway.watsonplatform.net"
739
585
  }
740
586
  ).to_return(status: 204, body: "", headers: {})
@@ -753,19 +599,10 @@ class DiscoveryV1Test < Minitest::Test
753
599
  "cross_reference" => "string",
754
600
  "relevance" => 0
755
601
  }
756
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
757
- username: "username",
758
- password: "password"
759
- )
760
- service = IBMWatson::DiscoveryV1.new(
761
- version: "2018-03-05",
762
- authenticator: authenticator
763
- )
764
602
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
765
603
  .with(
766
604
  headers: {
767
605
  "Accept" => "application/json",
768
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
769
606
  "Host" => "gateway.watsonplatform.net"
770
607
  }
771
608
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
@@ -786,20 +623,11 @@ class DiscoveryV1Test < Minitest::Test
786
623
  "cross_reference" => "string",
787
624
  "relevance" => 0
788
625
  }
789
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
790
- username: "username",
791
- password: "password"
792
- )
793
- service = IBMWatson::DiscoveryV1.new(
794
- version: "2018-03-05",
795
- authenticator: authenticator
796
- )
797
626
  stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
798
627
  .with(
799
628
  body: "{\"cross_reference\":\"string\",\"relevance\":0}",
800
629
  headers: {
801
630
  "Accept" => "application/json",
802
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
803
631
  "Content-Type" => "application/json",
804
632
  "Host" => "gateway.watsonplatform.net"
805
633
  }
@@ -816,19 +644,10 @@ class DiscoveryV1Test < Minitest::Test
816
644
  end
817
645
 
818
646
  def test_expansions
819
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
820
- username: "username",
821
- password: "password"
822
- )
823
- service = IBMWatson::DiscoveryV1.new(
824
- version: "2018-03-05",
825
- authenticator: authenticator
826
- )
827
647
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
828
648
  .with(
829
649
  headers: {
830
650
  "Accept" => "application/json",
831
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
832
651
  "Host" => "gateway.watsonplatform.net"
833
652
  }
834
653
  ).to_return(status: 200, body: { expansions: "results" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -843,7 +662,6 @@ class DiscoveryV1Test < Minitest::Test
843
662
  body: "{\"expansions\":[{\"input_terms\":\"dumb\",\"expanded_terms\":\"dumb2\"}]}",
844
663
  headers: {
845
664
  "Accept" => "application/json",
846
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
847
665
  "Content-Type" => "application/json",
848
666
  "Host" => "gateway.watsonplatform.net"
849
667
  }
@@ -863,7 +681,6 @@ class DiscoveryV1Test < Minitest::Test
863
681
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
864
682
  .with(
865
683
  headers: {
866
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
867
684
  "Host" => "gateway.watsonplatform.net"
868
685
  }
869
686
  ).to_return(status: 200, body: { description: "success" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -875,19 +692,10 @@ class DiscoveryV1Test < Minitest::Test
875
692
  end
876
693
 
877
694
  def test_tokenization_dictionary
878
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
879
- username: "username",
880
- password: "password"
881
- )
882
- service = IBMWatson::DiscoveryV1.new(
883
- version: "2018-03-05",
884
- authenticator: authenticator
885
- )
886
695
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
887
696
  .with(
888
697
  headers: {
889
698
  "Accept" => "application/json",
890
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
891
699
  "Host" => "gateway.watsonplatform.net"
892
700
  }
893
701
  ).to_return(status: 200, body: { tokenization_dictionary: "results" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -902,7 +710,6 @@ class DiscoveryV1Test < Minitest::Test
902
710
  body: "{\"tokenization_rules\":[{\"rule1\":\"messi\",\"rule2\":\"ronaldo\"}]}",
903
711
  headers: {
904
712
  "Accept" => "application/json",
905
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
906
713
  "Content-Type" => "application/json",
907
714
  "Host" => "gateway.watsonplatform.net"
908
715
  }
@@ -922,7 +729,6 @@ class DiscoveryV1Test < Minitest::Test
922
729
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
923
730
  .with(
924
731
  headers: {
925
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
926
732
  "Host" => "gateway.watsonplatform.net"
927
733
  }
928
734
  ).to_return(status: 200, body: { description: "success" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -934,18 +740,9 @@ class DiscoveryV1Test < Minitest::Test
934
740
  end
935
741
 
936
742
  def test_delete_user_data
937
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
938
- username: "username",
939
- password: "password"
940
- )
941
- service = IBMWatson::DiscoveryV1.new(
942
- version: "2018-03-05",
943
- authenticator: authenticator
944
- )
945
743
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/user_data?customer_id=id&version=2018-03-05")
946
744
  .with(
947
745
  headers: {
948
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
949
746
  "Host" => "gateway.watsonplatform.net"
950
747
  }
951
748
  ).to_return(status: 200, body: "", headers: {})
@@ -956,19 +753,10 @@ class DiscoveryV1Test < Minitest::Test
956
753
  end
957
754
 
958
755
  def test_query_notices
959
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
960
- username: "username",
961
- password: "password"
962
- )
963
- service = IBMWatson::DiscoveryV1.new(
964
- version: "2018-03-05",
965
- authenticator: authenticator
966
- )
967
756
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/notices?version=2018-03-05")
968
757
  .with(
969
758
  headers: {
970
759
  "Accept" => "application/json",
971
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
972
760
  "Host" => "gateway.watsonplatform.net"
973
761
  }
974
762
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -980,20 +768,11 @@ class DiscoveryV1Test < Minitest::Test
980
768
  end
981
769
 
982
770
  def test_federated_query
983
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
984
- username: "username",
985
- password: "password"
986
- )
987
- service = IBMWatson::DiscoveryV1.new(
988
- version: "2018-03-05",
989
- authenticator: authenticator
990
- )
991
771
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/query?&version=2018-03-05")
992
772
  .with(
993
773
  body: "{\"collection_ids\":[\"collid\"]}",
994
774
  headers: {
995
775
  "Accept" => "application/json",
996
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
997
776
  "Host" => "gateway.watsonplatform.net",
998
777
  "Content-type" => "application/json"
999
778
  }
@@ -1006,19 +785,10 @@ class DiscoveryV1Test < Minitest::Test
1006
785
  end
1007
786
 
1008
787
  def test_federated_query_notices
1009
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1010
- username: "username",
1011
- password: "password"
1012
- )
1013
- service = IBMWatson::DiscoveryV1.new(
1014
- version: "2018-03-05",
1015
- authenticator: authenticator
1016
- )
1017
788
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/notices?collection_ids=collid&version=2018-03-05")
1018
789
  .with(
1019
790
  headers: {
1020
791
  "Accept" => "application/json",
1021
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1022
792
  "Host" => "gateway.watsonplatform.net"
1023
793
  }
1024
794
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1030,19 +800,10 @@ class DiscoveryV1Test < Minitest::Test
1030
800
  end
1031
801
 
1032
802
  def test_get_autocompletion
1033
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1034
- username: "username",
1035
- password: "password"
1036
- )
1037
- service = IBMWatson::DiscoveryV1.new(
1038
- version: "2018-03-05",
1039
- authenticator: authenticator
1040
- )
1041
803
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/autocompletion?prefix=hi&version=2018-03-05")
1042
804
  .with(
1043
805
  headers: {
1044
806
  "Accept" => "application/json",
1045
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1046
807
  "Host" => "gateway.watsonplatform.net"
1047
808
  }
1048
809
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1055,19 +816,10 @@ class DiscoveryV1Test < Minitest::Test
1055
816
  end
1056
817
 
1057
818
  def test_list_training_examples
1058
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1059
- username: "username",
1060
- password: "password"
1061
- )
1062
- service = IBMWatson::DiscoveryV1.new(
1063
- version: "2018-03-05",
1064
- authenticator: authenticator
1065
- )
1066
819
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
1067
820
  .with(
1068
821
  headers: {
1069
822
  "Accept" => "application/json",
1070
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1071
823
  "Host" => "gateway.watsonplatform.net"
1072
824
  }
1073
825
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1103,7 +855,6 @@ class DiscoveryV1Test < Minitest::Test
1103
855
  body: "{\"type\":\"click\",\"data\":{\"environment_id\":\"envid\",\"session_token\":\"token\",\"collection_id\":\"collid\",\"document_id\":\"docid\"}}",
1104
856
  headers: {
1105
857
  "Accept" => "application/json",
1106
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1107
858
  "Content-Type" => "application/json",
1108
859
  "Host" => "gateway.watsonplatform.net"
1109
860
  }
@@ -1117,19 +868,10 @@ class DiscoveryV1Test < Minitest::Test
1117
868
  end
1118
869
 
1119
870
  def test_query_log
1120
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1121
- username: "username",
1122
- password: "password"
1123
- )
1124
- service = IBMWatson::DiscoveryV1.new(
1125
- version: "2018-03-05",
1126
- authenticator: authenticator
1127
- )
1128
871
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/logs?count=10&query=test&version=2018-03-05")
1129
872
  .with(
1130
873
  headers: {
1131
874
  "Accept" => "application/json",
1132
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1133
875
  "Host" => "gateway.watsonplatform.net"
1134
876
  }
1135
877
  )
@@ -1154,7 +896,6 @@ class DiscoveryV1Test < Minitest::Test
1154
896
  .with(
1155
897
  headers: {
1156
898
  "Accept" => "application/json",
1157
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1158
899
  "Host" => "gateway.watsonplatform.net"
1159
900
  }
1160
901
  )
@@ -1179,7 +920,6 @@ class DiscoveryV1Test < Minitest::Test
1179
920
  .with(
1180
921
  headers: {
1181
922
  "Accept" => "application/json",
1182
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1183
923
  "Host" => "gateway.watsonplatform.net"
1184
924
  }
1185
925
  )
@@ -1204,7 +944,6 @@ class DiscoveryV1Test < Minitest::Test
1204
944
  .with(
1205
945
  headers: {
1206
946
  "Accept" => "application/json",
1207
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1208
947
  "Host" => "gateway.watsonplatform.net"
1209
948
  }
1210
949
  )
@@ -1228,7 +967,6 @@ class DiscoveryV1Test < Minitest::Test
1228
967
  .with(
1229
968
  headers: {
1230
969
  "Accept" => "application/json",
1231
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1232
970
  "Host" => "gateway.watsonplatform.net"
1233
971
  }
1234
972
  )
@@ -1253,7 +991,6 @@ class DiscoveryV1Test < Minitest::Test
1253
991
  .with(
1254
992
  headers: {
1255
993
  "Accept" => "application/json",
1256
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1257
994
  "Host" => "gateway.watsonplatform.net"
1258
995
  }
1259
996
  )
@@ -1266,19 +1003,10 @@ class DiscoveryV1Test < Minitest::Test
1266
1003
  end
1267
1004
 
1268
1005
  def test_list_credentials
1269
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1270
- username: "username",
1271
- password: "password"
1272
- )
1273
- service = IBMWatson::DiscoveryV1.new(
1274
- version: "2018-03-05",
1275
- authenticator: authenticator
1276
- )
1277
1006
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials?version=2018-03-05")
1278
1007
  .with(
1279
1008
  headers: {
1280
1009
  "Accept" => "application/json",
1281
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1282
1010
  "Host" => "gateway.watsonplatform.net"
1283
1011
  }
1284
1012
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1289,20 +1017,11 @@ class DiscoveryV1Test < Minitest::Test
1289
1017
  end
1290
1018
 
1291
1019
  def test_create_credentials
1292
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1293
- username: "username",
1294
- password: "password"
1295
- )
1296
- service = IBMWatson::DiscoveryV1.new(
1297
- version: "2018-03-05",
1298
- authenticator: authenticator
1299
- )
1300
1020
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials?version=2018-03-05")
1301
1021
  .with(
1302
1022
  body: "{\"source_type\":\"salesforce\"}",
1303
1023
  headers: {
1304
1024
  "Accept" => "application/json",
1305
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1306
1025
  "Content-Type" => "application/json",
1307
1026
  "Host" => "gateway.watsonplatform.net"
1308
1027
  }
@@ -1315,19 +1034,10 @@ class DiscoveryV1Test < Minitest::Test
1315
1034
  end
1316
1035
 
1317
1036
  def test_get_credentials
1318
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1319
- username: "username",
1320
- password: "password"
1321
- )
1322
- service = IBMWatson::DiscoveryV1.new(
1323
- version: "2018-03-05",
1324
- authenticator: authenticator
1325
- )
1326
1037
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
1327
1038
  .with(
1328
1039
  headers: {
1329
1040
  "Accept" => "application/json",
1330
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1331
1041
  "Host" => "gateway.watsonplatform.net"
1332
1042
  }
1333
1043
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1339,20 +1049,11 @@ class DiscoveryV1Test < Minitest::Test
1339
1049
  end
1340
1050
 
1341
1051
  def test_update_credentials
1342
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1343
- username: "username",
1344
- password: "password"
1345
- )
1346
- service = IBMWatson::DiscoveryV1.new(
1347
- version: "2018-03-05",
1348
- authenticator: authenticator
1349
- )
1350
1052
  stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
1351
1053
  .with(
1352
1054
  body: "{\"source_type\":\"salesforce\"}",
1353
1055
  headers: {
1354
1056
  "Accept" => "application/json",
1355
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1356
1057
  "Content-Type" => "application/json",
1357
1058
  "Host" => "gateway.watsonplatform.net"
1358
1059
  }
@@ -1366,19 +1067,10 @@ class DiscoveryV1Test < Minitest::Test
1366
1067
  end
1367
1068
 
1368
1069
  def test_delete_credentials
1369
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1370
- username: "username",
1371
- password: "password"
1372
- )
1373
- service = IBMWatson::DiscoveryV1.new(
1374
- version: "2018-03-05",
1375
- authenticator: authenticator
1376
- )
1377
1070
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
1378
1071
  .with(
1379
1072
  headers: {
1380
1073
  "Accept" => "application/json",
1381
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1382
1074
  "Host" => "gateway.watsonplatform.net"
1383
1075
  }
1384
1076
  ).to_return(status: 200, body: { "deleted" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1390,20 +1082,11 @@ class DiscoveryV1Test < Minitest::Test
1390
1082
  end
1391
1083
 
1392
1084
  def test_update_collection
1393
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1394
- username: "username",
1395
- password: "password"
1396
- )
1397
- service = IBMWatson::DiscoveryV1.new(
1398
- version: "2018-03-05",
1399
- authenticator: authenticator
1400
- )
1401
1085
  stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid?version=2018-03-05")
1402
1086
  .with(
1403
1087
  body: "{\"name\":\"name\",\"description\":\"updated description\"}",
1404
1088
  headers: {
1405
1089
  "Accept" => "application/json",
1406
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1407
1090
  "Content-Type" => "application/json",
1408
1091
  "Host" => "gateway.watsonplatform.net"
1409
1092
  }
@@ -1418,19 +1101,10 @@ class DiscoveryV1Test < Minitest::Test
1418
1101
  end
1419
1102
 
1420
1103
  def test_get_stopword_list_status
1421
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1422
- username: "username",
1423
- password: "password"
1424
- )
1425
- service = IBMWatson::DiscoveryV1.new(
1426
- version: "2018-03-05",
1427
- authenticator: authenticator
1428
- )
1429
1104
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/stopwords?version=2018-03-05")
1430
1105
  .with(
1431
1106
  headers: {
1432
1107
  "Accept" => "application/json",
1433
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1434
1108
  "Host" => "gateway.watsonplatform.net"
1435
1109
  }
1436
1110
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1442,19 +1116,10 @@ class DiscoveryV1Test < Minitest::Test
1442
1116
  end
1443
1117
 
1444
1118
  def test_list_fields
1445
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1446
- username: "username",
1447
- password: "password"
1448
- )
1449
- service = IBMWatson::DiscoveryV1.new(
1450
- version: "2018-03-05",
1451
- authenticator: authenticator
1452
- )
1453
1119
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/fields?collection_ids=collid&version=2018-03-05")
1454
1120
  .with(
1455
1121
  headers: {
1456
1122
  "Accept" => "application/json",
1457
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1458
1123
  "Host" => "gateway.watsonplatform.net"
1459
1124
  }
1460
1125
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1466,15 +1131,6 @@ class DiscoveryV1Test < Minitest::Test
1466
1131
  end
1467
1132
 
1468
1133
  def test_create_stopword_list
1469
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1470
- username: "username",
1471
- password: "password"
1472
- )
1473
- service = IBMWatson::DiscoveryV1.new(
1474
- version: "2018-03-05",
1475
- authenticator: authenticator
1476
- )
1477
-
1478
1134
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05").with do |req|
1479
1135
  assert_equal(req.headers["Accept"], "application/json")
1480
1136
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
@@ -1488,18 +1144,9 @@ class DiscoveryV1Test < Minitest::Test
1488
1144
  end
1489
1145
 
1490
1146
  def test_delete_stopword_list
1491
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1492
- username: "username",
1493
- password: "password"
1494
- )
1495
- service = IBMWatson::DiscoveryV1.new(
1496
- version: "2018-03-05",
1497
- authenticator: authenticator
1498
- )
1499
1147
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05")
1500
1148
  .with(
1501
1149
  headers: {
1502
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1503
1150
  "Host" => "gateway.watsonplatform.net"
1504
1151
  }
1505
1152
  ).to_return(status: 200, body: { "deleted" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1511,19 +1158,10 @@ class DiscoveryV1Test < Minitest::Test
1511
1158
  end
1512
1159
 
1513
1160
  def test_list_gateways
1514
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1515
- username: "username",
1516
- password: "password"
1517
- )
1518
- service = IBMWatson::DiscoveryV1.new(
1519
- version: "2018-03-05",
1520
- authenticator: authenticator
1521
- )
1522
1161
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
1523
1162
  .with(
1524
1163
  headers: {
1525
1164
  "Accept" => "application/json",
1526
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1527
1165
  "Host" => "gateway.watsonplatform.net"
1528
1166
  }
1529
1167
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1534,19 +1172,10 @@ class DiscoveryV1Test < Minitest::Test
1534
1172
  end
1535
1173
 
1536
1174
  def test_create_gateway
1537
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1538
- username: "username",
1539
- password: "password"
1540
- )
1541
- service = IBMWatson::DiscoveryV1.new(
1542
- version: "2018-03-05",
1543
- authenticator: authenticator
1544
- )
1545
1175
  stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
1546
1176
  .with(
1547
1177
  headers: {
1548
1178
  "Accept" => "application/json",
1549
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1550
1179
  "Host" => "gateway.watsonplatform.net"
1551
1180
  }
1552
1181
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1557,19 +1186,10 @@ class DiscoveryV1Test < Minitest::Test
1557
1186
  end
1558
1187
 
1559
1188
  def test_get_gateway
1560
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1561
- username: "username",
1562
- password: "password"
1563
- )
1564
- service = IBMWatson::DiscoveryV1.new(
1565
- version: "2018-03-05",
1566
- authenticator: authenticator
1567
- )
1568
1189
  stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
1569
1190
  .with(
1570
1191
  headers: {
1571
1192
  "Accept" => "application/json",
1572
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1573
1193
  "Host" => "gateway.watsonplatform.net"
1574
1194
  }
1575
1195
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1581,19 +1201,10 @@ class DiscoveryV1Test < Minitest::Test
1581
1201
  end
1582
1202
 
1583
1203
  def test_delete_gateway
1584
- authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
1585
- username: "username",
1586
- password: "password"
1587
- )
1588
- service = IBMWatson::DiscoveryV1.new(
1589
- version: "2018-03-05",
1590
- authenticator: authenticator
1591
- )
1592
1204
  stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
1593
1205
  .with(
1594
1206
  headers: {
1595
1207
  "Accept" => "application/json",
1596
- "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
1597
1208
  "Host" => "gateway.watsonplatform.net"
1598
1209
  }
1599
1210
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })