ibm_watson 1.0.0.rc2 → 1.0.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -27
  3. data/lib/ibm_watson/assistant_v1.rb +6 -80
  4. data/lib/ibm_watson/assistant_v2.rb +6 -38
  5. data/lib/ibm_watson/compare_comply_v1.rb +6 -47
  6. data/lib/ibm_watson/discovery_v1.rb +12 -297
  7. data/lib/ibm_watson/language_translator_v3.rb +6 -41
  8. data/lib/ibm_watson/natural_language_classifier_v1.rb +6 -35
  9. data/lib/ibm_watson/natural_language_understanding_v1.rb +6 -38
  10. data/lib/ibm_watson/personality_insights_v3.rb +6 -30
  11. data/lib/ibm_watson/speech_to_text_v1.rb +9 -130
  12. data/lib/ibm_watson/text_to_speech_v1.rb +6 -50
  13. data/lib/ibm_watson/tone_analyzer_v3.rb +6 -31
  14. data/lib/ibm_watson/version.rb +1 -1
  15. data/lib/ibm_watson/visual_recognition_v3.rb +8 -103
  16. data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +5 -5
  17. data/lib/ibm_watson.rb +9 -0
  18. data/test/integration/test_assistant_v1.rb +1 -1
  19. data/test/integration/test_assistant_v2.rb +1 -1
  20. data/test/integration/test_compare_comply_v1.rb +1 -1
  21. data/test/integration/test_discovery_v1.rb +1 -4
  22. data/test/integration/test_language_translator_v3.rb +1 -1
  23. data/test/integration/test_natural_language_classifier_v1.rb +1 -1
  24. data/test/integration/test_natural_language_understanding_v1.rb +1 -1
  25. data/test/integration/test_personality_insights_v3.rb +1 -1
  26. data/test/integration/test_speech_to_text_v1.rb +2 -2
  27. data/test/integration/test_text_to_speech_v1.rb +1 -1
  28. data/test/integration/test_tone_analyzer_v3.rb +1 -1
  29. data/test/integration/test_visual_recognition_v3.rb +1 -8
  30. data/test/unit/test_assistant_v1.rb +45 -45
  31. data/test/unit/test_assistant_v2.rb +3 -3
  32. data/test/unit/test_compare_comply_v1.rb +12 -12
  33. data/test/unit/test_configure_http_client.rb +37 -13
  34. data/test/unit/test_discovery_v1.rb +47 -139
  35. data/test/unit/test_language_translator_v3.rb +13 -26
  36. data/test/unit/test_natural_language_classifier_v1.rb +2 -2
  37. data/test/unit/test_natural_language_understanding_v1.rb +5 -5
  38. data/test/unit/test_personality_insights_v3.rb +8 -8
  39. data/test/unit/test_speech_to_text_v1.rb +21 -21
  40. data/test/unit/test_text_to_speech_v1.rb +5 -5
  41. data/test/unit/test_tone_analyzer_v3.rb +9 -9
  42. data/test/unit/test_vcap_using_personality_insights.rb +8 -8
  43. data/test/unit/test_visual_recognition_v3.rb +8 -75
  44. metadata +4 -4
@@ -16,7 +16,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
16
16
  headers = {
17
17
  "Content-Type" => "application/json"
18
18
  }
19
- expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
19
+ expected_response = IBMWatson::DetailedResponse.new(status: 200, body: JSON.parse(profile_response), headers: headers)
20
20
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
21
21
  .with(
22
22
  body: personality_text,
@@ -27,7 +27,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
27
27
  "Host" => "gateway.watsonplatform.net"
28
28
  }
29
29
  ).to_return(status: 200, body: profile_response, headers: headers)
30
- authenticator = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
30
+ authenticator = IBMWatson::Authenticators::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
31
31
  service = IBMWatson::PersonalityInsightsV3.new(
32
32
  version: "2017-10-13",
33
33
  authenticator: authenticator
@@ -51,7 +51,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
51
51
  headers = {
52
52
  "Content-Type" => "applicaiton/json"
53
53
  }
54
- expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
54
+ expected_response = IBMWatson::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
55
55
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&raw_scores=true&version=2017-10-13")
56
56
  .with(
57
57
  body: personality_text,
@@ -62,7 +62,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
62
62
  "Host" => "gateway.watsonplatform.net"
63
63
  }
64
64
  ).to_return(status: 200, body: profile_response, headers: headers)
65
- authenticator = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
65
+ authenticator = IBMWatson::Authenticators::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
66
66
  service = IBMWatson::PersonalityInsightsV3.new(
67
67
  version: "2017-10-13",
68
68
  authenticator: authenticator
@@ -88,7 +88,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
88
88
  headers = {
89
89
  "Content-Type" => "text/csv"
90
90
  }
91
- expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
91
+ expected_response = IBMWatson::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
92
92
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?consumption_preferences=true&csv_headers=true&raw_scores=true&version=2017-10-13")
93
93
  .with(
94
94
  body: personality_text,
@@ -99,7 +99,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
99
99
  "Host" => "gateway.watsonplatform.net"
100
100
  }
101
101
  ).to_return(status: 200, body: profile_response, headers: headers)
102
- authenticator = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
102
+ authenticator = IBMWatson::Authenticators::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
103
103
  service = IBMWatson::PersonalityInsightsV3.new(
104
104
  version: "2017-10-13",
105
105
  authenticator: authenticator
@@ -126,7 +126,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
126
126
  headers = {
127
127
  "Content-Type" => "application/json"
128
128
  }
129
- expected_response = IBMCloudSdkCore::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
129
+ expected_response = IBMWatson::DetailedResponse.new(status: 200, body: profile_response, headers: headers)
130
130
  stub_request(:post, "https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13")
131
131
  .with(
132
132
  body: personality_text,
@@ -139,7 +139,7 @@ class VcapPersonalityInsightsV3Test < Minitest::Test
139
139
  "Host" => "gateway.watsonplatform.net"
140
140
  }
141
141
  ).to_return(status: 200, body: profile_response.to_json, headers: headers)
