ibm_watson 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ibm_watson/assistant_v1.rb +1 -145
  3. data/lib/ibm_watson/assistant_v2.rb +95 -5
  4. data/lib/ibm_watson/compare_comply_v1.rb +1 -1
  5. data/lib/ibm_watson/discovery_v1.rb +1 -1
  6. data/lib/ibm_watson/discovery_v2.rb +590 -9
  7. data/lib/ibm_watson/language_translator_v3.rb +153 -48
  8. data/lib/ibm_watson/natural_language_classifier_v1.rb +1 -1
  9. data/lib/ibm_watson/natural_language_understanding_v1.rb +7 -9
  10. data/lib/ibm_watson/personality_insights_v3.rb +1 -1
  11. data/lib/ibm_watson/speech_to_text_v1.rb +40 -34
  12. data/lib/ibm_watson/text_to_speech_v1.rb +18 -11
  13. data/lib/ibm_watson/tone_analyzer_v3.rb +1 -1
  14. data/lib/ibm_watson/version.rb +1 -1
  15. data/lib/ibm_watson/visual_recognition_v3.rb +1 -1
  16. data/lib/ibm_watson/visual_recognition_v4.rb +1 -1
  17. data/test/integration/test_assistant_v2.rb +18 -0
  18. data/test/integration/test_discovery_v2.rb +118 -6
  19. data/test/integration/test_language_translator_v3.rb +5 -0
  20. data/test/unit/test_assistant_v1.rb +98 -98
  21. data/test/unit/test_assistant_v2.rb +40 -12
  22. data/test/unit/test_compare_comply_v1.rb +20 -20
  23. data/test/unit/test_discovery_v1.rb +125 -125
  24. data/test/unit/test_discovery_v2.rb +262 -29
  25. data/test/unit/test_language_translator_v3.rb +85 -24
  26. data/test/unit/test_natural_language_classifier_v1.rb +17 -17
  27. data/test/unit/test_natural_language_understanding_v1.rb +10 -10
  28. data/test/unit/test_personality_insights_v3.rb +14 -14
  29. data/test/unit/test_speech_to_text_v1.rb +97 -97
  30. data/test/unit/test_text_to_speech_v1.rb +41 -41
  31. data/test/unit/test_tone_analyzer_v3.rb +12 -12
  32. data/test/unit/test_visual_recognition_v3.rb +16 -16
  33. data/test/unit/test_visual_recognition_v4.rb +40 -40
  34. metadata +2 -2
@@ -20,7 +20,7 @@ class VisualRecognitionV4Test < Minitest::Test
20
20
 
21
21
  def test_analyze
22
22
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
23
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/analyze?version=2018-03-19").with do |req|
23
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/analyze?version=2018-03-19").with do |req|
24
24
  assert_equal(req.headers["Accept"], "application/json")
25
25
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
26
26
  assert_match(/Content-Disposition: form-data/, req.body)
@@ -40,7 +40,7 @@ class VisualRecognitionV4Test < Minitest::Test
40
40
  end
41
41
 
42
42
  def test_analyze_url
43
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/analyze?version=2018-03-19").with do |req|
43
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/analyze?version=2018-03-19").with do |req|
44
44
  assert_equal(req.headers["Accept"], "application/json")
45
45
  assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
46
46
  assert_match(/Content-Disposition: form-data; name="image_url"/, req.body)
@@ -67,11 +67,11 @@ class VisualRecognitionV4Test < Minitest::Test
67
67
  }
68
68
  ]
69
69
  }
70
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections?version=2018-03-19")
70
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections?version=2018-03-19")
71
71
  .with(
72
72
  headers: {
73
73
  "Accept" => "application/json",
74
- "Host" => "gateway.watsonplatform.net"
74
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
75
75
  }
76
76
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
77
77
  service_response = service.create_collection(
@@ -85,11 +85,11 @@ class VisualRecognitionV4Test < Minitest::Test
85
85
  response = {
86
86
  "collections" => []
87
87
  }
88
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections?version=2018-03-19")
88
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections?version=2018-03-19")
89
89
  .with(
90
90
  headers: {
91
91
  "Accept" => "application/json",
92
- "Host" => "gateway.watsonplatform.net"
92
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
93
93
  }
94
94
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
95
95
  service_response = service.list_collections
@@ -109,11 +109,11 @@ class VisualRecognitionV4Test < Minitest::Test
109
109
  }
110
110
  ]
111
111
  }
