ibm_watson 1.4.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -6
  3. data/lib/ibm_watson/assistant_v1.rb +213 -195
  4. data/lib/ibm_watson/assistant_v2.rb +221 -20
  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 +734 -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 +65 -53
  13. data/lib/ibm_watson/text_to_speech_v1.rb +124 -140
  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 +103 -17
  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_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/integration/test_visual_recognition_v4.rb +9 -0
  24. data/test/unit/test_assistant_v1.rb +150 -99
  25. data/test/unit/test_assistant_v2.rb +153 -8
  26. data/test/unit/test_compare_comply_v1.rb +20 -20
  27. data/test/unit/test_discovery_v1.rb +125 -125
  28. data/test/unit/test_discovery_v2.rb +262 -29
  29. data/test/unit/test_language_translator_v3.rb +85 -24
  30. data/test/unit/test_natural_language_classifier_v1.rb +17 -17
  31. data/test/unit/test_natural_language_understanding_v1.rb +10 -10
  32. data/test/unit/test_personality_insights_v3.rb +14 -14
  33. data/test/unit/test_speech_to_text_v1.rb +97 -97
  34. data/test/unit/test_text_to_speech_v1.rb +48 -48
  35. data/test/unit/test_tone_analyzer_v3.rb +12 -12
  36. data/test/unit/test_visual_recognition_v3.rb +16 -16
  37. data/test/unit/test_visual_recognition_v4.rb +56 -38
  38. metadata +8 -7
@@ -12,22 +12,22 @@ class TextToSpeechV1Test < Minitest::Test
12
12
  voices_response = {
13
13
  "voices" => [
14
14
  {
15
- "url" => "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/VoiceEnUsLisa",
15
+ "url" => "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/VoiceEnUsLisa",
16
16
  "gender" => "female",
17
17
  "name" => "VoiceEnUsLisa",
18
18
  "language" => "en-US"
19
19
  }, {
20
- "url" => "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/VoiceEsEsEnrique",
20
+ "url" => "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/VoiceEsEsEnrique",
21
21
  "gender" => "male",
22
22
  "name" => "VoiceEsEsEnrique",
23
23
  "language" => "es-ES"
24
24
  }, {
25
- "url" => "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/VoiceEnUsMichael",
25
+ "url" => "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/VoiceEnUsMichael",
26
26
  "gender" => "male",
27
27
  "name" => "VoiceEnUsMichael",
28
28
  "language" => "en-US"
29
29
  }, {
30
- "url" => "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/VoiceEnUsAllison",
30
+ "url" => "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/VoiceEnUsAllison",
31
31
  "gender" => "female",
32
32
  "name" => "VoiceEnUsAllison",
33
33
  "language" => "en-US"
@@ -35,7 +35,7 @@ class TextToSpeechV1Test < Minitest::Test
35
35
  ]
36
36
  }
37
37
  voice_response = {
38
- "url" => "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-US_AllisonVoice",
38
+ "url" => "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/en-US_AllisonVoice",
39
39
  "name" => "en-US_AllisonVoice",
40
40
  "language" => "en-US",
41
41
  "customizable" => true,
@@ -47,12 +47,12 @@ class TextToSpeechV1Test < Minitest::Test
47
47
  }
48
48
  }
49
49
  synthesize_response_body = "<binary response>"
50
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/voices")
50
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices")
51
51
  .with(
52
52
  headers: {
53
53
  "Accept" => "application/json",
54
54
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
55
- "Host" => "stream.watsonplatform.net"
55
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
56
56
  }
57
57
  ).to_return(status: 200, body: voices_response.to_json, headers: { "Content-Type" => "application/json" })
58
58
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -67,12 +67,12 @@ class TextToSpeechV1Test < Minitest::Test
67
67
  service_response = service.list_voices
68
68
  assert_equal(voices_response, service_response.result)
69
69
 
70
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-us_AllisonVoice")
70
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/en-us_AllisonVoice")
71
71
  .with(
72
72
  headers: {
73
73
  "Accept" => "application/json",
74
74
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
75
- "Host" => "stream.watsonplatform.net"
75
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
76
76
  }
77
77
  ).to_return(status: 200, body: voice_response.to_json, headers: { "Content-Type" => "application/json" })
78
78
  service_response = service.get_voice(
@@ -80,13 +80,13 @@ class TextToSpeechV1Test < Minitest::Test
80
80
  )
81
81
  assert_equal(voice_response, service_response.result)
82
82
 
83
- stub_request(:post, "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize")
83
+ stub_request(:post, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/synthesize")
84
84
  .with(
85
85
  body: "{\"text\":\"hello\"}",
86
86
  headers: {
87
87
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
88
88
  "Content-Type" => "application/json",
89
- "Host" => "stream.watsonplatform.net"
89
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
90
90
  }
91
91
  ).to_return(status: 200, body: synthesize_response_body, headers: {})
92
92
  service_response = service.synthesize(
@@ -108,12 +108,12 @@ class TextToSpeechV1Test < Minitest::Test
108
108
  password: "password",
109
109
  authenticator: authenticator
110
110
  )
111
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/pronunciation?text=this%20is%20some%20text")
111
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/pronunciation?text=this%20is%20some%20text")
112
112
  .with(
113
113
  headers: {
114
114
  "Accept" => "application/json",
115
115
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
116
- "Host" => "stream.watsonplatform.net"
116
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
117
117
  }
118
118
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
119
119
  service_response = service.get_pronunciation(
@@ -121,12 +121,12 @@ class TextToSpeechV1Test < Minitest::Test
121
121
  )
122
122
  assert_equal(response, service_response.result)
123
123
 
124
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/pronunciation?text=yo&voice=VoiceEnUsLisa")
124
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/pronunciation?text=yo&voice=VoiceEnUsLisa")
125
125
  .with(
126
126
  headers: {
127
127
  "Accept" => "application/json",
128
128
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
129
- "Host" => "stream.watsonplatform.net"
129
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
130
130
  }
131
131
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
132
132
  service_response = service.get_pronunciation(
@@ -135,12 +135,12 @@ class TextToSpeechV1Test < Minitest::Test
135
135
  )
136
136
  assert_equal(response, service_response.result)
137
137
 
138
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/pronunciation?format=ipa&text=yo&voice=VoiceEnUsLisa")
138
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/pronunciation?format=ipa&text=yo&voice=VoiceEnUsLisa")
139
139
  .with(
140
140
  headers: {
141
141
  "Accept" => "application/json",
142
142
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
143
- "Host" => "stream.watsonplatform.net"
143
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
144
144
  }
145
145
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
146
146
  service_response = service.get_pronunciation(
@@ -151,7 +151,7 @@ class TextToSpeechV1Test < Minitest::Test
151
151
  assert_equal(response, service_response.result)
152
152
  end
153
153
 
154
- def test_custom_voice_models
154
+ def test_custom_custom_models
155
155
  response = { "customizations" => "yep" }
156
156
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
157
157
  username: "username",
@@ -162,84 +162,84 @@ class TextToSpeechV1Test < Minitest::Test
162
162
  password: "password",
163
163
  authenticator: authenticator
164
164
  )
165
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations")
165
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations")
166
166
  .with(
167
167
  headers: {
168
168
  "Accept" => "application/json",
169
169
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
170
- "Host" => "stream.watsonplatform.net"
170
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
171
171
  }
172
172
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
173
- service_response = service.list_voice_models
173
+ service_response = service.list_custom_models
174
174
  assert_equal(response, service_response.result)
175
175
 
176
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations?language=en-US")
176
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations?language=en-US")
177
177
  .with(
178
178
  headers: {
179
179
  "Accept" => "application/json",
180
180
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
181
- "Host" => "stream.watsonplatform.net"
181
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
182
182
  }
183
183
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
184
- service_response = service.list_voice_models(
184
+ service_response = service.list_custom_models(
185
185
  language: "en-US"
186
186
  )
187
187
  assert_equal(response, service_response.result)
188
188
 
189
- stub_request(:post, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations")
189
+ stub_request(:post, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations")
190
190
  .with(
191
191
  body: "{\"name\":\"name\",\"description\":\"description\"}",
192
192
  headers: {
193
193
  "Accept" => "application/json",
194
194
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
195
195
  "Content-Type" => "application/json",
196
- "Host" => "stream.watsonplatform.net"
196
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
197
197
  }
198
198
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
199
- service_response = service.create_voice_model(
199
+ service_response = service.create_custom_model(
200
200
  name: "name",
201
201
  description: "description"
202
202
  )
203
203
  assert_equal(response, service_response.result)
204
204
 
205
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid")
205
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid")
206
206
  .with(
207
207
  headers: {
208
208
  "Accept" => "application/json",
209
209
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
210
- "Host" => "stream.watsonplatform.net"
210
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
211
211
  }
212
212
  ).to_return(status: 200, body: { "customization" => "yep, just one" }.to_json, headers: { "Content-Type" => "application/json" })
213
- service_response = service.get_voice_model(
213
+ service_response = service.get_custom_model(
214
214
  customization_id: "custid"
215
215
  )
216
216
  assert_equal({ "customization" => "yep, just one" }, service_response.result)
217
217
 
218
- stub_request(:post, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid")
218
+ stub_request(:post, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid")
219
219
  .with(
220
220
  body: "{\"name\":\"name\",\"description\":\"description\"}",
221
221
  headers: {
222
222
  "Accept" => "application/json",
223
223
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
224
224
  "Content-Type" => "application/json",
225
- "Host" => "stream.watsonplatform.net"
225
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
226
226
  }
227
227
  ).to_return(status: 200, body: "", headers: {})
228
- service_response = service.update_voice_model(
228
+ service_response = service.update_custom_model(
229
229
  customization_id: "custid",
230
230
  name: "name",
231
231
  description: "description"
232
232
  )
233
233
  assert(service_response.nil?)
234
234
 
235
- stub_request(:delete, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid")
235
+ stub_request(:delete, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid")
236
236
  .with(
237
237
  headers: {
238
238
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
239
- "Host" => "stream.watsonplatform.net"
239
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
240
240
  }
241
241
  ).to_return(status: 200, body: "", headers: {})
242
- service_response = service.delete_voice_model(
242
+ service_response = service.delete_custom_model(
243
243
  customization_id: "custid"
244
244
  )
245
245
  assert(service_response.nil?)
@@ -256,12 +256,12 @@ class TextToSpeechV1Test < Minitest::Test
256
256
  password: "password",
257
257
  authenticator: authenticator
258
258
  )
259
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid/words")
259
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid/words")
260
260
  .with(
261
261
  headers: {
262
262
  "Accept" => "application/json",
263
263
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
264
- "Host" => "stream.watsonplatform.net"
264
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
265
265
  }
266
266
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
267
267
  service_response = service.list_words(
@@ -269,14 +269,14 @@ class TextToSpeechV1Test < Minitest::Test
269
269
  )
270
270
  assert_equal(response, service_response.result)
271
271
 
272
- stub_request(:post, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid/words")
272
+ stub_request(:post, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid/words")
273
273
  .with(
274
274
  body: "{\"words\":[{\"word\":\"one\",\"translation\":\"one\"},{\"word\":\"two\",\"translation\":\"two\"}]}",
275
275
  headers: {
276
276
  "Accept" => "application/json",
277
277
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
278
278
  "Content-Type" => "application/json",
279
- "Host" => "stream.watsonplatform.net"
279
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
280
280
  }
281
281
  ).to_return(status: 200, body: "", headers: { "Content-Type" => "application/json" })
282
282
  service_response = service.add_words(
@@ -288,12 +288,12 @@ class TextToSpeechV1Test < Minitest::Test
288
288
  )
289
289
  assert(service_response.nil?)
290
290
 
291
- stub_request(:get, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid/words/word")
291
+ stub_request(:get, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid/words/word")
292
292
  .with(
293
293
  headers: {
294
294
  "Accept" => "application/json",
295
295
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
296
- "Host" => "stream.watsonplatform.net"
296
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
297
297
  }
298
298
  ).to_return(status: 200, body: { "customization" => "yep, just one" }.to_json, headers: { "Content-Type" => "application/json" })
299
299
  service_response = service.get_word(
@@ -302,13 +302,13 @@ class TextToSpeechV1Test < Minitest::Test
302
302
  )
303
303
  assert_equal({ "customization" => "yep, just one" }, service_response.result)
304
304
 
305
- stub_request(:put, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid/words/word")
305
+ stub_request(:put, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid/words/word")
306
306
  .with(
307
307
  body: "{\"translation\":\"I'm translated\"}",
308
308
  headers: {
309
309
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
310
310
  "Content-Type" => "application/json",
311
- "Host" => "stream.watsonplatform.net"
311
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
312
312
  }
313
313
  ).to_return(status: 200, body: "", headers: { "Content-Type" => "application/json" })
314
314
  service_response = service.add_word(
@@ -318,11 +318,11 @@ class TextToSpeechV1Test < Minitest::Test
318
318
  )
319
319
  assert(service_response.nil?)
320
320
 
321
- stub_request(:delete, "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/custid/words/word")
321
+ stub_request(:delete, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/customizations/custid/words/word")
322
322
  .with(
323
323
  headers: {
324
324
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
325
- "Host" => "stream.watsonplatform.net"
325
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
326
326
  }
327
327
  ).to_return(status: 200, body: "", headers: { "Content-Type" => "application/json" })
328
328
  service_response = service.delete_word(
@@ -342,11 +342,11 @@ class TextToSpeechV1Test < Minitest::Test
342
342
  password: "password",
343
343
  authenticator: authenticator
344
344
  )
345
- stub_request(:delete, "https://stream.watsonplatform.net/text-to-speech/api/v1/user_data?customer_id=id")
345
+ stub_request(:delete, "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/user_data?customer_id=id")
346
346
  .with(
347
347
  headers: {
348
348
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
349
- "Host" => "stream.watsonplatform.net"
349
+ "Host" => "api.us-south.text-to-speech.watson.cloud.ibm.com"
350
350
  }
351
351
  ).to_return(status: 200, body: "", headers: {})
352
352
  service_response = service.delete_user_data(
@@ -15,14 +15,14 @@ class ToneAnalyzerV3Test < Minitest::Test
15
15
  }
16
16
  expected_response = IBMWatson::DetailedResponse.new(status: 200, headers: headers, body: tone_response)
17
17
  tone_text = File.read(Dir.getwd + "/resources/personality.txt")
18
- stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21")
18
+ stub_request(:post, "https://api.us-south.tone-analyzer.watson.cloud.ibm.com/v3/tone?version=2017-09-21")
19
19
  .with(
20
20
  body: tone_text,
21
21
  headers: {
22
22
  "Accept" => "application/json",
23
23
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
24
24
  "Content-Type" => "application/json",
25
- "Host" => "gateway.watsonplatform.net"
25
+ "Host" => "api.us-south.tone-analyzer.watson.cloud.ibm.com"
26
26
  }
27
27
  ).to_return(status: 200, body: tone_response.to_json, headers: headers)
28
28
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -49,14 +49,14 @@ class ToneAnalyzerV3Test < Minitest::Test
49
49
  }
50
50
  tone_text = File.read(Dir.getwd + "/resources/personality.txt")
51
51
  expected_response = IBMWatson::DetailedResponse.new(status: 200, headers: headers, body: tone_response)
52
- stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?sentences=false&version=2017-09-21")
52
+ stub_request(:post, "https://api.us-south.tone-analyzer.watson.cloud.ibm.com/v3/tone?sentences=false&version=2017-09-21")
53
53
  .with(
54
54
  body: tone_text,
55
55
  headers: {
56
56
  "Accept" => "application/json",
57
57
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
58
58
  "Content-Type" => "application/json",
59
- "Host" => "gateway.watsonplatform.net"
59
+ "Host" => "api.us-south.tone-analyzer.watson.cloud.ibm.com"
60
60
  }
61
61
  ).to_return(status: 200, body: tone_response.to_json, headers: headers)
62
62
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -82,14 +82,14 @@ class ToneAnalyzerV3Test < Minitest::Test
82
82
  "Content-Type" => "application/json"
83
83
  }
84
84
  expected_response = IBMWatson::DetailedResponse.new(body: tone_response, status: 200, headers: headers)
85
- stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone_chat?version=2017-09-21")
85
+ stub_request(:post, "https://api.us-south.tone-analyzer.watson.cloud.ibm.com/v3/tone_chat?version=2017-09-21")
86
86
  .with(
87
87
  body: "{\"utterances\":[{\"text\":\"I am very happy\",\"user\":\"glenn\"}]}",
88
88
  headers: {
89
89
  "Accept" => "application/json",
90
90
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
91
91
  "Content-Type" => "application/json",
92
- "Host" => "gateway.watsonplatform.net"
92
+ "Host" => "api.us-south.tone-analyzer.watson.cloud.ibm.com"
93
93
  }
94
94
  ).to_return(status: 200, body: tone_response.to_json, headers: headers)
95
95
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -127,14 +127,14 @@ class ToneAnalyzerV3Test < Minitest::Test
127
127
  "error" => error_message
128
128
  }
129
129
  text = "Team, I know that times are tough!"
130
- stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21")
130
+ stub_request(:post, "https://api.us-south.tone-analyzer.watson.cloud.ibm.com/v3/tone?version=2017-09-21")
131
131
  .with(
132
132
  body: text,
133
133
  headers: {
134
134
  "Accept" => "application/json",
135
135
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
136
136
  "Content-Type" => "application/json",
137
- "Host" => "gateway.watsonplatform.net"
137
+ "Host" => "api.us-south.tone-analyzer.watson.cloud.ibm.com"
138
138
  }
139
139
  ).to_return(status: 400, body: tone_response.to_json, headers: headers)
140
140
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -161,14 +161,14 @@ class ToneAnalyzerV3Test < Minitest::Test
161
161
  "Content-Type" => "application/json"
162
162
  }
163
163
  tone_text = File.read(Dir.getwd + "/resources/personality.txt")
164
- stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21")
164
+ stub_request(:post, "https://api.us-south.tone-analyzer.watson.cloud.ibm.com/v3/tone?version=2017-09-21")
165
165
  .with(
166
166
  body: tone_text,
167
167
  headers: {
168
168
  "Accept" => "application/json",
169
169
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
170
170
  "Content-Type" => "Custom/Type",
171
- "Host" => "gateway.watsonplatform.net",
171
+ "Host" => "api.us-south.tone-analyzer.watson.cloud.ibm.com",
172
172
  "Custom-Header-One" => "yes"
173
173
  }
174
174
  ).to_return(status: 200, body: tone_response.to_json, headers: headers)
@@ -193,14 +193,14 @@ class ToneAnalyzerV3Test < Minitest::Test
193
193
  "Content-Type" => "application/json"
194
194
  }
195
195
  tone_text = { "text" => "This is the text to be analyzed" }
196
- stub_request(:post, "https://gateway.watsonplatform.net/tone-analyzer/api/v3/tone?version=2017-09-21")
196
+ stub_request(:post, "https://api.us-south.tone-analyzer.watson.cloud.ibm.com/v3/tone?version=2017-09-21")
197
197
  .with(
198
198
  body: tone_text,
199
199
  headers: {
200
200
  "Accept" => "application/json",
201
201
  "Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
202
202
  "Content-Type" => "application/json",
203
- "Host" => "gateway.watsonplatform.net"
203
+ "Host" => "api.us-south.tone-analyzer.watson.cloud.ibm.com"
204
204
  }
205
205
  ).to_return(status: 200, body: tone_response.to_json, headers: headers)
206
206
  authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
@@ -28,11 +28,11 @@ class VisualRecognitionV3Test < Minitest::Test
28
28
  }
29
29
  ]
30
30
  }
31
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers/bogusnumber?version=2018-03-19")
31
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classifiers/bogusnumber?version=2018-03-19")
32
32
  .with(
33
33
  headers: {
34
34
  "Accept" => "application/json",
35
- "Host" => "gateway.watsonplatform.net",
35
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
36
36
  "Authorization" => "Bearer bogus_access_token"
37
37
  }
38
38
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
@@ -50,11 +50,11 @@ class VisualRecognitionV3Test < Minitest::Test
50
50
  version: "2018-03-19",
51
51
  authenticator: authenticator
52
52
  )
53
- stub_request(:delete, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers/bogusnumber?version=2018-03-19")
53
+ stub_request(:delete, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classifiers/bogusnumber?version=2018-03-19")
54
54
  .with(
55
55
  headers: {
56
56
  "Accept" => "application/json",
57
- "Host" => "gateway.watsonplatform.net",
57
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
58
58
  "Authorization" => "Bearer bogus_access_token"
59
59
  }
60
60
  ).to_return(status: 200, body: { "response" => 200 }.to_json, headers: { "Content-Type" => "applicaton/json" })
@@ -87,11 +87,11 @@ class VisualRecognitionV3Test < Minitest::Test
87
87
  }
88
88
  ]
89
89
  }
90
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers?version=2018-03-19")
90
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classifiers?version=2018-03-19")
91
91
  .with(
92
92
  headers: {
93
93
  "Accept" => "application/json",
94
- "Host" => "gateway.watsonplatform.net",
94
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
95
95
  "Authorization" => "Bearer bogus_access_token"
96
96
  }
97
97
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
@@ -118,11 +118,11 @@ class VisualRecognitionV3Test < Minitest::Test
118
118
  cars = File.open(Dir.getwd + "/resources/cars.zip")
119
119
  trucks = File.open(Dir.getwd + "/resources/trucks.zip")
120
120
 
121
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers?version=2018-03-19")
121
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classifiers?version=2018-03-19")
122
122
  .with(
123
123
  headers: {
124
124
  "Accept" => "application/json",
125
- "Host" => "gateway.watsonplatform.net",
125
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
126
126
  "Authorization" => "Bearer bogus_access_token"
127
127
  }
128
128
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
@@ -161,11 +161,11 @@ class VisualRecognitionV3Test < Minitest::Test
161
161
  { "class" => "brokenwinshield" }
162
162
  ]
163
163
  }
164
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers/bogusid?version=2018-03-19")
164
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classifiers/bogusid?version=2018-03-19")
165
165
  .with(
166
166
  headers: {
167
167
  "Accept" => "application/json",
168
- "Host" => "gateway.watsonplatform.net",
168
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
169
169
  "Authorization" => "Bearer bogus_access_token"
170
170
  }
171
171
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
@@ -219,11 +219,11 @@ class VisualRecognitionV3Test < Minitest::Test
219
219
  "images_processed" => 1
220
220
  }
221
221
 
222
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classify?version=2018-03-19")
222
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classify?version=2018-03-19")
223
223
  .with(
224
224
  headers: {
225
225
  "Accept" => "application/json",
226
- "Host" => "gateway.watsonplatform.net",
226
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
227
227
  "Authorization" => "Bearer bogus_access_token"
228
228
  }
229
229
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
@@ -265,11 +265,11 @@ class VisualRecognitionV3Test < Minitest::Test
265
265
  version: "2018-03-19",
266
266
  authenticator: authenticator
267
267
  )
268
- stub_request(:delete, "https://gateway.watsonplatform.net/visual-recognition/api/v3/user_data?customer_id=id&version=2018-03-19")
268
+ stub_request(:delete, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/user_data?customer_id=id&version=2018-03-19")
269
269
  .with(
270
270
  headers: {
271
271
  "Accept" => "application/json",
272
- "Host" => "gateway.watsonplatform.net",
272
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com",
273
273
  "Authorization" => "Bearer bogus_access_token"
274
274
  }
275
275
  ).to_return(status: 200, body: "", headers: {})
@@ -287,11 +287,11 @@ class VisualRecognitionV3Test < Minitest::Test
287
287
  version: "2018-03-19",
288
288
  authenticator: authenticator
289
289
  )
290
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v3/classifiers/classifierid/core_ml_model?version=2018-03-19")
290
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v3/classifiers/classifierid/core_ml_model?version=2018-03-19")
291
291
  .with(
292
292
  headers: {
293
293
  "Authorization" => "Bearer bogus_access_token",
294
- "Host" => "gateway.watsonplatform.net"
294
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
295
295
  }
296
296
  ).to_return(status: 200, body: "ml_model", headers: {})
297
297
  service_response = service.get_core_ml_model(classifier_id: "classifierid")