ibm_watson 1.5.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +42 -4
  3. data/lib/ibm_watson/assistant_v1.rb +213 -195
  4. data/lib/ibm_watson/assistant_v2.rb +161 -17
  5. data/lib/ibm_watson/compare_comply_v1.rb +35 -21
  6. data/lib/ibm_watson/discovery_v1.rb +132 -13
  7. data/lib/ibm_watson/discovery_v2.rb +728 -21
  8. data/lib/ibm_watson/language_translator_v3.rb +205 -67
  9. data/lib/ibm_watson/natural_language_classifier_v1.rb +4 -2
  10. data/lib/ibm_watson/natural_language_understanding_v1.rb +21 -21
  11. data/lib/ibm_watson/personality_insights_v3.rb +27 -18
  12. data/lib/ibm_watson/speech_to_text_v1.rb +58 -46
  13. data/lib/ibm_watson/text_to_speech_v1.rb +113 -129
  14. data/lib/ibm_watson/tone_analyzer_v3.rb +12 -13
  15. data/lib/ibm_watson/version.rb +1 -1
  16. data/lib/ibm_watson/visual_recognition_v3.rb +33 -16
  17. data/lib/ibm_watson/visual_recognition_v4.rb +58 -17
  18. data/test/integration/test_assistant_v1.rb +9 -0
  19. data/test/integration/test_assistant_v2.rb +27 -0
  20. data/test/integration/test_discovery_v2.rb +132 -6
  21. data/test/integration/test_language_translator_v3.rb +5 -0
  22. data/test/integration/test_text_to_speech_v1.rb +3 -3
  23. data/test/unit/test_assistant_v1.rb +150 -99
  24. data/test/unit/test_assistant_v2.rb +91 -12
  25. data/test/unit/test_compare_comply_v1.rb +20 -20
  26. data/test/unit/test_discovery_v1.rb +125 -125
  27. data/test/unit/test_discovery_v2.rb +262 -29
  28. data/test/unit/test_language_translator_v3.rb +85 -24
  29. data/test/unit/test_natural_language_classifier_v1.rb +17 -17
  30. data/test/unit/test_natural_language_understanding_v1.rb +10 -10
  31. data/test/unit/test_personality_insights_v3.rb +14 -14
  32. data/test/unit/test_speech_to_text_v1.rb +97 -97
  33. data/test/unit/test_text_to_speech_v1.rb +48 -48
  34. data/test/unit/test_tone_analyzer_v3.rb +12 -12
  35. data/test/unit/test_visual_recognition_v3.rb +16 -16
  36. data/test/unit/test_visual_recognition_v4.rb +40 -40
  37. metadata +12 -11
@@ -64,5 +64,32 @@ if !ENV["ASSISTANT_APIKEY"].nil? && !ENV["ASSISTANT_URL"].nil?
64
64
  session_id: session_id
65
65
  )
66
66
  end
67
+
68
+ def test_list_logs
69
+ skip "Premium plan only. Need Premium credentials"
70
+
71
+ service_response = service.list_logs(
72
+ assistant_id: ENV["ASSISTANT_ASSISTANT_ID"]
73
+ )
74
+ assert((200..299).cover?(service_response.status))
75
+ end
76
+
77
+ def test_delete_user_data
78
+ skip "Covered with the unit test. No need to run it here"
79
+
80
+ service_response = service.delete_user_data(
81
+ customer_id: ENV["ASSISTANT_ASSISTANT_ID"]
82
+ )
83
+ assert(service_response.nil?)
84
+ end
85
+
86
+ def test_bulk_classify
87
+ skip "Covered with the unit test. No need to run it here"
88
+
89
+ service_response = service.bulk_classify(
90
+ skill_id: ENV["ASSISTANT_WORKSPACE_ID"]
91
+ )
92
+ assert(service_response.nil?)
93
+ end
67
94
  end
68
95
  end
@@ -3,16 +3,18 @@
3
3
  require_relative("./../test_helper.rb")
4
4
  require("minitest/hooks/test")
5
5
 
6
- if !ENV["DISCOVERY_V2_TOKEN"].nil?
6
+ if !ENV["DISCOVERY_V2_APIKEY"].nil?
7
7
  # Integration tests for the Discovery V2 Service
8
8
  class DiscoveryV2Test < Minitest::Test
9
9
  include Minitest::Hooks
10
10
  attr_accessor :service, :environment_id, :collection_id
11
11
 
12
12
  def before_all
13
- token = ENV["DISCOVERY_V2_TOKEN"]
14
- authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
15
- bearer_token: token
13
+ # authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
14
+ # bearer_token: ENV["DISCOVERY_V2_TOKEN"]
15
+ # )
16
+ authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
17
+ apikey: ENV["DISCOVERY_V2_APIKEY"]
16
18
  )
17
19
  @service = IBMWatson::DiscoveryV2.new(
18
20
  authenticator: authenticator,
@@ -31,11 +33,10 @@ if !ENV["DISCOVERY_V2_TOKEN"].nil?
31
33
  )
32
34
  end
33
35
 
34
- def test_collections
36
+ def test_list_collections
35
37
  service_response = service.list_collections(
36
38
  project_id: @project_id
37
39
  )
38
- puts service_response.result
39
40
  refute(service_response.result["collections"].nil?)
40
41
  end
41
42
 
@@ -134,6 +135,131 @@ if !ENV["DISCOVERY_V2_TOKEN"].nil?
134
135
  )
135
136
  refute(service_response.nil?)
136
137
  end
138
+
139
+ def test_create_get_update_delete_collection
140
+ service_response = service.create_collection(
141
+ project_id: @project_id,
142
+ name: "ruby_collection"
143
+ )
144
+ create_collection_id = service_response.result["collection_id"]
145
+ assert((200..299).cover?(service_response.status))
146
+
147
+ service_response = service.get_collection(
148
+ project_id: @project_id,
149
+ collection_id: create_collection_id
150
+ )
151
+ assert((200..299).cover?(service_response.status))
152
+
153
+ service_response = service.update_collection(
154
+ project_id: @project_id,
155
+ collection_id: create_collection_id
156
+ )
157
+ assert((200..299).cover?(service_response.status))
158
+
159
+ service_response = service.delete_collection(
160
+ project_id: @project_id,
161
+ collection_id: create_collection_id
162
+ )
163
+ assert(service_response.nil?)
164
+ end
165
+
166
+ def test_create_list_get_update_delete_project
167
+ service_response = service.create_project(
168
+ name: "ruby_project",
169
+ type: "document_retrieval"
170
+ )
171
+ create_project_id = service_response.result["project_id"]
172
+ assert((200..299).cover?(service_response.status))
173
+
174
+ service_response = service.list_projects
175
+ assert((200..299).cover?(service_response.status))
176
+
177
+ service_response = service.get_project(
178
+ project_id: create_project_id
179
+ )
180
+ assert((200..299).cover?(service_response.status))
181
+
182
+ service_response = service.update_project(
183
+ project_id: create_project_id
184
+ )
185
+ assert((200..299).cover?(service_response.status))
186
+
187
+ service_response = service.delete_project(
188
+ project_id: create_project_id
189
+ )
190
+ assert(service_response.nil?)
191
+ end
192
+
193
+ def test_create_list_get_update_delete_enrichment
194
+ enrichment_metadata = {
195
+ name: "RUBY enrichment",
196
+ description: "test dictionary",
197
+ type: "dictionary",
198
+ options: {
199
+ languages: ["en"],
200
+ entity_type: "keyword"
201
+ }
202
+ }
203
+
204
+ em_json = JSON[enrichment_metadata]
205
+ # {"name":"Dictionary","description":"test dictionary","type":"dictionary","options":{"languages":["en"],"entity_type":"keyword"}}
206
+ enrichment_data = File.open(Dir.getwd + "/resources/test_enrichments.csv")
207
+
208
+ service_response = service.create_enrichment(
209
+ project_id: @project_id,
210
+ file: enrichment_data,
211
+ enrichment: em_json
212
+ )
213
+ assert((200..299).cover?(service_response.status))
214
+ create_enrichment_id = service_response.result["enrichment_id"]
215
+
216
+ service_response = service.list_enrichments(
217
+ project_id: @project_id
218
+ )
219
+ assert((200..299).cover?(service_response.status))
220
+
221
+ service_response = service.get_enrichment(
222
+ project_id: @project_id,
223
+ enrichment_id: create_enrichment_id
224
+ )
225
+ assert((200..299).cover?(service_response.status))
226
+
227
+ service_response = service.update_enrichment(
228
+ project_id: @project_id,
229
+ enrichment_id: create_enrichment_id,
230
+ name: "New RUBY Name"
231
+ )
232
+ assert((200..299).cover?(service_response.status))
233
+
234
+ service_response = service.delete_enrichment(
235
+ project_id: @project_id,
236
+ enrichment_id: create_enrichment_id
237
+ )
238
+ assert(service_response.nil?)
239
+ end
240
+
241
+ def test_delete_user_data
242
+ skip "Covered with the unit test. No need to run it here"
243
+
244
+ service_response = service.delete_user_data(
245
+ customer_id: "000010000"
246
+ )
247
+ assert(service_response.nil?)
248
+ end
249
+
250
+ def test_analyze_document
251
+ skip "CPD only. Do not run on premium"
252
+ analyze_data = File.open(Dir.getwd + "/resources/problem.json")
253
+
254
+ service_response = service.analyze_document(
255
+ project_id: @project_id,
256
+ collection_id: @collection_id,
257
+ file: analyze_data,
258
+ file_content_type: "application/json"
259
+ )
260
+ assert((200..299).cover?(service_response.status))
261
+ refute(service_response.nil?)
262
+ end
137
263
  end
138
264
  else
139
265
  class DiscoveryV2Test < Minitest::Test
@@ -103,6 +103,11 @@ if !ENV["LANGUAGE_TRANSLATOR_APIKEY"].nil? && !ENV["LANGUAGE_TRANSLATOR_URL"].ni
103
103
  ).result
104
104
  assert_equal("OK", service_response["status"])
105
105
  end
106
+
107
+ def test_list_languages
108
+ service_response = service.list_languages.result
109
+ refute(service_response.nil?)
110
+ end
106
111
  end
107
112
  else
108
113
  class LanguageTranslatorV3Test < Minitest::Test
@@ -48,13 +48,13 @@ if !ENV["TEXT_TO_SPEECH_APIKEY"].nil? && !ENV["TEXT_TO_SPEECH_URL"].nil?
48
48
  end
49
49
 
50
50
  def test_customizations
51
- service_response = @service.list_voice_models
51
+ service_response = @service.list_custom_models
52
52
  refute(service_response.nil?)
53
53
  end
54
54
 
55
55
  def test_custom_words
56
56
  skip "Skip to allow for concurrent travis jobs"
57
- customization_id = @service.create_voice_model(
57
+ customization_id = @service.create_custom_model(
58
58
  name: "test_integration_customization",
59
59
  description: "customization for tests"
60
60
  ).result["customization_id"]
@@ -79,7 +79,7 @@ if !ENV["TEXT_TO_SPEECH_APIKEY"].nil? && !ENV["TEXT_TO_SPEECH_URL"].nil?
79
79
  word: "MACLs"
80
80
  ).result
81
81
  assert(word["translation"] == "mackles")
82
- @service.delete_voice_model(
82
+ @service.delete_custom_model(
83
83
  customization_id: customization_id
84
84
  )
85
85
  end
@@ -8,7 +8,7 @@ SimpleCov.command_name "test:unit"
8
8
 
9
9
  WebMock.disable_net_connect!(allow_localhost: true)
10
10
 
11
- # Unit tests for the Watson Assistant V1 Service
11
+ # Unit tests for the Watson Assistant V1 Services
12
12
  class AssistantV1Test < Minitest::Test
13
13
  include Minitest::Hooks
14
14
  attr_accessor :service
@@ -29,13 +29,13 @@ class AssistantV1Test < Minitest::Test
29
29
  headers = {
30
30
  "Content-Type" => "application/json"
31
31
  }
32
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
32
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
33
33
  .with(
34
34
  body: "{\"text\":\"I want financial advice today.\"}",
35
35
  headers: {
36
36
  "Accept" => "application/json",
37
37
  "Content-Type" => "application/json",
38
- "Host" => "gateway.watsonplatform.net"
38
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
39
39
  }
40
40
  ).to_return(status: 201, body: response.to_json, headers: headers)
41
41
  service_response = service.create_counterexample(
@@ -54,13 +54,13 @@ class AssistantV1Test < Minitest::Test
54
54
  headers = {
55
55
  "Content-Type" => "application/json"
56
56
  }
57
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
57
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
58
58
  .with(
59
59
  body: "{\"text\":\"I want financial advice today.\"}",
60
60
  headers: {
61
61
  "Accept" => "application/json",
62
62
  "Content-Type" => "application/json",
63
- "Host" => "gateway.watsonplatform.net"
63
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
64
64
  }
65
65
  ).to_return(status: 201, body: response.to_json, headers: headers)
66
66
  service_response = service.create_counterexample(
@@ -80,13 +80,13 @@ class AssistantV1Test < Minitest::Test
80
80
  "code" => error_code,
81
81
  "error" => error_msg
82
82
  }
83
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
83
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
84
84
  .with(
85
85
  body: "{\"text\":\"I want financial advice today.\"}",
86
86
  headers: {
87
87
  "Accept" => "application/json",
88
88
  "Content-Type" => "application/json",
89
- "Host" => "gateway.watsonplatform.net"
89
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
90
90
  }
91
91
  ).to_return(status: 429, body: error_response.to_json, headers: headers)
92
92
  begin
@@ -111,13 +111,13 @@ class AssistantV1Test < Minitest::Test
111
111
  "error" => error_msg,
112
112
  "code" => error_code
113
113
  }
114
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
114
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
115
115
  .with(
116
116
  body: "{\"text\":\"I want financial advice today.\"}",
117
117
  headers: {
118
118
  "Accept" => "application/json",
119
119
  "Content-Type" => "application/json",
120
- "Host" => "gateway.watsonplatform.net"
120
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
121
121
  }
122
122
  ).to_return(status: 407, body: error_response.to_json, headers: headers)
123
123
  begin
@@ -135,11 +135,11 @@ class AssistantV1Test < Minitest::Test
135
135
  headers = {
136
136
  "Content-Type" => "application/json"
137
137
  }
138
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples/I%20want%20financial%20advice%20today?version=2018-02-16")
138
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples/I%20want%20financial%20advice%20today?version=2018-02-16")
139
139
  .with(
140
140
  headers: {
141
141
  "Accept" => "application/json",
142
- "Host" => "gateway.watsonplatform.net"
142
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
143
143
  }
144
144
  ).to_return(status: 200, body: {}.to_json, headers: headers)
145
145
  service_response = service.delete_counterexample(
@@ -158,11 +158,11 @@ class AssistantV1Test < Minitest::Test
158
158
  headers = {
159
159
  "Content-Type" => "application/json"
160
160
  }
161
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples/What%20are%20you%20wearing%3F?version=2018-02-16")
161
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples/What%20are%20you%20wearing%3F?version=2018-02-16")
162
162
  .with(
163
163
  headers: {
164
164
  "Accept" => "application/json",
165
- "Host" => "gateway.watsonplatform.net"
165
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
166
166
  }
167
167
  ).to_return(status: 200, body: response.to_json, headers: headers)
168
168
  service_response = service.get_counterexample(
@@ -193,11 +193,11 @@ class AssistantV1Test < Minitest::Test
193
193
  headers = {
194
194
  "Content-Type" => "application/json"
195
195
  }
196
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
196
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples?version=2018-02-16")
197
197
  .with(
198
198
  headers: {
199
199
  "Accept" => "application/json",
200
- "Host" => "gateway.watsonplatform.net"
200
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
201
201
  }
202
202
  ).to_return(status: 200, body: response.to_json, headers: headers)
203
203
  service_response = service.list_counterexamples(
@@ -215,13 +215,13 @@ class AssistantV1Test < Minitest::Test
215
215
  headers = {
216
216
  "Content-Type" => "application/json"
217
217
  }
218
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/counterexamples/What%20are%20you%20wearing%3F?version=2018-02-16")
218
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/counterexamples/What%20are%20you%20wearing%3F?version=2018-02-16")
219
219
  .with(
220
220
  body: "{\"text\":\"What are you wearing?\"}",
221
221
  headers: {
222
222
  "Accept" => "application/json",
223
223
  "Content-Type" => "application/json",
224
- "Host" => "gateway.watsonplatform.net"
224
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
225
225
  }
226
226
  ).to_return(status: 200, body: response.to_json, headers: headers)
227
227
  service_response = service.update_counterexample(
@@ -245,13 +245,13 @@ class AssistantV1Test < Minitest::Test
245
245
  headers = {
246
246
  "Content-Type" => "application/json"
247
247
  }
248
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities?version=2018-02-16")
248
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities?version=2018-02-16")
249
249
  .with(
250
250
  body: "{\"entity\":\"pizza_toppings\",\"description\":\"Tasty pizza toppings\",\"metadata\":{\"property\":\"value\"}}",
251
251
  headers: {
252
252
  "Accept" => "application/json",
253
253
  "Content-Type" => "application/json",
254
- "Host" => "gateway.watsonplatform.net"
254
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
255
255
  }
256
256
  ).to_return(status: 200, body: response.to_json, headers: headers)
257
257
  service_response = service.create_entity(
@@ -269,11 +269,11 @@ class AssistantV1Test < Minitest::Test
269
269
  headers = {
270
270
  "Content-Type" => "application/json"
271
271
  }
272
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/pizza_toppings?version=2018-02-16")
272
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/pizza_toppings?version=2018-02-16")
273
273
  .with(
274
274
  headers: {
275
275
  "Accept" => "application/json",
276
- "Host" => "gateway.watsonplatform.net"
276
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
277
277
  }
278
278
  ).to_return(status: 200, body: "{}", headers: headers)
279
279
  service_response = service.delete_entity(
@@ -296,11 +296,11 @@ class AssistantV1Test < Minitest::Test
296
296
  headers = {
297
297
  "Content-Type" => "application/json"
298
298
  }
299
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/pizza_toppings?export=true&version=2018-02-16")
299
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/pizza_toppings?export=true&version=2018-02-16")
300
300
  .with(
301
301
  headers: {
302
302
  "Accept" => "application/json",
303
- "Host" => "gateway.watsonplatform.net"
303
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
304
304
  }
305
305
  ).to_return(status: 200, body: response.to_json, headers: headers)
306
306
  service_response = service.get_entity(
@@ -334,11 +334,11 @@ class AssistantV1Test < Minitest::Test
334
334
  headers = {
335
335
  "Content-Type" => "application/json"
336
336
  }
337
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities?export=true&version=2018-02-16")
337
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities?export=true&version=2018-02-16")
338
338
  .with(
339
339
  headers: {
340
340
  "Accept" => "application/json",
341
- "Host" => "gateway.watsonplatform.net"
341
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
342
342
  }
343
343
  ).to_return(status: 200, body: response.to_json, headers: headers)
344
344
  service_response = service.list_entities(
@@ -361,13 +361,13 @@ class AssistantV1Test < Minitest::Test
361
361
  headers = {
362
362
  "Content-Type" => "application/json"
363
363
  }
364
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/pizza_toppings?version=2018-02-16")
364
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/pizza_toppings?version=2018-02-16")
365
365
  .with(
366
366
  body: "{\"entity\":\"pizza_toppings\"}",
367
367
  headers: {
368
368
  "Accept" => "application/json",
369
369
  "Content-Type" => "application/json",
370
- "Host" => "gateway.watsonplatform.net"
370
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
371
371
  }
372
372
  ).to_return(status: 200, body: response.to_json, headers: headers)
373
373
  service_response = service.update_entity(
@@ -387,13 +387,13 @@ class AssistantV1Test < Minitest::Test
387
387
  headers = {
388
388
  "Content-Type" => "application/json"
389
389
  }
390
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order/examples?version=2018-02-16")
390
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order/examples?version=2018-02-16")
391
391
  .with(
392
392
  body: "{\"text\":\"Gimme a pizza with pepperoni\",\"mentions\":[{\"mentioned\":\"yes\"}]}",
393
393
  headers: {
394
394
  "Accept" => "application/json",
395
395
  "Content-Type" => "application/json",
396
- "Host" => "gateway.watsonplatform.net"
396
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
397
397
  }
398
398
  ).to_return(status: 201, body: response.to_json, headers: headers)
399
399
  service_response = service.create_example(
@@ -409,11 +409,11 @@ class AssistantV1Test < Minitest::Test
409
409
  headers = {
410
410
  "Content-Type" => "application/json"
411
411
  }
412
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order/examples/Gimme%20a%20pizza%20with%20pepperoni?version=2018-02-16")
412
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order/examples/Gimme%20a%20pizza%20with%20pepperoni?version=2018-02-16")
413
413
  .with(
414
414
  headers: {
415
415
  "Accept" => "application/json",
416
- "Host" => "gateway.watsonplatform.net"
416
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
417
417
  }
418
418
  ).to_return(status: 200, body: "{}", headers: headers)
419
419
  service_response = service.delete_example(
@@ -433,11 +433,11 @@ class AssistantV1Test < Minitest::Test
433
433
  headers = {
434
434
  "Content-Type" => "application/json"
435
435
  }
436
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order/examples/Gimme%20a%20pizza%20with%20pepperoni?version=2018-02-16")
436
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order/examples/Gimme%20a%20pizza%20with%20pepperoni?version=2018-02-16")
437
437
  .with(
438
438
  headers: {
439
439
  "Accept" => "application/json",
440
- "Host" => "gateway.watsonplatform.net"
440
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
441
441
  }
442
442
  ).to_return(status: 200, body: response.to_json, headers: headers)
443
443
  service_response = service.get_example(
@@ -469,11 +469,11 @@ class AssistantV1Test < Minitest::Test
469
469
  headers = {
470
470
  "Content-Type" => "application/json"
471
471
  }
472
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order/examples?version=2018-02-16")
472
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order/examples?version=2018-02-16")
473
473
  .with(
474
474
  headers: {
475
475
  "Accept" => "application/json",
476
- "Host" => "gateway.watsonplatform.net"
476
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
477
477
  }
478
478
  ).to_return(status: 200, body: response.to_json, headers: headers)
479
479
  service_response = service.list_examples(
@@ -492,13 +492,13 @@ class AssistantV1Test < Minitest::Test
492
492
  headers = {
493
493
  "Content-Type" => "application/json"
494
494
  }
495
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order/examples/Gimme%20a%20pizza%20with%20pepperoni?version=2018-02-16")
495
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order/examples/Gimme%20a%20pizza%20with%20pepperoni?version=2018-02-16")
496
496
  .with(
497
497
  body: "{\"text\":\"Gimme a pizza with pepperoni\",\"mentions\":[{\"mentioned\":\"yes\"}]}",
498
498
  headers: {
499
499
  "Accept" => "application/json",
500
500
  "Content-Type" => "application/json",
501
- "Host" => "gateway.watsonplatform.net"
501
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
502
502
  }
503
503
  ).to_return(status: 200, body: response.to_json, headers: headers)
504
504
  service_response = service.update_example(
@@ -521,13 +521,13 @@ class AssistantV1Test < Minitest::Test
521
521
  headers = {
522
522
  "Content-Type" => "application/json"
523
523
  }
524
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents?version=2018-02-16")
524
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents?version=2018-02-16")
525
525
  .with(
526
526
  body: "{\"intent\":\"pizza_order\",\"description\":\"User wants to start a new pizza order\"}",
527
527
  headers: {
528
528
  "Accept" => "application/json",
529
529
  "Content-Type" => "application/json",
530
- "Host" => "gateway.watsonplatform.net"
530
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
531
531
  }
532
532
  ).to_return(status: 201, body: response.to_json, headers: headers)
533
533
  service_response = service.create_intent(
@@ -542,11 +542,11 @@ class AssistantV1Test < Minitest::Test
542
542
  headers = {
543
543
  "Content-Type" => "application/json"
544
544
  }
545
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order?version=2018-02-16")
545
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order?version=2018-02-16")
546
546
  .with(
547
547
  headers: {
548
548
  "Accept" => "application/json",
549
- "Host" => "gateway.watsonplatform.net"
549
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
550
550
  }
551
551
  ).to_return(status: 200, body: "{}", headers: headers)
552
552
  service_response = service.delete_intent(
@@ -566,11 +566,11 @@ class AssistantV1Test < Minitest::Test
566
566
  headers = {
567
567
  "Content-Type" => "application/json"
568
568
  }
569
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order?export=false&version=2018-02-16")
569
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order?export=false&version=2018-02-16")
570
570
  .with(
571
571
  headers: {
572
572
  "Accept" => "application/json",
573
- "Host" => "gateway.watsonplatform.net"
573
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
574
574
  }
575
575
  ).to_return(status: 200, body: response.to_json, headers: headers)
576
576
  service_response = service.get_intent(
@@ -599,11 +599,11 @@ class AssistantV1Test < Minitest::Test
599
599
  headers = {
600
600
  "Content-Type" => "application/json"
601
601
  }
602
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents?export=false&version=2018-02-16")
602
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents?export=false&version=2018-02-16")
603
603
  .with(
604
604
  headers: {
605
605
  "Accept" => "application/json",
606
- "Host" => "gateway.watsonplatform.net"
606
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
607
607
  }
608
608
  ).to_return(status: 200, body: response.to_json, headers: headers)
609
609
  service_response = service.list_intents(
@@ -623,13 +623,13 @@ class AssistantV1Test < Minitest::Test
623
623
  headers = {
624
624
  "Content-Type" => "application/json"
625
625
  }
626
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/intents/pizza_order?version=2018-02-16")
626
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/intents/pizza_order?version=2018-02-16")
627
627
  .with(
628
628
  body: "{\"intent\":\"pizza_order\",\"description\":\"User wants to start a new pizza order\"}",
629
629
  headers: {
630
630
  "Accept" => "application/json",
631
631
  "Content-Type" => "application/json",
632
- "Host" => "gateway.watsonplatform.net"
632
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
633
633
  }
634
634
  ).to_return(status: 200, body: response.to_json, headers: headers)
635
635
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -704,11 +704,11 @@ class AssistantV1Test < Minitest::Test
704
704
  headers = {
705
705
  "Content-Type" => "application/json"
706
706
  }
707
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/logs?version=2018-02-16")
707
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/logs?version=2018-02-16")
708
708
  .with(
709
709
  headers: {
710
710
  "Accept" => "application/json",
711
- "Host" => "gateway.watsonplatform.net"
711
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
712
712
  }
713
713
  ).to_return(status: 200, body: response.to_json, headers: headers)
714
714
  service_response = service.list_logs(
@@ -780,11 +780,11 @@ class AssistantV1Test < Minitest::Test
780
780
  headers = {
781
781
  "Content-Type" => "application/json"
782
782
  }
783
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/logs?filter=language::en,request.context.metadata.deployment::deployment_1&version=2018-02-16")
783
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/logs?filter=language::en,request.context.metadata.deployment::deployment_1&version=2018-02-16")
784
784
  .with(
785
785
  headers: {
786
786
  "Accept" => "application/json",
787
- "Host" => "gateway.watsonplatform.net"
787
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
788
788
  }
789
789
  ).to_return(status: 200, body: response.to_json, headers: headers)
790
790
  service_response = service.list_all_logs(
@@ -816,13 +816,13 @@ class AssistantV1Test < Minitest::Test
816
816
  headers = {
817
817
  "Content-Type" => "application/json"
818
818
  }
819
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/message?version=2018-02-16")
819
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/message?version=2018-02-16")
820
820
  .with(
821
821
  body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
822
822
  headers: {
823
823
  "Accept" => "application/json",
824
824
  "Content-Type" => "application/json",
825
- "Host" => "gateway.watsonplatform.net"
825
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
826
826
  }
827
827
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
828
828
  service_response = service.message(
@@ -842,13 +842,13 @@ class AssistantV1Test < Minitest::Test
842
842
  }
843
843
  }
844
844
  }
845
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/message?version=2018-02-16")
845
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/message?version=2018-02-16")
846
846
  .with(
847
847
  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}}\"}",
848
848
  headers: {
849
849
  "Accept" => "application/json",
850
850
  "Content-Type" => "application/json",
851
- "Host" => "gateway.watsonplatform.net"
851
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
852
852
  }
853
853
  ).to_return(status: 200, body: message_response.to_json, headers: headers)
854
854
  service_response = service.message(
@@ -868,13 +868,13 @@ class AssistantV1Test < Minitest::Test
868
868
  headers = {
869
869
  "Content-Type" => "application/json"
870
870
  }
871
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/aeiou/values/vowel/synonyms?version=2018-02-16")
871
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/aeiou/values/vowel/synonyms?version=2018-02-16")
872
872
  .with(
873
873
  body: "{\"synonym\":\"a\"}",
874
874
  headers: {
875
875
  "Accept" => "application/json",
876
876
  "Content-Type" => "application/json",
877
- "Host" => "gateway.watsonplatform.net"
877
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
878
878
  }
879
879
  ).to_return(status: 201, body: response.to_json, headers: headers)
880
880
  service_response = service.create_synonym(
@@ -890,11 +890,11 @@ class AssistantV1Test < Minitest::Test
890
890
  headers = {
891
891
  "Content-Type" => "application/json"
892
892
  }
893
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/aeiou/values/vowel/synonyms/a?version=2018-02-16")
893
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/aeiou/values/vowel/synonyms/a?version=2018-02-16")
894
894
  .with(
895
895
  headers: {
896
896
  "Accept" => "application/json",
897
- "Host" => "gateway.watsonplatform.net"
897
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
898
898
  }
899
899
  ).to_return(status: 200, body: "", headers: headers)
900
900
  service_response = service.delete_synonym(
@@ -915,11 +915,11 @@ class AssistantV1Test < Minitest::Test
915
915
  headers = {
916
916
  "Content-Type" => "application/json"
917
917
  }
918
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values/bbq/synonyms/barbecue?version=2018-02-16")
918
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values/bbq/synonyms/barbecue?version=2018-02-16")
919
919
  .with(
920
920
  headers: {
921
921
  "Accept" => "application/json",
922
- "Host" => "gateway.watsonplatform.net"
922
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
923
923
  }
924
924
  ).to_return(status: 200, body: response.to_json, headers: headers)
925
925
  service_response = service.get_synonym(
@@ -955,11 +955,11 @@ class AssistantV1Test < Minitest::Test
955
955
  headers = {
956
956
  "Content-Type" => "application/json"
957
957
  }
958
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values/bbq/synonyms?version=2018-02-16")
958
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values/bbq/synonyms?version=2018-02-16")
959
959
  .with(
960
960
  headers: {
961
961
  "Accept" => "application/json",
962
- "Host" => "gateway.watsonplatform.net"
962
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
963
963
  }
964
964
  ).to_return(status: 200, body: response.to_json, headers: headers)
965
965
  service_response = service.list_synonyms(
@@ -979,13 +979,13 @@ class AssistantV1Test < Minitest::Test
979
979
  headers = {
980
980
  "Content-Type" => "application/json"
981
981
  }
982
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values/bbq/synonyms/barbecue?version=2018-02-16")
982
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values/bbq/synonyms/barbecue?version=2018-02-16")
983
983
  .with(
984
984
  body: "{\"synonym\":\"barbecue\"}",
985
985
  headers: {
986
986
  "Accept" => "application/json",
987
987
  "Content-Type" => "application/json",
988
- "Host" => "gateway.watsonplatform.net"
988
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
989
989
  }
990
990
  ).to_return(status: 200, body: response.to_json, headers: headers)
991
991
  service_response = service.update_synonym(
@@ -1009,13 +1009,13 @@ class AssistantV1Test < Minitest::Test
1009
1009
  headers = {
1010
1010
  "Content-Type" => "application/json"
1011
1011
  }
1012
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values?version=2018-02-16")
1012
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values?version=2018-02-16")
1013
1013
  .with(
1014
1014
  body: "{\"value\":\"aeiou\"}",
1015
1015
  headers: {
1016
1016
  "Accept" => "application/json",
1017
1017
  "Content-Type" => "application/json",
1018
- "Host" => "gateway.watsonplatform.net"
1018
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1019
1019
  }
1020
1020
  ).to_return(status: 201, body: response.to_json, headers: headers)
1021
1021
  service_response = service.create_value(
@@ -1030,11 +1030,11 @@ class AssistantV1Test < Minitest::Test
1030
1030
  headers = {
1031
1031
  "Content-Type" => "application/json"
1032
1032
  }
1033
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values/bbq?version=2018-02-16")
1033
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values/bbq?version=2018-02-16")
1034
1034
  .with(
1035
1035
  headers: {
1036
1036
  "Accept" => "application/json",
1037
- "Host" => "gateway.watsonplatform.net"
1037
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1038
1038
  }
1039
1039
  ).to_return(status: 200, body: "", headers: headers)
1040
1040
  service_response = service.delete_value(
@@ -1058,11 +1058,11 @@ class AssistantV1Test < Minitest::Test
1058
1058
  headers = {
1059
1059
  "Content-Type" => "application/json"
1060
1060
  }
1061
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values/bbq?export=true&version=2018-02-16")
1061
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values/bbq?export=true&version=2018-02-16")
1062
1062
  .with(
1063
1063
  headers: {
1064
1064
  "Accept" => "application/json",
1065
- "Host" => "gateway.watsonplatform.net"
1065
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1066
1066
  }
1067
1067
  ).to_return(status: 200, body: response.to_json, headers: headers)
1068
1068
  service_response = service.get_value(
@@ -1097,11 +1097,11 @@ class AssistantV1Test < Minitest::Test
1097
1097
  headers = {
1098
1098
  "Content-Type" => "application/json"
1099
1099
  }
1100
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values?export=true&version=2018-02-16")
1100
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values?export=true&version=2018-02-16")
1101
1101
  .with(
1102
1102
  headers: {
1103
1103
  "Accept" => "application/json",
1104
- "Host" => "gateway.watsonplatform.net"
1104
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1105
1105
  }
1106
1106
  ).to_return(status: 200, body: response.to_json, headers: headers)
1107
1107
  service_response = service.list_values(
@@ -1125,13 +1125,13 @@ class AssistantV1Test < Minitest::Test
1125
1125
  headers = {
1126
1126
  "Content-Type" => "application/json"
1127
1127
  }
1128
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid/entities/grilling/values/bbq?version=2018-02-16")
1128
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid/entities/grilling/values/bbq?version=2018-02-16")
1129
1129
  .with(
1130
1130
  body: "{\"value\":\"BBQ sauce\",\"metadata\":{\"code\":1422}}",
1131
1131
  headers: {
1132
1132
  "Accept" => "application/json",
1133
1133
  "Content-Type" => "application/json",
1134
- "Host" => "gateway.watsonplatform.net"
1134
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1135
1135
  }
1136
1136
  ).to_return(status: 200, body: response.to_json, headers: headers)
1137
1137
  service_response = service.update_value(
@@ -1158,13 +1158,13 @@ class AssistantV1Test < Minitest::Test
1158
1158
  headers = {
1159
1159
  "Content-Type" => "application/json"
1160
1160
  }
1161
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces?version=2018-02-16")
1161
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces?version=2018-02-16")
1162
1162
  .with(
1163
1163
  body: "{\"name\":\"Pizza app\",\"description\":\"Pizza app\",\"language\":\"en\",\"metadata\":{},\"system_settings\":{\"system_settings\":\"yes\"},\"webhooks\":[]}",
1164
1164
  headers: {
1165
1165
  "Accept" => "application/json",
1166
1166
  "Content-Type" => "application/json",
1167
- "Host" => "gateway.watsonplatform.net"
1167
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1168
1168
  }
1169
1169
  ).to_return(status: 201, body: response.to_json, headers: headers)
1170
1170
  service_response = service.create_workspace(
@@ -1182,11 +1182,11 @@ class AssistantV1Test < Minitest::Test
1182
1182
  headers = {
1183
1183
  "Content-Type" => "application/json"
1184
1184
  }
1185
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid?version=2018-02-16")
1185
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid?version=2018-02-16")
1186
1186
  .with(
1187
1187
  headers: {
1188
1188
  "Accept" => "application/json",
1189
- "Host" => "gateway.watsonplatform.net"
1189
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1190
1190
  }
1191
1191
  ).to_return(status: 200, body: "", headers: headers)
1192
1192
  service_response = service.delete_workspace(
@@ -1210,11 +1210,11 @@ class AssistantV1Test < Minitest::Test
1210
1210
  headers = {
1211
1211
  "Content-Type" => "application/json"
1212
1212
  }
1213
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/boguswid?export=false&version=2018-02-16")
1213
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/boguswid?export=false&version=2018-02-16")
1214
1214
  .with(
1215
1215
  headers: {
1216
1216
  "Accept" => "application/json",
1217
- "Host" => "gateway.watsonplatform.net"
1217
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1218
1218
  }
1219
1219
  ).to_return(status: 200, body: response.to_json, headers: headers)
1220
1220
  service_response = service.get_workspace(
@@ -1245,11 +1245,11 @@ class AssistantV1Test < Minitest::Test
1245
1245
  headers = {
1246
1246
  "Content-Type" => "application/json"
1247
1247
  }
1248
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces?version=2018-02-16")
1248
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces?version=2018-02-16")
1249
1249
  .with(
1250
1250
  headers: {
1251
1251
  "Accept" => "application/json",
1252
- "Host" => "gateway.watsonplatform.net"
1252
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1253
1253
  }
1254
1254
  ).to_return(status: 200, body: response.to_json, headers: headers)
1255
1255
  service_response = service.list_workspaces
@@ -1269,13 +1269,13 @@ class AssistantV1Test < Minitest::Test
1269
1269
  headers = {
1270
1270
  "Content-Type" => "application/json"
1271
1271
  }
1272
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/pizza_app-e0f3?version=2018-02-16")
1272
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/pizza_app-e0f3?version=2018-02-16")
1273
1273
  .with(
1274
1274
  body: "{\"name\":\"Pizza app\",\"description\":\"Pizza app\",\"language\":\"en\",\"metadata\":{},\"system_settings\":{\"system_settings\":\"yes\"}}",
1275
1275
  headers: {
1276
1276
  "Accept" => "application/json",
1277
1277
  "Content-Type" => "application/json",
1278
- "Host" => "gateway.watsonplatform.net"
1278
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1279
1279
  }
1280
1280
  ).to_return(status: 200, body: response.to_json, headers: headers)
1281
1281
  service_response = service.update_workspace(
@@ -1294,13 +1294,13 @@ class AssistantV1Test < Minitest::Test
1294
1294
  "Content-Type" => "application/json"
1295
1295
  }
1296
1296
 
1297
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/id/dialog_nodes?version=2018-02-16")
1297
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/id/dialog_nodes?version=2018-02-16")
1298
1298
  .with(
1299
1299
  body: "{\"dialog_node\":\"location-done\",\"user_label\":\"labeled\"}",
1300
1300
  headers: {
1301
1301
  "Accept" => "application/json",
1302
1302
  "Content-Type" => "application/json",
1303
- "Host" => "gateway.watsonplatform.net"
1303
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1304
1304
  }
1305
1305
  ).to_return(status: 200, body: { "application/json" => { "dialog_node" => "location-done" } }.to_json, headers: headers)
1306
1306
  service_response = service.create_dialog_node(
@@ -1310,11 +1310,11 @@ class AssistantV1Test < Minitest::Test
1310
1310
  )
1311
1311
  assert_equal("location-done", service_response.result["application/json"]["dialog_node"])
1312
1312
 
1313
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/id/dialog_nodes/location-done?version=2018-02-16")
1313
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/id/dialog_nodes/location-done?version=2018-02-16")
1314
1314
  .with(
1315
1315
  headers: {
1316
1316
  "Accept" => "application/json",
1317
- "Host" => "gateway.watsonplatform.net"
1317
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1318
1318
  }
1319
1319
  ).to_return(status: 200, body: { "description" => "deleted successfully" }.to_json, headers: headers)
1320
1320
  service_response = service.delete_dialog_node(
@@ -1323,11 +1323,11 @@ class AssistantV1Test < Minitest::Test
1323
1323
  )
1324
1324
  assert(service_response.nil?)
1325
1325
 
1326
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/id/dialog_nodes/location-done?version=2018-02-16")
1326
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/id/dialog_nodes/location-done?version=2018-02-16")
1327
1327
  .with(
1328
1328
  headers: {
1329
1329
  "Accept" => "application/json",
1330
- "Host" => "gateway.watsonplatform.net"
1330
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1331
1331
  }
1332
1332
  ).to_return(status: 200, body: { "application/json" => { "dialog_node" => "location-atm" } }.to_json, headers: headers)
1333
1333
  service_response = service.get_dialog_node(
@@ -1336,11 +1336,11 @@ class AssistantV1Test < Minitest::Test
1336
1336
  )
1337
1337
  assert_equal({ "application/json" => { "dialog_node" => "location-atm" } }, service_response.result)
1338
1338
 
1339
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/id/dialog_nodes?version=2018-02-16")
1339
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/id/dialog_nodes?version=2018-02-16")
1340
1340
  .with(
1341
1341
  headers: {
1342
1342
  "Accept" => "application/json",
1343
- "Host" => "gateway.watsonplatform.net"
1343
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1344
1344
  }
1345
1345
  ).to_return(status: 200, body: { "application/json" => { "dialog_node" => "location-atm" } }.to_json, headers: headers)
1346
1346
  service_response = service.list_dialog_nodes(
@@ -1353,11 +1353,11 @@ class AssistantV1Test < Minitest::Test
1353
1353
  headers = {
1354
1354
  "Content-Type" => "application/json"
1355
1355
  }
1356
- stub_request(:delete, "https://gateway.watsonplatform.net/assistant/api/v1/user_data?customer_id=id&version=2018-02-16")
1356
+ stub_request(:delete, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/user_data?customer_id=id&version=2018-02-16")
1357
1357
  .with(
1358
1358
  headers: {
1359
1359
  "Accept" => "application/json",
1360
- "Host" => "gateway.watsonplatform.net"
1360
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1361
1361
  }
1362
1362
  ).to_return(status: 200, body: "", headers: headers)
1363
1363
  service_response = service.delete_user_data(
@@ -1367,13 +1367,13 @@ class AssistantV1Test < Minitest::Test
1367
1367
  end
1368
1368
 
1369
1369
  def test_update_dialog_node
1370
- stub_request(:post, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/workspace_id/dialog_nodes/dialog_node?version=2018-02-16")
1370
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/workspace_id/dialog_nodes/dialog_node?version=2018-02-16")
1371
1371
  .with(
1372
1372
  body: "{\"description\":\"A new description\",\"user_label\":\"new_label\"}",
1373
1373
  headers: {
1374
1374
  "Accept" => "application/json",
1375
1375
  "Content-Type" => "application/json",
1376
- "Host" => "gateway.watsonplatform.net"
1376
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1377
1377
  }
1378
1378
  ).to_return(status: 200, body: "Pseudo update dialog node response", headers: {})
1379
1379
  service_response = service.update_dialog_node(
@@ -1386,11 +1386,11 @@ class AssistantV1Test < Minitest::Test
1386
1386
  end
1387
1387
 
1388
1388
  def test_list_mentions
1389
- stub_request(:get, "https://gateway.watsonplatform.net/assistant/api/v1/workspaces/workspace_id/entities/entity/mentions?export=true&include_audit=true&version=2018-02-16")
1389
+ stub_request(:get, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/workspace_id/entities/entity/mentions?export=true&include_audit=true&version=2018-02-16")
1390
1390
  .with(
1391
1391
  headers: {
1392
1392
  "Accept" => "application/json",
1393
- "Host" => "gateway.watsonplatform.net"
1393
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1394
1394
  }
1395
1395
  ).to_return(status: 200, body: { "list_mentions_response" => "yes" }.to_json, headers: { "Content-Type" => "application/json" })
1396
1396
  service_response = service.list_mentions(
@@ -1401,4 +1401,55 @@ class AssistantV1Test < Minitest::Test
1401
1401
  )
1402
1402
  assert_equal({ "list_mentions_response" => "yes" }, service_response.result)
1403
1403
  end
1404
+
1405
+ def test_bulk_classify
1406
+ workspace_id = "f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec"
1407
+ message_response = {
1408
+ "context" => {
1409
+ "conversation_id" => "1b7b67c0-90ed-45dc-8508-9488bc483d5b",
1410
+ "system" => {
1411
+ "dialog_stack" => ["root"],
1412
+ "dialog_turn_counter" => 1,
1413
+ "dialog_request_counter" => 1
1414
+ }
1415
+ },
1416
+ "intents" => [],
1417
+ "entities" => [],
1418
+ "input" => {},
1419
+ "output" => {
1420
+ "text" => "okay",
1421
+ "log_messages" => []
1422
+ }
1423
+ }
1424
+ headers = {
1425
+ "Content-Type" => "application/json"
1426
+ }
1427
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/bulk_classify?version=2018-02-16")
1428
+ .with(
1429
+ body: "{\"input\":{\"text\":\"Turn on the lights\"}}",
1430
+ headers: {
1431
+ "Accept" => "application/json",
1432
+ "Content-Type" => "application/json",
1433
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1434
+ }
1435
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
1436
+ service_response = service.bulk_classify(
1437
+ workspace_id: workspace_id,
1438
+ input: { "text" => "Turn on the lights" }
1439
+ )
1440
+ assert_equal(message_response, service_response.result)
1441
+
1442
+ stub_request(:post, "https://api.us-south.assistant.watson.cloud.ibm.com/v1/workspaces/f8fdbc65-e0bd-4e43-b9f8-2975a366d4ec/bulk_classify?version=2018-02-16")
1443
+ .with(
1444
+ headers: {
1445
+ "Accept" => "application/json",
1446
+ "Content-Type" => "application/json",
1447
+ "Host" => "api.us-south.assistant.watson.cloud.ibm.com"
1448
+ }
1449
+ ).to_return(status: 200, body: message_response.to_json, headers: headers)
1450
+ service_response = service.bulk_classify(
1451
+ workspace_id: workspace_id
1452
+ )
1453
+ assert_equal(message_response, service_response.result)
1454
+ end
1404
1455
  end