142
- authenticator = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
142
+ authenticator = IBMWatson::Authenticators::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: "sample_service")
143
143
  service = IBMWatson::PersonalityInsightsV3.new(
144
144
  version: "2017-10-13",
145
145
  authenticator: authenticator
@@ -9,7 +9,7 @@ WebMock.disable_net_connect!(allow_localhost: true)
9
9
  # Unit tests for the Visual Recognition V3 Service
10
10
  class VisualRecognitionV3Test < Minitest::Test
11
11
  def test_get_classifier
12
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
12
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
13
13
  bearer_token: "bogus_access_token"
14
14
  )
15
15
  service = IBMWatson::VisualRecognitionV3.new(
@@ -43,7 +43,7 @@ class VisualRecognitionV3Test < Minitest::Test
43
43
  end
44
44
 
45
45
  def test_delete_classifier
46
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
46
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
47
47
  bearer_token: "bogus_access_token"
48
48
  )
49
49
  service = IBMWatson::VisualRecognitionV3.new(
@@ -65,7 +65,7 @@ class VisualRecognitionV3Test < Minitest::Test
65
65
  end
66
66
 
67
67
  def test_list_classifiers
68
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
68
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
69
69
  bearer_token: "bogus_access_token"
70
70
  )
71
71
  service = IBMWatson::VisualRecognitionV3.new(
@@ -100,7 +100,7 @@ class VisualRecognitionV3Test < Minitest::Test
100
100
  end
101
101
 
102
102
  def test_create_classifier
103
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
103
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
104
104
  bearer_token: "bogus_access_token"
105
105
  )
106
106
  service = IBMWatson::VisualRecognitionV3.new(
@@ -142,7 +142,7 @@ class VisualRecognitionV3Test < Minitest::Test
142
142
  end
143
143
 
144
144
  def test_update_classifier
145
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
145
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
146
146
  bearer_token: "bogus_access_token"
147
147
  )
148
148
  service = IBMWatson::VisualRecognitionV3.new(
@@ -185,7 +185,7 @@ class VisualRecognitionV3Test < Minitest::Test
185
185
  end
186
186
 
187
187
  def test_classify
188
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
188
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
189
189
  bearer_token: "bogus_access_token"
190
190
  )
191
191
  service = IBMWatson::VisualRecognitionV3.new(
@@ -257,75 +257,8 @@ class VisualRecognitionV3Test < Minitest::Test
257
257
  assert_equal(response, service_response.result)
258
258
  end
259
259
 
260
- def test_detect_faces
261
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
262
- bearer_token: "bogus_access_token"
263
- )
264
- service = IBMWatson::VisualRecognitionV3.new(
265
- version: "2018-03-19",
266
- authenticator: authenticator
267
- )
268
- response = {
269
- "images" => [
270
- {
271
- "faces" => [
272
- {
273
- "age" => {
274
- "max" => 44,
275
- "min" => 35,
276
- "score" => 0.446989
277
- },
278
- "face_location" => {
279
- "height" => 159,
280
- "left" => 256,
281
- "top" => 64,
282
- "width" => 92
283
- },
284
- "gender" => {
285
- "gender" => "MALE",
286
- "score" => 0.99593
287
- },
288
- "identity" => {
289
- "name" => "Barack Obama",
290
- "score" => 0.970688,
291
- "type_hierarchy" => "/people/politicians/democrats/barack obama"
292
- }
293
- }
294
- ],
295
- "resolved_url" => "https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/prez.jpg",
296
- "source_url" => "https://watson-developer-cloud.github.io/doc-tutorial-downloads/visual-recognition/prez.jpg"
297
- }
298
- ],
299
- "images_processed" => 1
300
- }
301
- stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v3/detect_faces?version=2018-03-19")
302
- .with(
303
- headers: {
304
- "Accept" => "application/json",
305
- "Host" => "gateway.watsonplatform.net",
306
- "Authorization" => "Bearer bogus_access_token"
307
- }
308
- ).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
309
- service_response = service.detect_faces(
310
- url: "http://google.com"
311
- )
312
- assert_equal(response, service_response.result)
313
-
314
- image_file = File.open(Dir.getwd + "/resources/test.jpg")
315
- service_response = service.detect_faces(
316
- images_file: image_file,
317
- images_filename: "test.jpg"
318
- )
319
- assert_equal(response, service_response.result)
320
-
321
- service_response = service.detect_faces(
322
- images_file: "image_file"
323
- )
324
- assert_equal(response, service_response.result)
325
- end
326
-
327
260
  def test_delete_user_data
328
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
261
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
329
262
  bearer_token: "bogus_access_token"
330
263
  )
331
264
  service = IBMWatson::VisualRecognitionV3.new(
@@ -347,7 +280,7 @@ class VisualRecognitionV3Test < Minitest::Test
347
280
  end
348
281
 
349
282
  def test_get_core_ml_model
350
- authenticator = IBMCloudSdkCore::BearerTokenAuthenticator.new(
283
+ authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
351
284
  bearer_token: "bogus_access_token"
352
285
  )
353
286
  service = IBMWatson::VisualRecognitionV3.new(
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.0.0.rc2
4
+ version: 1.0.0.rc3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Nussbaum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-19 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.0.0.rc2
75
+ version: 1.0.0.rc5
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.0.0.rc2
82
+ version: 1.0.0.rc5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: jwt
85
85
  requirement: !ruby/object:Gem::Requirement