112
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid?version=2018-03-19")
112
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid?version=2018-03-19")
113
113
  .with(
114
114
  headers: {
115
115
  "Accept" => "application/json",
116
- "Host" => "gateway.watsonplatform.net"
116
+ "Host" => "api.us-south.visual-recognition.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_collection(
@@ -135,11 +135,11 @@ class VisualRecognitionV4Test < Minitest::Test
135
135
  }
136
136
  ]
137
137
  }
138
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid?version=2018-03-19")
138
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid?version=2018-03-19")
139
139
  .with(
140
140
  headers: {
141
141
  "Accept" => "application/json",
142
- "Host" => "gateway.watsonplatform.net"
142
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
143
143
  }
144
144
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
145
145
  service_response = service.update_collection(
@@ -150,11 +150,11 @@ class VisualRecognitionV4Test < Minitest::Test
150
150
 
151
151
  def test_delete_collection
152
152
  response = {}
153
- stub_request(:delete, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid?version=2018-03-19")
153
+ stub_request(:delete, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid?version=2018-03-19")
154
154
  .with(
155
155
  headers: {
156
156
  "Accept" => "application/json",
157
- "Host" => "gateway.watsonplatform.net"
157
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
158
158
  }
159
159
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
160
160
  service_response = service.delete_collection(
@@ -168,11 +168,11 @@ class VisualRecognitionV4Test < Minitest::Test
168
168
  "collection_id" => "collid"
169
169
  }
170
170
  file = File.open(Dir.getwd + "/resources/cnc_test.pdf")
171
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/images?version=2018-03-19")
171
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/images?version=2018-03-19")
172
172
  .with(
173
173
  headers: {
174
174
  "Accept" => "application/json",
175
- "Host" => "gateway.watsonplatform.net"
175
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
176
176
  }
177
177
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
178
178
  service_response = service.add_images(
@@ -192,11 +192,11 @@ class VisualRecognitionV4Test < Minitest::Test
192
192
  response = {
193
193
  "collections" => []
194
194
  }
195
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/images?version=2018-03-19")
195
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/images?version=2018-03-19")
196
196
  .with(
197
197
  headers: {
198
198
  "Accept" => "application/json",
199
- "Host" => "gateway.watsonplatform.net"
199
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
200
200
  }
201
201
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
202
202
  service_response = service.list_images(
@@ -209,11 +209,11 @@ class VisualRecognitionV4Test < Minitest::Test
209
209
  response = {
210
210
  "collection_id" => "collid"
211
211
  }
212
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/images/imageid?version=2018-03-19")
212
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/images/imageid?version=2018-03-19")
213
213
  .with(
214
214
  headers: {
215
215
  "Accept" => "application/json",
216
- "Host" => "gateway.watsonplatform.net"
216
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
217
217
  }
218
218
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
219
219
  service_response = service.get_image_details(
@@ -225,11 +225,11 @@ class VisualRecognitionV4Test < Minitest::Test
225
225
 
226
226
  def test_delete_image
227
227
  response = {}
228
- stub_request(:delete, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/images/imageid?version=2018-03-19")
228
+ stub_request(:delete, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/images/imageid?version=2018-03-19")
229
229
  .with(
230
230
  headers: {
231
231
  "Accept" => "application/json",
232
- "Host" => "gateway.watsonplatform.net"
232
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
233
233
  }
234
234
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
235
235
  service_response = service.delete_image(
@@ -243,10 +243,10 @@ class VisualRecognitionV4Test < Minitest::Test
243
243
  response = {
244
244
  "collection_id" => "collid"
245
245
  }
246
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/images/imageid/jpeg?version=2018-03-19")
246
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/images/imageid/jpeg?version=2018-03-19")
247
247
  .with(
248
248
  headers: {
249
- "Host" => "gateway.watsonplatform.net"
249
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
250
250
  }
251
251
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
252
252
  service_response = service.get_jpeg_image(
@@ -260,10 +260,10 @@ class VisualRecognitionV4Test < Minitest::Test
260
260
  response = {
261
261
  "collection_id" => "collid"
262
262
  }
263
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/train?version=2018-03-19")
263
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/train?version=2018-03-19")
264
264
  .with(
265
265
  headers: {
266
- "Host" => "gateway.watsonplatform.net"
266
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
267
267
  }
268
268
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
269
269
  service_response = service.train(
@@ -276,11 +276,11 @@ class VisualRecognitionV4Test < Minitest::Test
276
276
  response = {
277
277
  "collection_id" => "collid"
278
278
  }
279
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/images/imageid/training_data?version=2018-03-19")
279
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/images/imageid/training_data?version=2018-03-19")
280
280
  .with(
281
281
  headers: {
282
282
  "Accept" => "application/json",
283
- "Host" => "gateway.watsonplatform.net"
283
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
284
284
  }
285
285
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
286
286
  service_response = service.add_image_training_data(
@@ -303,11 +303,11 @@ class VisualRecognitionV4Test < Minitest::Test
303
303
 
304
304
  def test_delete_user_data
305
305
  response = {}
306
- stub_request(:delete, "https://gateway.watsonplatform.net/visual-recognition/api/v4/user_data?version=2018-03-19&customer_id=customer")
306
+ stub_request(:delete, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/user_data?version=2018-03-19&customer_id=customer")
307
307
  .with(
308
308
  headers: {
309
309
  "Accept" => "application/json",
310
- "Host" => "gateway.watsonplatform.net"
310
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
311
311
  }
312
312
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
313
313
  service_response = service.delete_user_data(
@@ -320,10 +320,10 @@ class VisualRecognitionV4Test < Minitest::Test
320
320
  response = {
321
321
  "usage" => "usage"
322
322
  }
323
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/training_usage?end_time=end&start_time=start&version=2018-03-19")
323
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/training_usage?end_time=end&start_time=start&version=2018-03-19")
324
324
  .with(
325
325
  headers: {
326
- "Host" => "gateway.watsonplatform.net"
326
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
327
327
  }
328
328
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
329
329
  service_response = service.get_training_usage(
@@ -337,11 +337,11 @@ class VisualRecognitionV4Test < Minitest::Test
337
337
  response = {
338
338
  "objects" => []
339
339
  }
340
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects?version=2018-03-19")
340
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/objects?version=2018-03-19")
341
341
  .with(
342
342
  headers: {
343
343
  "Accept" => "application/json",
344
- "Host" => "gateway.watsonplatform.net"
344
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
345
345
  }
346
346
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
347
347
  service_response = service.list_object_metadata(
@@ -354,11 +354,11 @@ class VisualRecognitionV4Test < Minitest::Test
354
354
  response = {
355
355
  "objects" => []
356
356
  }
357
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects/old_object?version=2018-03-19")
357
+ stub_request(:post, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/objects/old_object?version=2018-03-19")
358
358
  .with(
359
359
  headers: {
360
360
  "Accept" => "application/json",
361
- "Host" => "gateway.watsonplatform.net"
361
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
362
362
  }
363
363
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
364
364
  service_response = service.update_object_metadata(
@@ -373,11 +373,11 @@ class VisualRecognitionV4Test < Minitest::Test
373
373
  response = {
374
374
  "objects" => []
375
375
  }
376
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects/object?version=2018-03-19")
376
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/objects/object?version=2018-03-19")
377
377
  .with(
378
378
  headers: {
379
379
  "Accept" => "application/json",
380
- "Host" => "gateway.watsonplatform.net"
380
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
381
381
  }
382
382
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
383
383
  service_response = service.get_object_metadata(
@@ -388,11 +388,11 @@ class VisualRecognitionV4Test < Minitest::Test
388
388
  end
389
389
 
390
390
  def test_delete_object
391
- stub_request(:delete, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects/object?version=2018-03-19")
391
+ stub_request(:delete, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/objects/object?version=2018-03-19")
392
392
  .with(
393
393
  headers: {
394
394
  "Accept" => "application/json",
395
- "Host" => "gateway.watsonplatform.net"
395
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
396
396
  }
397
397
  ).to_return(status: 200, body: {}.to_json, headers: { "Content-Type" => "application/json" })
398
398
  service_response = service.delete_object(
@@ -406,10 +406,10 @@ class VisualRecognitionV4Test < Minitest::Test
406
406
  response = {
407
407
  "binary" => []
408
408
  }
409
- stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/model?feature=objects&model_format=rscnn_ready&version=2018-03-19")
409
+ stub_request(:get, "https://api.us-south.visual-recognition.watson.cloud.ibm.com/v4/collections/collid/model?feature=objects&model_format=rscnn_ready&version=2018-03-19")
410
410
  .with(
411
411
  headers: {
412
- "Host" => "gateway.watsonplatform.net"
412
+ "Host" => "api.us-south.visual-recognition.watson.cloud.ibm.com"
413
413
  }
414
414
  ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
415
415
  service_response = service.get_model_file(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibm_watson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Nussbaum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby