ibm_watson 1.3.0 → 2.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -5
  3. data/lib/ibm_watson/assistant_v1.rb +225 -199
  4. data/lib/ibm_watson/assistant_v2.rb +228 -21
  5. data/lib/ibm_watson/compare_comply_v1.rb +43 -24
  6. data/lib/ibm_watson/discovery_v1.rb +144 -19
  7. data/lib/ibm_watson/discovery_v2.rb +742 -23
  8. data/lib/ibm_watson/language_translator_v3.rb +216 -64
  9. data/lib/ibm_watson/natural_language_classifier_v1.rb +11 -3
  10. data/lib/ibm_watson/natural_language_understanding_v1.rb +32 -26
  11. data/lib/ibm_watson/personality_insights_v3.rb +22 -14
  12. data/lib/ibm_watson/speech_to_text_v1.rb +240 -106
  13. data/lib/ibm_watson/text_to_speech_v1.rb +139 -146
  14. data/lib/ibm_watson/tone_analyzer_v3.rb +19 -14
  15. data/lib/ibm_watson/version.rb +1 -1
  16. data/lib/ibm_watson/visual_recognition_v3.rb +31 -14
  17. data/lib/ibm_watson/visual_recognition_v4.rb +112 -22
  18. data/test/integration/test_assistant_v1.rb +9 -0
  19. data/test/integration/test_assistant_v2.rb +34 -0
  20. data/test/integration/test_compare_comply_v1.rb +1 -12
  21. data/test/integration/test_discovery_v2.rb +118 -6
  22. data/test/integration/test_language_translator_v3.rb +5 -0
  23. data/test/integration/test_speech_to_text_v1.rb +2 -0
  24. data/test/integration/test_text_to_speech_v1.rb +3 -3
  25. data/test/integration/test_visual_recognition_v4.rb +9 -0
  26. data/test/unit/test_assistant_v1.rb +149 -98
  27. data/test/unit/test_assistant_v2.rb +153 -8
  28. data/test/unit/test_compare_comply_v1.rb +20 -20
  29. data/test/unit/test_discovery_v1.rb +125 -125
  30. data/test/unit/test_discovery_v2.rb +262 -29
  31. data/test/unit/test_language_translator_v3.rb +85 -24
  32. data/test/unit/test_natural_language_classifier_v1.rb +17 -17
  33. data/test/unit/test_natural_language_understanding_v1.rb +10 -10
  34. data/test/unit/test_personality_insights_v3.rb +14 -14
  35. data/test/unit/test_speech_to_text_v1.rb +97 -97
  36. data/test/unit/test_text_to_speech_v1.rb +48 -48
  37. data/test/unit/test_tone_analyzer_v3.rb +12 -12
  38. data/test/unit/test_visual_recognition_v3.rb +16 -16
  39. data/test/unit/test_visual_recognition_v4.rb +56 -38
  40. metadata +5 -5
@@ -43,13 +43,13 @@ class AssistantV2Test < Minitest::Test
43
43
  headers = {
44
44
  "Content-Type" => "application/json"
45
45
  }
46
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v2/assistants/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/sessions/session/message?version=2018-02-16")
46
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/sessions/session/message?version=2018-02-16")
47
47
  .with(
48
48
  body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
49
49
  headers: {
50
50
  "Accept" => "application/json",
51
51
  "Content-Type" => "application/json",
52
- "Host" => "gateway.watsonplatform.net"
52
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
53
53
  }
54
54
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
55
55
  service_response = service.message(
@@ -70,13 +70,13 @@ class AssistantV2Test < Minitest::Test
70
70
  }
71
71
  }
72
72
  }
73
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v2/assistants/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/sessions/session/message?version=2018-02-16")
73
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/sessions/session/message?version=2018-02-16")
74
74
  .with(
75
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}}\"}",
76
76
  headers: {
77
77
  "Accept" => "application/json",
78
78
  "Content-Type" => "application/json",
79
- "Host" => "gateway.watsonplatform.net"
79
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
80
80
  }
