ibm_watson 1.0.0.rc2 → 1.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -27
- data/lib/ibm_watson/assistant_v1.rb +6 -80
- data/lib/ibm_watson/assistant_v2.rb +6 -38
- data/lib/ibm_watson/compare_comply_v1.rb +6 -47
- data/lib/ibm_watson/discovery_v1.rb +12 -297
- data/lib/ibm_watson/language_translator_v3.rb +6 -41
- data/lib/ibm_watson/natural_language_classifier_v1.rb +6 -35
- data/lib/ibm_watson/natural_language_understanding_v1.rb +6 -38
- data/lib/ibm_watson/personality_insights_v3.rb +6 -30
- data/lib/ibm_watson/speech_to_text_v1.rb +9 -130
- data/lib/ibm_watson/text_to_speech_v1.rb +6 -50
- data/lib/ibm_watson/tone_analyzer_v3.rb +6 -31
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +8 -103
- data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +5 -5
- data/lib/ibm_watson.rb +9 -0
- data/test/integration/test_assistant_v1.rb +1 -1
- data/test/integration/test_assistant_v2.rb +1 -1
- data/test/integration/test_compare_comply_v1.rb +1 -1
- data/test/integration/test_discovery_v1.rb +1 -4
- data/test/integration/test_language_translator_v3.rb +1 -1
- data/test/integration/test_natural_language_classifier_v1.rb +1 -1
- data/test/integration/test_natural_language_understanding_v1.rb +1 -1
- data/test/integration/test_personality_insights_v3.rb +1 -1
- data/test/integration/test_speech_to_text_v1.rb +2 -2
- data/test/integration/test_text_to_speech_v1.rb +1 -1
- data/test/integration/test_tone_analyzer_v3.rb +1 -1
- data/test/integration/test_visual_recognition_v3.rb +1 -8
- data/test/unit/test_assistant_v1.rb +45 -45
- data/test/unit/test_assistant_v2.rb +3 -3
- data/test/unit/test_compare_comply_v1.rb +12 -12
- data/test/unit/test_configure_http_client.rb +37 -13
- data/test/unit/test_discovery_v1.rb +47 -139
- data/test/unit/test_language_translator_v3.rb +13 -26
- data/test/unit/test_natural_language_classifier_v1.rb +2 -2
- data/test/unit/test_natural_language_understanding_v1.rb +5 -5
- data/test/unit/test_personality_insights_v3.rb +8 -8
- data/test/unit/test_speech_to_text_v1.rb +21 -21
- data/test/unit/test_text_to_speech_v1.rb +5 -5
- data/test/unit/test_tone_analyzer_v3.rb +9 -9
- data/test/unit/test_vcap_using_personality_insights.rb +8 -8
- data/test/unit/test_visual_recognition_v3.rb +8 -75
- metadata +4 -4
@@ -44,50 +44,21 @@ module IBMWatson
|
|
44
44
|
# Instead, specify a version date that is compatible with your
|
45
45
|
# application, and don't change it until your application is
|
46
46
|
# ready for a later version.
|
47
|
-
# @option args
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# @option args username [String] The username used to authenticate with the service.
|
51
|
-
# Username and password credentials are only required to run your
|
52
|
-
# application locally or outside of IBM Cloud. When running on
|
53
|
-
# IBM Cloud, the credentials will be automatically loaded from the
|
54
|
-
# `VCAP_SERVICES` environment variable.
|
55
|
-
# @option args password [String] The password used to authenticate with the service.
|
56
|
-
# Username and password credentials are only required to run your
|
57
|
-
# application locally or outside of IBM Cloud. When running on
|
58
|
-
# IBM Cloud, the credentials will be automatically loaded from the
|
59
|
-
# `VCAP_SERVICES` environment variable.
|
60
|
-
# @option args iam_apikey [String] An API key that can be used to request IAM tokens. If
|
61
|
-
# this API key is provided, the SDK will manage the token and handle the
|
62
|
-
# refreshing.
|
63
|
-
# @option args iam_access_token [String] An IAM access token is fully managed by the application.
|
64
|
-
# Responsibility falls on the application to refresh the token, either before
|
65
|
-
# it expires or reactively upon receiving a 401 from the service as any requests
|
66
|
-
# made with an expired token will fail.
|
67
|
-
# @option args iam_url [String] An optional URL for the IAM service API. Defaults to
|
68
|
-
# 'https://iam.cloud.ibm.com/identity/token'.
|
69
|
-
# @option args iam_client_id [String] An optional client id for the IAM service API.
|
70
|
-
# @option args iam_client_secret [String] An optional client secret for the IAM service API.
|
71
|
-
# @option args icp4d_access_token [STRING] A ICP4D(IBM Cloud Pak for Data) access token is
|
72
|
-
# fully managed by the application. Responsibility falls on the application to
|
73
|
-
# refresh the token, either before it expires or reactively upon receiving a 401
|
74
|
-
# from the service as any requests made with an expired token will fail.
|
75
|
-
# @option args icp4d_url [STRING] In order to use an SDK-managed token with ICP4D authentication, this
|
76
|
-
# URL must be passed in.
|
77
|
-
# @option args authentication_type [STRING] Specifies the authentication pattern to use. Values that it
|
78
|
-
# takes are basic, iam or icp4d.
|
47
|
+
# @option args service_url [String] The base service URL to use when contacting the service.
|
48
|
+
# The base service_url may differ between IBM Cloud regions.
|
49
|
+
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
79
50
|
def initialize(args = {})
|
80
51
|
@__async_initialized__ = false
|
81
52
|
defaults = {}
|
82
53
|
defaults[:version] = nil
|
83
|
-
defaults[:
|
54
|
+
defaults[:service_url] = "https://gateway.watsonplatform.net/compare-comply/api"
|
84
55
|
defaults[:authenticator] = nil
|
85
|
-
defaults[:authentication_type] = nil
|
86
56
|
args = defaults.merge(args)
|
87
57
|
@version = args[:version]
|
88
58
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
89
59
|
|
90
|
-
args[:
|
60
|
+
args[:service_name] = "compare_comply"
|
61
|
+
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
91
62
|
super
|
92
63
|
end
|
93
64
|
|
@@ -128,7 +99,6 @@ module IBMWatson
|
|
128
99
|
|
129
100
|
method_url = "/v1/html_conversion"
|
130
101
|
|
131
|
-
headers = authenticator.authenticate(headers)
|
132
102
|
response = request(
|
133
103
|
method: "POST",
|
134
104
|
url: method_url,
|
@@ -176,7 +146,6 @@ module IBMWatson
|
|
176
146
|
|
177
147
|
method_url = "/v1/element_classification"
|
178
148
|
|
179
|
-
headers = authenticator.authenticate(headers)
|
180
149
|
response = request(
|
181
150
|
method: "POST",
|
182
151
|
url: method_url,
|
@@ -224,7 +193,6 @@ module IBMWatson
|
|
224
193
|
|
225
194
|
method_url = "/v1/tables"
|
226
195
|
|
227
|
-
headers = authenticator.authenticate(headers)
|
228
196
|
response = request(
|
229
197
|
method: "POST",
|
230
198
|
url: method_url,
|
@@ -285,7 +253,6 @@ module IBMWatson
|
|
285
253
|
|
286
254
|
method_url = "/v1/comparison"
|
287
255
|
|
288
|
-
headers = authenticator.authenticate(headers)
|
289
256
|
response = request(
|
290
257
|
method: "POST",
|
291
258
|
url: method_url,
|
@@ -332,7 +299,6 @@ module IBMWatson
|
|
332
299
|
|
333
300
|
method_url = "/v1/feedback"
|
334
301
|
|
335
|
-
headers = authenticator.authenticate(headers)
|
336
302
|
response = request(
|
337
303
|
method: "POST",
|
338
304
|
url: method_url,
|
@@ -418,7 +384,6 @@ module IBMWatson
|
|
418
384
|
|
419
385
|
method_url = "/v1/feedback"
|
420
386
|
|
421
|
-
headers = authenticator.authenticate(headers)
|
422
387
|
response = request(
|
423
388
|
method: "GET",
|
424
389
|
url: method_url,
|
@@ -454,7 +419,6 @@ module IBMWatson
|
|
454
419
|
|
455
420
|
method_url = "/v1/feedback/%s" % [ERB::Util.url_encode(feedback_id)]
|
456
421
|
|
457
|
-
headers = authenticator.authenticate(headers)
|
458
422
|
response = request(
|
459
423
|
method: "GET",
|
460
424
|
url: method_url,
|
@@ -490,7 +454,6 @@ module IBMWatson
|
|
490
454
|
|
491
455
|
method_url = "/v1/feedback/%s" % [ERB::Util.url_encode(feedback_id)]
|
492
456
|
|
493
|
-
headers = authenticator.authenticate(headers)
|
494
457
|
response = request(
|
495
458
|
method: "DELETE",
|
496
459
|
url: method_url,
|
@@ -582,7 +545,6 @@ module IBMWatson
|
|
582
545
|
|
583
546
|
method_url = "/v1/batches"
|
584
547
|
|
585
|
-
headers = authenticator.authenticate(headers)
|
586
548
|
response = request(
|
587
549
|
method: "POST",
|
588
550
|
url: method_url,
|
@@ -611,7 +573,6 @@ module IBMWatson
|
|
611
573
|
|
612
574
|
method_url = "/v1/batches"
|
613
575
|
|
614
|
-
headers = authenticator.authenticate(headers)
|
615
576
|
response = request(
|
616
577
|
method: "GET",
|
617
578
|
url: method_url,
|
@@ -642,7 +603,6 @@ module IBMWatson
|
|
642
603
|
|
643
604
|
method_url = "/v1/batches/%s" % [ERB::Util.url_encode(batch_id)]
|
644
605
|
|
645
|
-
headers = authenticator.authenticate(headers)
|
646
606
|
response = request(
|
647
607
|
method: "GET",
|
648
608
|
url: method_url,
|
@@ -683,7 +643,6 @@ module IBMWatson
|
|
683
643
|
|
684
644
|
method_url = "/v1/batches/%s" % [ERB::Util.url_encode(batch_id)]
|
685
645
|
|
686
|
-
headers = authenticator.authenticate(headers)
|
687
646
|
response = request(
|
688
647
|
method: "PUT",
|
689
648
|
url: method_url,
|