81
81
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
82
82
  service_response = service.message(
@@ -101,11 +101,11 @@ class AssistantV2Test < Minitest::Test
101
101
  # headers = {
102
102
  # "Content-Type" => "application/json"
103
103
  # }
104
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v2/assistants/pizza_app-e0f3/sessions?version=2018-02-16")
104
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/pizza_app-e0f3/sessions?version=2018-02-16")
105
105
  .with(
106
106
  headers: {
107
107
  "Accept" => "application/json",
108
- "Host" => "gateway.watsonplatform.net"
108
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
109
109
  }
110
110
  ).to_return(status: 200, body: "", headers: {})
111
111
  service_response = service.create_session(
@@ -115,11 +115,11 @@ class AssistantV2Test < Minitest::Test
115
115
  end
116
116
 
117
117
  def test_delete_session
118
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v2/assistants/pizza_app-e0f3/sessions/session?version=2018-02-16")
118
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/pizza_app-e0f3/sessions/session?version=2018-02-16")
119
119
  .with(
120
120
  headers: {
121
121
  "Accept" => "application/json",
122
- "Host" => "gateway.watsonplatform.net"
122
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
123
123
  }
124
124
  ).to_return(status: 200, body: "", headers: {})
125
125
  service_response = service.delete_session(
@@ -128,4 +128,149 @@ class AssistantV2Test < Minitest::Test
128
128
  )
129
129
  assert_nil(service_response)
130
130
  end
131
+
132
+ def test_message_stateless
133
+ # service.set_default_headers("x-watson-learning-opt-out" => true)
134
+ assistant_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
135
+ message_response = {
136
+ "context" => {
137
+ "conversation_id" => "1b7b67c0-90ed-45dc-8508-9488bc483d5b",
138
+ "system" => {
139
+ "dialog_stack" => ["root"],
140
+ "dialog_turn_counter" => 1,
141
+ "dialog_request_counter" => 1
142
+ }
143
+ },
144
+ "intents" => [],
145
+ "entities" => [],
146
+ "input" => {},
147
+ "output" => {
148
+ "text" => "okay",
149
+ "log_messages" => []
150
+ }
151
+ }
152
+ headers = {
153
+ "Content-Type" => "application/json"
154
+ }
155
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/message?version=2018-02-16")
156
+ .with(
157
+ body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
158
+ headers: {
159
+ "Accept" => "application/json",
160
+ "Content-Type" => "application/json",
161
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
162
+ }
163
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
164
+ service_response = service.message_stateless(
165
+ assistant_id: assistant_id,
166
+ input: { "text" => "Turn on the lights" },
167
+ context: nil
168
+ )
169
+ assert_equal(message_response, service_response.result)
170
+
171
+ message_ctx = {
172
+ "context" => {
173
+ "conversation_id" => "1b7b67c0-90ed-45dc-8508-9488bc483d5b",
174
+ "system" => {
175
+ "dialog_stack" => ["root"],
176
+ "dialog_turn_counter" => 2,
177
+ "dialog_request_counter" => 1
178
+ }
179
+ }
180
+ }
181
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/message?version=2018-02-16")
182
+ .with(
183
+ 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}}\"}",
184
+ headers: {
185
+ "Accept" => "application/json",
186
+ "Content-Type" => "application/json",
187
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
188
+ }
189
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
190
+ service_response = service.message_stateless(
191
+ assistant_id: assistant_id,
192
+ input: { "text" => "Turn on the lights" },
193
+ context: message_ctx["context"].to_json
194
+ )
195
+ assert_equal(message_response, service_response.result)
196
+ end
197
+
198
+ def test_list_logs
199
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/assistants/pizza_app-e0f3/logs?version=2018-02-16")
200
+ .with(
201
+ headers: {
202
+ "Accept" => "application/json",
203
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
204
+ }
205
+ ).to_return(status: 200, body: "", headers: {})
206
+ service_response = service.list_logs(
207
+ assistant_id: "pizza_app-e0f3"
208
+ )
209
+ assert_equal("", service_response.result)
210
+ end
211
+
212
+ def test_delete_user_data
213
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/user_data?customer_id=pizza_app-e0f3&version=2018-02-16")
214
+ .with(
215
+ headers: {
216
+ "Accept" => "application/json",
217
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
218
+ }
219
+ ).to_return(status: 200, body: "", headers: {})
220
+ service_response = service.delete_user_data(
221
+ customer_id: "pizza_app-e0f3"
222
+ )
223
+ assert_nil(service_response)
224
+ end
225
+
226
+ def test_bulk_classify
227
+ skill_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
228
+ message_response = {
229
+ "context" => {
230
+ "conversation_id" => "1b7b67c0-90ed-45dc-8508-9488bc483d5b",
231
+ "system" => {
232
+ "dialog_stack" => ["root"],
233
+ "dialog_turn_counter" => 1,
234
+ "dialog_request_counter" => 1
235
+ }
236
+ },
237
+ "intents" => [],
238
+ "entities" => [],
239
+ "input" => {},
240
+ "output" => {
241
+ "text" => "okay",
242
+ "log_messages" => []
243
+ }
244
+ }
245
+ headers = {
246
+ "Content-Type" => "application/json"
247
+ }
248
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/skills/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/workspace/bulk_classify?version=2018-02-16")
249
+ .with(
250
+ body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
251
+ headers: {
252
+ "Accept" => "application/json",
253
+ "Content-Type" => "application/json",
254
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
255
+ }
256
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
257
+ service_response = service.bulk_classify(
258
+ skill_id: skill_id,
259
+ input: { "text" => "Turn on the lights" }
260
+ )
261
+ assert_equal(message_response, service_response.result)
262
+
263
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v2/skills/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/workspace/bulk_classify?version=2018-02-16")
264
+ .with(
265
+ headers: {
266
+ "Accept" => "application/json",
267
+ "Content-Type" => "application/json",
268
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
269
+ }
270
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
271
+ service_response = service.bulk_classify(
272
+ skill_id: skill_id
273
+ )
274
+ assert_equal(message_response, service_response.result)
275
+ end
131
276
  end
@@ -7,7 +7,7 @@ SimpleCov.command_name "test:unit"
7
7
 
8
8
  WebMock.disable_net_connect!(allow_localhost: true)
9
9
 
10
- # Unit tests for the Watson Assistant V1 Service
10
+ # Unit test for the Watson Assistant V1 Service
11
11
  class CompareComplyV1 < Minitest::Test
12
12
  include Minitest::Hooks
13
13
  attr_accessor :service
@@ -21,7 +21,7 @@ class CompareComplyV1 < Minitest::Test
21
21
 
22
22
  def test_convert_to_html
23
23
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
24
- stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/html_conversion?version=2018-10-15").with do |req|
24
+ stub_request(:post, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/html_conversion?version=2018-10-15").with do |req|
25
25
  # Test the headers.
26
26
  assert_equal(req.headers["Accept"], "application/json")
27
27
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
@@ -33,7 +33,7 @@ class CompareComplyV1 < Minitest::Test
33
33
 
34
34
  def test_classify_elements
35
35
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
36
- stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/element_classification?version=2018-10-15").with do |req|
36
+ stub_request(:post, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/element_classification?version=2018-10-15").with do |req|
37
37
  assert_equal(req.headers["Accept"], "application/json")
38
38
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
39
39
  assert_match(/Content-Disposition: form-data/, req.body)
@@ -48,7 +48,7 @@ class CompareComplyV1 < Minitest::Test
48
48
 
49
49
  def test_extract_tables
50
50
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
51
- stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/tables?version=2018-10-15").with do |req|
51
+ stub_request(:post, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/tables?version=2018-10-15").with do |req|
52
52
  assert_equal(req.headers["Accept"], "application/json")
53
53
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
54
54
  assert_match(/Content-Disposition: form-data/, req.body)
@@ -63,7 +63,7 @@ class CompareComplyV1 < Minitest::Test
63
63
 
64
64
  def test_compare_documents
65
65
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
66
- stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/comparison?version=2018-10-15").with do |req|
66
+ stub_request(:post, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/comparison?version=2018-10-15").with do |req|
67
67
  assert_equal(req.headers["Accept"], "application/json")
68
68
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
69
69
  assert_match(/Content-Disposition: form-data/, req.body)
@@ -90,11 +90,11 @@ class CompareComplyV1 < Minitest::Test
90
90
  headers = {
91
91
  "Content-Type" => "application/json"
92
92
  }
93
- stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback?version=2018-10-15")
93
+ stub_request(:get, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/feedback?version=2018-10-15")
94
94
  .with(
95
95
  headers: {
96
96
  "Accept" => "application/json",
97
- "Host" => "gateway.watsonplatform.net"
97
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
98
98
  }
99
99
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
100
100
 
@@ -109,11 +109,11 @@ class CompareComplyV1 < Minitest::Test
109
109
  headers = {
110
110
  "Content-Type" => "application/json"
111
111
  }
112
- stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback?version=2018-10-15")
112
+ stub_request(:post, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/feedback?version=2018-10-15")
113
113
  .with(
114
114
  headers: {
115
115
  "Accept" => "application/json",
116
- "Host" => "gateway.watsonplatform.net"
116
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
117
117
  }
118
118
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
119
119
 
@@ -130,11 +130,11 @@ class CompareComplyV1 < Minitest::Test
130
130
  headers = {
131
131
  "Content-Type" => "application/json"
132
132
  }
133
- stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi?version=2018-10-15")
133
+ stub_request(:get, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/feedback/messi?version=2018-10-15")
134
134
  .with(
135
135
  headers: {
136
136
  "Accept" => "application/json",
137
- "Host" => "gateway.watsonplatform.net"
137
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
138
138
  }
139
139
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
140
140
 
@@ -146,11 +146,11 @@ class CompareComplyV1 < Minitest::Test
146
146
 
147
147
  def test_delete_feedback
148
148
  message_response = "200"
149
- stub_request(:delete, "https://gateway.watsonplatform.net/compare-comply/api/v1/feedback/messi?version=2018-10-15")
149
+ stub_request(:delete, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/feedback/messi?version=2018-10-15")
150
150
  .with(
151
151
  headers: {
152
152
  "Accept" => "application/json",
153
- "Host" => "gateway.watsonplatform.net"
153
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
154
154
  }
155
155
  ).to_return(status: 200, body: message_response, headers: {})
156
156
 
@@ -161,7 +161,7 @@ class CompareComplyV1 < Minitest::Test
161
161
  end
162
162
 
163
163
  def test_create_batch
164
- stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches?function=tables&version=2018-10-15")
164
+ stub_request(:post, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/batches?function=tables&version=2018-10-15")
165
165
  .with do |req|
166
166
  assert_equal req.headers["Accept"], "application/json"
167
167
  assert_match %r{\Amultipart/form-data}, req.headers["Content-Type"]
@@ -185,11 +185,11 @@ class CompareComplyV1 < Minitest::Test
185
185
  headers = {
186
186
  "Content-Type" => "application/json"
187
187
  }
188
- stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches?version=2018-10-15")
188
+ stub_request(:get, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/batches?version=2018-10-15")
189
189
  .with(
190
190
  headers: {
191
191
  "Accept" => "application/json",
192
- "Host" => "gateway.watsonplatform.net"
192
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
193
193
  }
194
194
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
195
195
 
@@ -199,11 +199,11 @@ class CompareComplyV1 < Minitest::Test
199
199
 
200
200
  def test_get_batch
201
201
  message_response = "200"
202
- stub_request(:get, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?version=2018-10-15")
202
+ stub_request(:get, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/batches/mo?version=2018-10-15")
203
203
  .with(
204
204
  headers: {
205
205
  "Accept" => "application/json",
206
- "Host" => "gateway.watsonplatform.net"
206
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
207
207
  }
208
208
  ).to_return(status: 200, body: message_response, headers: {})
209
209
 
@@ -215,11 +215,11 @@ class CompareComplyV1 < Minitest::Test
215
215
 
216
216
  def test_update_batch
217
217
  message_response = "200"
218
- stub_request(:put, "https://gateway.watsonplatform.net/compare-comply/api/v1/batches/mo?action=goal&version=2018-10-15")
218
+ stub_request(:put, "https://api.us-south.compare-comply.watson.cloud.ibm.com/v1/batches/mo?action=goal&version=2018-10-15")
219
219
  .with(
220
220
  headers: {
221
221
  "Accept" => "application/json",
222
- "Host" => "gateway.watsonplatform.net"
222
+ "Host" => "api.us-south.compare-comply.watson.cloud.ibm.com"
223
223
  }
224
224
  ).to_return(status: 200, body: message_response, headers: {})
225
225
 
@@ -48,11 +48,11 @@ class DiscoveryV1Test < Minitest::Test
48
48
  }
49
49
  ]
50
50
  }
51
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2018-03-05")
51
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments?version=2018-03-05")
52
52
  .with(
53
53
  headers: {
54
54
  "Accept" => "application/json",
55
- "Host" => "gateway.watsonplatform.net"
55
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
56
56
  }
57
57
  ).to_return(status: 200, body: discovery_response_body.to_json, headers: { "Content-Type" => "application/json" })
58
58
  service_response = service.list_environments
@@ -60,11 +60,11 @@ class DiscoveryV1Test < Minitest::Test
60
60
  end
61
61
 
62
62
  def test_get_environment
63
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid?version=2018-03-05")
63
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid?version=2018-03-05")
64
64
  .with(
65
65
  headers: {
66
66
  "Accept" => "application/json",
67
- "Host" => "gateway.watsonplatform.net"
67
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
68
68
  }
69
69
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
70
70
  service_response = service.get_environment(
@@ -74,13 +74,13 @@ class DiscoveryV1Test < Minitest::Test
74
74
  end
75
75
 
76
76
  def test_create_environment
77
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2018-03-05")
77
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments?version=2018-03-05")
78
78
  .with(
79
79
  body: "{\"name\":\"my name\",\"description\":\"my description\"}",
80
80
  headers: {
81
81
  "Accept" => "application/json",
82
82
  "Content-Type" => "application/json",
83
- "Host" => "gateway.watsonplatform.net"
83
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
84
84
  }
85
85
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
86
86
  service_response = service.create_environment(
@@ -91,13 +91,13 @@ class DiscoveryV1Test < Minitest::Test
91
91
  end
92
92
 
93
93
  def test_update_environment
94
- stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid?version=2018-03-05")
94
+ stub_request(:put, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid?version=2018-03-05")
95
95
  .with(
96
96
  body: "{\"name\":\"hello\",\"description\":\"new\"}",
97
97
  headers: {
98
98
  "Accept" => "application/json",
99
99
  "Content-Type" => "application/json",
100
- "Host" => "gateway.watsonplatform.net"
100
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
101
101
  }
102
102
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
103
103
  service_response = service.update_environment(
@@ -109,11 +109,11 @@ class DiscoveryV1Test < Minitest::Test
109
109
  end
110
110
 
111
111
  def test_delete_environment
112
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid?version=2018-03-05")
112
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid?version=2018-03-05")
113
113
  .with(
114
114
  headers: {
115
115
  "Accept" => "application/json",
116
- "Host" => "gateway.watsonplatform.net"
116
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
117
117
  }
118
118
  ).to_return(status: 200, body: { "resulting_key" => true }.to_json, headers: { "Content-Type" => "application/json" })
119
119
  service_response = service.delete_environment(
@@ -123,11 +123,11 @@ class DiscoveryV1Test < Minitest::Test
123
123
  end
124
124
 
125
125
  def test_collections
126
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections?version=2018-03-05")
126
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections?version=2018-03-05")
127
127
  .with(
128
128
  headers: {
129
129
  "Accept" => "application/json",
130
- "Host" => "gateway.watsonplatform.net"
130
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
131
131
  }
132
132
  ).to_return(status: 200, body: { "body" => "hello" }.to_json, headers: { "Content-Type" => "application/json" })
133
133
  service_response = service.list_collections(
@@ -137,13 +137,13 @@ class DiscoveryV1Test < Minitest::Test
137
137
  end
138
138
 
139
139
  def test_collection
140
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections?version=2018-03-05")
140
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections?version=2018-03-05")
141
141
  .with(
142
142
  body: "{\"name\":\"name\",\"description\":\"\",\"configuration_id\":\"confid\",\"language\":\"\"}",
143
143
  headers: {
144
144
  "Accept" => "application/json",
145
145
  "Content-Type" => "application/json",
146
- "Host" => "gateway.watsonplatform.net"
146
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
147
147
  }
148
148
  ).to_return(status: 200, body: { "body" => "create" }.to_json, headers: { "Content-Type" => "application/json" })
149
149
  service_response = service.create_collection(
@@ -155,13 +155,13 @@ class DiscoveryV1Test < Minitest::Test
155
155
  )
156
156
  assert_equal({ "body" => "create" }, service_response.result)
157
157
 
158
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections?version=2018-03-05")
158
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections?version=2018-03-05")
159
159
  .with(
160
160
  body: "{\"name\":\"name\",\"description\":\"\",\"language\":\"es\"}",
161
161
  headers: {
162
162
  "Accept" => "application/json",
163
163
  "Content-Type" => "application/json",
164
- "Host" => "gateway.watsonplatform.net"
164
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
165
165
  }
166
166
  ).to_return(status: 200, body: { "body" => "create" }.to_json, headers: { "Content-Type" => "application/json" })
167
167
  service_response = service.create_collection(
@@ -172,11 +172,11 @@ class DiscoveryV1Test < Minitest::Test
172
172
  )
173
173
  assert_equal({ "body" => "create" }, service_response.result)
174
174
 
175
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid?version=2018-03-05")
175
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid?version=2018-03-05")
176
176
  .with(
177
177
  headers: {
178
178
  "Accept" => "application/json",
179
- "Host" => "gateway.watsonplatform.net"
179
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
180
180
  }
181
181
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
182
182
  service_response = service.get_collection(
@@ -185,11 +185,11 @@ class DiscoveryV1Test < Minitest::Test
185
185
  )
186
186
  assert_equal({ "body" => "hello" }, service_response.result)
187
187
 
188
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid?version=2018-03-05")
188
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid?version=2018-03-05")
189
189
  .with(
190
190
  headers: {
191
191
  "Accept" => "application/json",
192
- "Host" => "gateway.watsonplatform.net"
192
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
193
193
  }
194
194
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
195
195
  service_response = service.delete_collection(
@@ -198,11 +198,11 @@ class DiscoveryV1Test < Minitest::Test
198
198
  )
199
199
  assert_equal({ "body" => "hello" }, service_response.result)
200
200
 
201
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/fields?version=2018-03-05")
201
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/fields?version=2018-03-05")
202
202
  .with(
203
203
  headers: {
204
204
  "Accept" => "application/json",
205
- "Host" => "gateway.watsonplatform.net"
205
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
206
206
  }
207
207
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
208
208
  service_response = service.list_collection_fields(
@@ -213,12 +213,12 @@ class DiscoveryV1Test < Minitest::Test
213
213
  end
214
214
 
215
215
  def test_query
216
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/query?version=2018-03-05")
216
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/query?version=2018-03-05")
217
217
  .with(
218
218
  body: "{\"count\":10}",
219
219
  headers: {
220
220
  "Accept" => "application/json",
221
- "Host" => "gateway.watsonplatform.net"
221
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
222
222
  }
223
223
  ).to_return(status: 200, body: { body: "hello" }.to_json, headers: { "Content-Type" => "application/json" })
224
224
  service_response = service.query(
@@ -238,11 +238,11 @@ class DiscoveryV1Test < Minitest::Test
238
238
  }
239
239
  ]
240
240
  }
241
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations?version=2018-03-05")
241
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/configurations?version=2018-03-05")
242
242
  .with(
243
243
  headers: {
244
244
  "Accept" => "application/json",
245
- "Host" => "gateway.watsonplatform.net"
245
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
246
246
  }
247
247
  ).to_return(status: 200, body: results.to_json, headers: { "Content-Type" => "application/json" })
248
248
  service_response = service.list_configurations(
@@ -250,11 +250,11 @@ class DiscoveryV1Test < Minitest::Test
250
250
  )
251
251
  assert_equal(results, service_response.result)
252
252
 
253
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations/confid?version=2018-03-05")
253
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/configurations/confid?version=2018-03-05")
254
254
  .with(
255
255
  headers: {
256
256
  "Accept" => "application/json",
257
- "Host" => "gateway.watsonplatform.net"
257
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
258
258
  }
259
259
  ).to_return(status: 200, body: results["configurations"][0].to_json, headers: { "Content-Type" => "application/json" })
260
260
  service_response = service.get_configuration(
@@ -263,13 +263,13 @@ class DiscoveryV1Test < Minitest::Test
263
263
  )
264
264
  assert_equal(results["configurations"][0], service_response.result)
265
265
 
266
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations?version=2018-03-05")
266
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/configurations?version=2018-03-05")
267
267
  .with(
268
268
  body: "{\"name\":\"my name\"}",
269
269
  headers: {
270
270
  "Accept" => "application/json",
271
271
  "Content-Type" => "application/json",
272
- "Host" => "gateway.watsonplatform.net"
272
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
273
273
  }
274
274
  ).to_return(status: 200, body: results["configurations"][0].to_json, headers: { "Content-Type" => "application/json" })
275
275
  service_response = service.create_configuration(
@@ -278,13 +278,13 @@ class DiscoveryV1Test < Minitest::Test
278
278
  )
279
279
  assert_equal(results["configurations"][0], service_response.result)
280
280
 
281
- stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations/confid?version=2018-03-05")
281
+ stub_request(:put, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/configurations/confid?version=2018-03-05")
282
282
  .with(
283
283
  body: "{\"name\":\"my new name\"}",
284
284
  headers: {
285
285
  "Accept" => "application/json",
286
286
  "Content-Type" => "application/json",
287
- "Host" => "gateway.watsonplatform.net"
287
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
288
288
  }
289
289
  ).to_return(status: 200, body: results["configurations"][0].to_json, headers: { "Content-Type" => "application/json" })
290
290
  service_response = service.update_configuration(
@@ -294,11 +294,11 @@ class DiscoveryV1Test < Minitest::Test
294
294
  )
295
295
  assert_equal(results["configurations"][0], service_response.result)
296
296
 
297
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/configurations/confid?version=2018-03-05")
297
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/configurations/confid?version=2018-03-05")
298
298
  .with(
299
299
  headers: {
300
300
  "Accept" => "application/json",
301
- "Host" => "gateway.watsonplatform.net"
301
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
302
302
  }
303
303
  ).to_return(status: 200, body: { "deleted" => "bogus -- ok" }.to_json, headers: { "Content-Type" => "application/json" })
304
304
  service_response = service.delete_configuration(
@@ -318,11 +318,11 @@ class DiscoveryV1Test < Minitest::Test
318
318
  "status_description" => "Document is successfully ingested and indexed with no warnings",
319
319
  "notices" => []
320
320
  }
321
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/documents?version=2018-03-05")
321
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/documents?version=2018-03-05")
322
322
  .with(
323
323
  headers: {
324
324
  "Accept" => "application/json",
325
- "Host" => "gateway.watsonplatform.net"
325
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
326
326
  }
327
327
  ).to_return(status: 200, body: { body: [] }.to_json, headers: { "Content-Type" => "application/json" })
328
328
  File.open(Dir.getwd + "/resources/simple.html") do |file_info|
@@ -333,11 +333,11 @@ class DiscoveryV1Test < Minitest::Test
333
333
  )
334
334
  refute(service_response.nil?)
335
335
  end
336
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/documents/docid?version=2018-03-05")
336
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/documents/docid?version=2018-03-05")
337
337
  .with(
338
338
  headers: {
339
339
  "Accept" => "application/json",
340
- "Host" => "gateway.watsonplatform.net"
340
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
341
341
  }
342
342
  ).to_return(status: 200, body: doc_status.to_json, headers: { "Content-Type" => "application/json" })
343
343
  service_response = service.get_document_status(
@@ -347,11 +347,11 @@ class DiscoveryV1Test < Minitest::Test
347
347
  )
348
348
  assert_equal(doc_status, service_response.result)
349
349
 
350
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/documents/docid?version=2018-03-05")
350
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/documents/docid?version=2018-03-05")
351
351
  .with(
352
352
  headers: {
353
353
  "Accept" => "application/json",
354
- "Host" => "gateway.watsonplatform.net"
354
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
355
355
  }
356
356
  ).to_return(status: 200, body: { body: [] }.to_json, headers: { "Content-Type" => "application/json" })
357
357
  service_response = service.update_document(
@@ -371,11 +371,11 @@ class DiscoveryV1Test < Minitest::Test
371
371
  )
372
372
  assert_equal({ "body" => [] }, service_response.result)
373
373
 
374
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/documents/docid?version=2018-03-05")
374
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/documents/docid?version=2018-03-05")
375
375
  .with(
376
376
  headers: {
377
377
  "Accept" => "application/json",
378
- "Host" => "gateway.watsonplatform.net"
378
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
379
379
  }
380
380
  ).to_return(status: 200, body: { body: [] }.to_json, headers: { "Content-Type" => "application/json" })
381
381
  service_response = service.delete_document(
@@ -414,10 +414,10 @@ class DiscoveryV1Test < Minitest::Test
414
414
  end
415
415
 
416
416
  def test_delete_all_training_data
417
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
417
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
418
418
  .with(
419
419
  headers: {
420
- "Host" => "gateway.watsonplatform.net"
420
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
421
421
  }
422
422
  ).to_return(status: 204, body: "", headers: {})
423
423
  service_response = service.delete_all_training_data(
@@ -446,11 +446,11 @@ class DiscoveryV1Test < Minitest::Test
446
446
  }
447
447
  ]
448
448
  }
449
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
449
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
450
450
  .with(
451
451
  headers: {
452
452
  "Accept" => "application/json",
453
- "Host" => "gateway.watsonplatform.net"
453
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
454
454
  }
455
455
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
456
456
  service_response = service.list_training_data(
@@ -486,13 +486,13 @@ class DiscoveryV1Test < Minitest::Test
486
486
  }
487
487
  ]
488
488
  }
489
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
489
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data?version=2018-03-05")
490
490
  .with(
491
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}]}",
492
492
  headers: {
493
493
  "Accept" => "application/json",
494
494
  "Content-Type" => "application/json",
495
- "Host" => "gateway.watsonplatform.net"
495
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
496
496
  }
497
497
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
498
498
  service_response = service.add_training_data(
@@ -506,10 +506,10 @@ class DiscoveryV1Test < Minitest::Test
506
506
  end
507
507
 
508
508
  def test_delete_training_data
509
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid?version=2018-03-05")
509
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid?version=2018-03-05")
510
510
  .with(
511
511
  headers: {
512
- "Host" => "gateway.watsonplatform.net"
512
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
513
513
  }
514
514
  ).to_return(status: 200, body: "", headers: {})
515
515
  service_response = service.delete_training_data(
@@ -533,11 +533,11 @@ class DiscoveryV1Test < Minitest::Test
533
533
  }
534
534
  ]
535
535
  }
536
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid?version=2018-03-05")
536
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid?version=2018-03-05")
537
537
  .with(
538
538
  headers: {
539
539
  "Accept" => "application/json",
540
- "Host" => "gateway.watsonplatform.net"
540
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
541
541
  }
542
542
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
543
543
  service_response = service.get_training_data(
@@ -557,13 +557,13 @@ class DiscoveryV1Test < Minitest::Test
557
557
  "cross_reference" => "string",
558
558
  "relevance" => 0
559
559
  }
560
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
560
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
561
561
  .with(
562
562
  body: "{\"document_id\":\"string\",\"cross_reference\":\"string\",\"relevance\":0}",
563
563
  headers: {
564
564
  "Accept" => "application/json",
565
565
  "Content-Type" => "application/json",
566
- "Host" => "gateway.watsonplatform.net"
566
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
567
567
  }
568
568
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
569
569
  service_response = service.create_training_example(
@@ -578,10 +578,10 @@ class DiscoveryV1Test < Minitest::Test
578
578
  end
579
579
 
580
580
  def test_delete_training_example
581
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
581
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
582
582
  .with(
583
583
  headers: {
584
- "Host" => "gateway.watsonplatform.net"
584
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
585
585
  }
586
586
  ).to_return(status: 204, body: "", headers: {})
587
587
  service_response = service.delete_training_example(
@@ -599,11 +599,11 @@ class DiscoveryV1Test < Minitest::Test
599
599
  "cross_reference" => "string",
600
600
  "relevance" => 0
601
601
  }
602
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
602
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
603
603
  .with(
604
604
  headers: {
605
605
  "Accept" => "application/json",
606
- "Host" => "gateway.watsonplatform.net"
606
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
607
607
  }
608
608
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
609
609
  service_response = service.get_training_example(
@@ -623,13 +623,13 @@ class DiscoveryV1Test < Minitest::Test
623
623
  "cross_reference" => "string",
624
624
  "relevance" => 0
625
625
  }
626
- stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
626
+ stub_request(:put, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid/examples/exampleid?version=2018-03-05")
627
627
  .with(
628
628
  body: "{\"cross_reference\":\"string\",\"relevance\":0}",
629
629
  headers: {
630
630
  "Accept" => "application/json",
631
631
  "Content-Type" => "application/json",
632
- "Host" => "gateway.watsonplatform.net"
632
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
633
633
  }
634
634
  ).to_return(status: 200, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
635
635
  service_response = service.update_training_example(
@@ -644,11 +644,11 @@ class DiscoveryV1Test < Minitest::Test
644
644
  end
645
645
 
646
646
  def test_expansions
647
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
647
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
648
648
  .with(
649
649
  headers: {
650
650
  "Accept" => "application/json",
651
- "Host" => "gateway.watsonplatform.net"
651
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
652
652
  }
653
653
  ).to_return(status: 200, body: { expansions: "results" }.to_json, headers: { "Content-Type" => "application/json" })
654
654
  service_response = service.list_expansions(
@@ -657,13 +657,13 @@ class DiscoveryV1Test < Minitest::Test
657
657
  )
658
658
  assert_equal({ "expansions" => "results" }, service_response.result)
659
659
 
660
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
660
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
661
661
  .with(
662
662
  body: "{\"expansions\":[{\"input_terms\":\"dumb\",\"expanded_terms\":\"dumb2\"}]}",
663
663
  headers: {
664
664
  "Accept" => "application/json",
665
665
  "Content-Type" => "application/json",
666
- "Host" => "gateway.watsonplatform.net"
666
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
667
667
  }
668
668
  ).to_return(status: 200, body: { expansions: "success" }.to_json, headers: { "Content-Type" => "application/json" })
669
669
  service_response = service.create_expansions(
@@ -678,10 +678,10 @@ class DiscoveryV1Test < Minitest::Test
678
678
  )
679
679
  assert_equal({ "expansions" => "success" }, service_response.result)
680
680
 
681
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
681
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/expansions?version=2018-03-05")
682
682
  .with(
683
683
  headers: {
684
- "Host" => "gateway.watsonplatform.net"
684
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
685
685
  }
686
686
  ).to_return(status: 200, body: { description: "success" }.to_json, headers: { "Content-Type" => "application/json" })
687
687
  service_response = service.delete_expansions(
@@ -692,11 +692,11 @@ class DiscoveryV1Test < Minitest::Test
692
692
  end
693
693
 
694
694
  def test_tokenization_dictionary
695
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
695
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
696
696
  .with(
697
697
  headers: {
698
698
  "Accept" => "application/json",
699
- "Host" => "gateway.watsonplatform.net"
699
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
700
700
  }
701
701
  ).to_return(status: 200, body: { tokenization_dictionary: "results" }.to_json, headers: { "Content-Type" => "application/json" })
702
702
  service_response = service.get_tokenization_dictionary_status(
@@ -705,13 +705,13 @@ class DiscoveryV1Test < Minitest::Test
705
705
  )
706
706
  assert_equal({ "tokenization_dictionary" => "results" }, service_response.result)
707
707
 
708
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
708
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
709
709
  .with(
710
710
  body: "{\"tokenization_rules\":[{\"rule1\":\"messi\",\"rule2\":\"ronaldo\"}]}",
711
711
  headers: {
712
712
  "Accept" => "application/json",
713
713
  "Content-Type" => "application/json",
714
- "Host" => "gateway.watsonplatform.net"
714
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
715
715
  }
716
716
  ).to_return(status: 200, body: { discription: "success" }.to_json, headers: { "Content-Type" => "application/json" })
717
717
  service_response = service.create_tokenization_dictionary(
@@ -726,10 +726,10 @@ class DiscoveryV1Test < Minitest::Test
726
726
  )
727
727
  assert_equal({ "discription" => "success" }, service_response.result)
728
728
 
729
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
729
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/word_lists/tokenization_dictionary?version=2018-03-05")
730
730
  .with(
731
731
  headers: {
732
- "Host" => "gateway.watsonplatform.net"
732
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
733
733
  }
734
734
  ).to_return(status: 200, body: { description: "success" }.to_json, headers: { "Content-Type" => "application/json" })
735
735
  service_response = service.delete_tokenization_dictionary(
@@ -740,10 +740,10 @@ class DiscoveryV1Test < Minitest::Test
740
740
  end
741
741
 
742
742
  def test_delete_user_data
743
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/user_data?customer_id=id&version=2018-03-05")
743
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/user_data?customer_id=id&version=2018-03-05")
744
744
  .with(
745
745
  headers: {
746
- "Host" => "gateway.watsonplatform.net"
746
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
747
747
  }
748
748
  ).to_return(status: 200, body: "", headers: {})
749
749
  service_response = service.delete_user_data(
@@ -753,11 +753,11 @@ class DiscoveryV1Test < Minitest::Test
753
753
  end
754
754
 
755
755
  def test_query_notices
756
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/notices?version=2018-03-05")
756
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/notices?version=2018-03-05")
757
757
  .with(
758
758
  headers: {
759
759
  "Accept" => "application/json",
760
- "Host" => "gateway.watsonplatform.net"
760
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
761
761
  }
762
762
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
763
763
  service_response = service.query_notices(
@@ -768,12 +768,12 @@ class DiscoveryV1Test < Minitest::Test
768
768
  end
769
769
 
770
770
  def test_federated_query
771
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/query?&version=2018-03-05")
771
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/query?&version=2018-03-05")
772
772
  .with(
773
773
  body: "{\"collection_ids\":[\"collid\"]}",
774
774
  headers: {
775
775
  "Accept" => "application/json",
776
- "Host" => "gateway.watsonplatform.net",
776
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com",
777
777
  "Content-type" => "application/json"
778
778
  }
779
779
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -785,11 +785,11 @@ class DiscoveryV1Test < Minitest::Test
785
785
  end
786
786
 
787
787
  def test_federated_query_notices
788
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/notices?collection_ids=collid&version=2018-03-05")
788
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/notices?collection_ids=collid&version=2018-03-05")
789
789
  .with(
790
790
  headers: {
791
791
  "Accept" => "application/json",
792
- "Host" => "gateway.watsonplatform.net"
792
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
793
793
  }
794
794
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
795
795
  service_response = service.federated_query_notices(
@@ -800,11 +800,11 @@ class DiscoveryV1Test < Minitest::Test
800
800
  end
801
801
 
802
802
  def test_get_autocompletion
803
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/autocompletion?prefix=hi&version=2018-03-05")
803
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/autocompletion?prefix=hi&version=2018-03-05")
804
804
  .with(
805
805
  headers: {
806
806
  "Accept" => "application/json",
807
- "Host" => "gateway.watsonplatform.net"
807
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
808
808
  }
809
809
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
810
810
  service_response = service.get_autocompletion(
@@ -816,11 +816,11 @@ class DiscoveryV1Test < Minitest::Test
816
816
  end
817
817
 
818
818
  def test_list_training_examples
819
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
819
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/training_data/queryid/examples?version=2018-03-05")
820
820
  .with(
821
821
  headers: {
822
822
  "Accept" => "application/json",
823
- "Host" => "gateway.watsonplatform.net"
823
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
824
824
  }
825
825
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
826
826
  service_response = service.list_training_examples(
@@ -850,13 +850,13 @@ class DiscoveryV1Test < Minitest::Test
850
850
  version: "2018-05-23",
851
851
  authenticator: authenticator
852
852
  )
853
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/events?version=2018-05-23")
853
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/events?version=2018-05-23")
854
854
  .with(
855
855
  body: "{\"type\":\"click\",\"data\":{\"environment_id\":\"envid\",\"session_token\":\"token\",\"collection_id\":\"collid\",\"document_id\":\"docid\"}}",
856
856
  headers: {
857
857
  "Accept" => "application/json",
858
858
  "Content-Type" => "application/json",
859
- "Host" => "gateway.watsonplatform.net"
859
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
860
860
  }
861
861
  )
862
862
  .to_return(status: 201, body: mock_response.to_json, headers: { "Content-Type" => "application/json" })
@@ -868,11 +868,11 @@ class DiscoveryV1Test < Minitest::Test
868
868
  end
869
869
 
870
870
  def test_query_log
871
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/logs?count=10&query=test&version=2018-03-05")
871
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/logs?count=10&query=test&version=2018-03-05")
872
872
  .with(
873
873
  headers: {
874
874
  "Accept" => "application/json",
875
- "Host" => "gateway.watsonplatform.net"
875
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
876
876
  }
877
877
  )
878
878
  .to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -892,11 +892,11 @@ class DiscoveryV1Test < Minitest::Test
892
892
  version: "2018-05-23",
893
893
  authenticator: authenticator
894
894
  )
895
- 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")
895
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/metrics/number_of_queries?end_time=2018-01-01T00:10:00Z&start_time=2018-01-01T00:00:00Z&version=2018-05-23")
896
896
  .with(
897
897
  headers: {
898
898
  "Accept" => "application/json",
899
- "Host" => "gateway.watsonplatform.net"
899
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
900
900
  }
901
901
  )
902
902
  .to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -916,11 +916,11 @@ class DiscoveryV1Test < Minitest::Test
916
916
  version: "2018-05-23",
917
917
  authenticator: authenticator
918
918
  )
919
- 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")
919
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/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")
920
920
  .with(
921
921
  headers: {
922
922
  "Accept" => "application/json",
923
- "Host" => "gateway.watsonplatform.net"
923
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
924
924
  }
925
925
  )
926
926
  .to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -940,11 +940,11 @@ class DiscoveryV1Test < Minitest::Test
940
940
  version: "2018-05-23",
941
941
  authenticator: authenticator
942
942
  )
943
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/metrics/top_query_tokens_with_event_rate?count=10&version=2018-05-23")
943
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/metrics/top_query_tokens_with_event_rate?count=10&version=2018-05-23")
944
944
  .with(
945
945
  headers: {
946
946
  "Accept" => "application/json",
947
- "Host" => "gateway.watsonplatform.net"
947
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
948
948
  }
949
949
  )
950
950
  .to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -963,11 +963,11 @@ class DiscoveryV1Test < Minitest::Test
963
963
  version: "2018-05-23",
964
964
  authenticator: authenticator
965
965
  )
966
- 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")
966
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/metrics/event_rate?end_time=2018-01-01T00:10:00Z&start_time=2018-01-01T00:00:00Z&version=2018-05-23")
967
967
  .with(
968
968
  headers: {
969
969
  "Accept" => "application/json",
970
- "Host" => "gateway.watsonplatform.net"
970
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
971
971
  }
972
972
  )
973
973
  .to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -987,11 +987,11 @@ class DiscoveryV1Test < Minitest::Test
987
987
  version: "2018-05-23",
988
988
  authenticator: authenticator
989
989
  )
990
- 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")
990
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/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")
991
991
  .with(
992
992
  headers: {
993
993
  "Accept" => "application/json",
994
- "Host" => "gateway.watsonplatform.net"
994
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
995
995
  }
996
996
  )
997
997
  .to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
@@ -1003,11 +1003,11 @@ class DiscoveryV1Test < Minitest::Test
1003
1003
  end
1004
1004
 
1005
1005
  def test_list_credentials
1006
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials?version=2018-03-05")
1006
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/credentials?version=2018-03-05")
1007
1007
  .with(
1008
1008
  headers: {
1009
1009
  "Accept" => "application/json",
1010
- "Host" => "gateway.watsonplatform.net"
1010
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1011
1011
  }
1012
1012
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1013
1013
  service_response = service.list_credentials(
@@ -1017,13 +1017,13 @@ class DiscoveryV1Test < Minitest::Test
1017
1017
  end
1018
1018
 
1019
1019
  def test_create_credentials
1020
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials?version=2018-03-05")
1020
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/credentials?version=2018-03-05")
1021
1021
  .with(
1022
1022
  body: "{\"source_type\":\"salesforce\"}",
1023
1023
  headers: {
1024
1024
  "Accept" => "application/json",
1025
1025
  "Content-Type" => "application/json",
1026
- "Host" => "gateway.watsonplatform.net"
1026
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1027
1027
  }
1028
1028
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1029
1029
  service_response = service.create_credentials(
@@ -1034,11 +1034,11 @@ class DiscoveryV1Test < Minitest::Test
1034
1034
  end
1035
1035
 
1036
1036
  def test_get_credentials
1037
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
1037
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/credentials/credid?version=2018-03-05")
1038
1038
  .with(
1039
1039
  headers: {
1040
1040
  "Accept" => "application/json",
1041
- "Host" => "gateway.watsonplatform.net"
1041
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1042
1042
  }
1043
1043
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1044
1044
  service_response = service.get_credentials(
@@ -1049,13 +1049,13 @@ class DiscoveryV1Test < Minitest::Test
1049
1049
  end
1050
1050
 
1051
1051
  def test_update_credentials
1052
- stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
1052
+ stub_request(:put, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/credentials/credid?version=2018-03-05")
1053
1053
  .with(
1054
1054
  body: "{\"source_type\":\"salesforce\"}",
1055
1055
  headers: {
1056
1056
  "Accept" => "application/json",
1057
1057
  "Content-Type" => "application/json",
1058
- "Host" => "gateway.watsonplatform.net"
1058
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1059
1059
  }
1060
1060
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1061
1061
  service_response = service.update_credentials(
@@ -1067,11 +1067,11 @@ class DiscoveryV1Test < Minitest::Test
1067
1067
  end
1068
1068
 
1069
1069
  def test_delete_credentials
1070
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/credentials/credid?version=2018-03-05")
1070
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/credentials/credid?version=2018-03-05")
1071
1071
  .with(
1072
1072
  headers: {
1073
1073
  "Accept" => "application/json",
1074
- "Host" => "gateway.watsonplatform.net"
1074
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1075
1075
  }
1076
1076
  ).to_return(status: 200, body: { "deleted" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1077
1077
  service_response = service.delete_credentials(
@@ -1082,13 +1082,13 @@ class DiscoveryV1Test < Minitest::Test
1082
1082
  end
1083
1083
 
1084
1084
  def test_update_collection
1085
- stub_request(:put, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid?version=2018-03-05")
1085
+ stub_request(:put, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid?version=2018-03-05")
1086
1086
  .with(
1087
1087
  body: "{\"name\":\"name\",\"description\":\"updated description\"}",
1088
1088
  headers: {
1089
1089
  "Accept" => "application/json",
1090
1090
  "Content-Type" => "application/json",
1091
- "Host" => "gateway.watsonplatform.net"
1091
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1092
1092
  }
1093
1093
  ).to_return(status: 200, body: { "updated" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1094
1094
  service_response = service.update_collection(
@@ -1101,11 +1101,11 @@ class DiscoveryV1Test < Minitest::Test
1101
1101
  end
1102
1102
 
1103
1103
  def test_get_stopword_list_status
1104
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/collid/word_lists/stopwords?version=2018-03-05")
1104
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/collid/word_lists/stopwords?version=2018-03-05")
1105
1105
  .with(
1106
1106
  headers: {
1107
1107
  "Accept" => "application/json",
1108
- "Host" => "gateway.watsonplatform.net"
1108
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1109
1109
  }
1110
1110
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1111
1111
  service_response = service.get_stopword_list_status(
@@ -1116,11 +1116,11 @@ class DiscoveryV1Test < Minitest::Test
1116
1116
  end
1117
1117
 
1118
1118
  def test_list_fields
1119
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/fields?collection_ids=collid&version=2018-03-05")
1119
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/fields?collection_ids=collid&version=2018-03-05")
1120
1120
  .with(
1121
1121
  headers: {
1122
1122
  "Accept" => "application/json",
1123
- "Host" => "gateway.watsonplatform.net"
1123
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1124
1124
  }
1125
1125
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1126
1126
  service_response = service.list_fields(
@@ -1131,7 +1131,7 @@ class DiscoveryV1Test < Minitest::Test
1131
1131
  end
1132
1132
 
1133
1133
  def test_create_stopword_list
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|
1134
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05").with do |req|
1135
1135
  assert_equal(req.headers["Accept"], "application/json")
1136
1136
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
1137
1137
  assert_match(/Content-Disposition: form-data/, req.body)
@@ -1144,10 +1144,10 @@ class DiscoveryV1Test < Minitest::Test
1144
1144
  end
1145
1145
 
1146
1146
  def test_delete_stopword_list
1147
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05")
1147
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05")
1148
1148
  .with(
1149
1149
  headers: {
1150
- "Host" => "gateway.watsonplatform.net"
1150
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1151
1151
  }
1152
1152
  ).to_return(status: 200, body: { "deleted" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1153
1153
  service_response = service.delete_stopword_list(
@@ -1158,11 +1158,11 @@ class DiscoveryV1Test < Minitest::Test
1158
1158
  end
1159
1159
 
1160
1160
  def test_list_gateways
1161
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
1161
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/gateways?version=2018-03-05")
1162
1162
  .with(
1163
1163
  headers: {
1164
1164
  "Accept" => "application/json",
1165
- "Host" => "gateway.watsonplatform.net"
1165
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1166
1166
  }
1167
1167
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1168
1168
  service_response = service.list_gateways(
@@ -1172,11 +1172,11 @@ class DiscoveryV1Test < Minitest::Test
1172
1172
  end
1173
1173
 
1174
1174
  def test_create_gateway
1175
- stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
1175
+ stub_request(:post, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/gateways?version=2018-03-05")
1176
1176
  .with(
1177
1177
  headers: {
1178
1178
  "Accept" => "application/json",
1179
- "Host" => "gateway.watsonplatform.net"
1179
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1180
1180
  }
1181
1181
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1182
1182
  service_response = service.create_gateway(
@@ -1186,11 +1186,11 @@ class DiscoveryV1Test < Minitest::Test
1186
1186
  end
1187
1187
 
1188
1188
  def test_get_gateway
1189
- stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
1189
+ stub_request(:get, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
1190
1190
  .with(
1191
1191
  headers: {
1192
1192
  "Accept" => "application/json",
1193
- "Host" => "gateway.watsonplatform.net"
1193
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1194
1194
  }
1195
1195
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1196
1196
  service_response = service.get_gateway(
@@ -1201,11 +1201,11 @@ class DiscoveryV1Test < Minitest::Test
1201
1201
  end
1202
1202
 
1203
1203
  def test_delete_gateway
1204
- stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
1204
+ stub_request(:delete, "https://api.us-south.discovery.watson.cloud.ibm.com/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
1205
1205
  .with(
1206
1206
  headers: {
1207
1207
  "Accept" => "application/json",
1208
- "Host" => "gateway.watsonplatform.net"
1208
+ "Host" => "api.us-south.discovery.watson.cloud.ibm.com"
1209
1209
  }
1210
1210
  ).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
1211
1211
  service_response = service.delete_gateway(