ibm_watson 0.10.0 → 0.11.0
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.
- checksums.yaml +4 -4
- data/README.md +17 -2
- data/lib/ibm_watson/assistant_v1.rb +7 -7
- data/lib/ibm_watson/discovery_v1.rb +206 -1
- data/lib/ibm_watson/speech_to_text_v1.rb +619 -276
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +8 -11
- data/lib/ibm_watson/watson_service.rb +19 -2
- data/test/integration/test_discovery_v1.rb +27 -1
- data/test/integration/test_speech_to_text_v1.rb +1 -0
- data/test/unit/test_configure_http_client.rb +10 -0
- data/test/unit/test_discovery_v1.rb +124 -0
- data/test/unit/test_speech_to_text_v1.rb +81 -0
- data/test/unit/test_watson_service.rb +44 -0
- metadata +8 -8
data/lib/ibm_watson/version.rb
CHANGED
@@ -86,12 +86,7 @@ module IBMWatson
|
|
86
86
|
# assumes UTF-8 encoding if it encounters non-ASCII characters.
|
87
87
|
#
|
88
88
|
# You can also include an image with the **url** parameter.
|
89
|
-
# @param accept_language [String] The language of
|
90
|
-
# the built-in classifier IDs: `default`, `food`, and `explicit`. The class names of
|
91
|
-
# custom classifiers are not translated.
|
92
|
-
#
|
93
|
-
# The response might not be in the specified language when the requested language is
|
94
|
-
# not supported or when there is no translation for the class name.
|
89
|
+
# @param accept_language [String] The desired language of parts of the response. See the response for details.
|
95
90
|
# @param url [String] The URL of an image to analyze. Must be in .jpg, or .png format. The minimum
|
96
91
|
# recommended pixel density is 32X32 pixels per inch, and the maximum image size is
|
97
92
|
# 10 MB.
|
@@ -167,13 +162,13 @@ module IBMWatson
|
|
167
162
|
#########################
|
168
163
|
|
169
164
|
##
|
170
|
-
# @!method detect_faces(images_file: nil, url: nil, images_file_content_type: nil, images_filename: nil)
|
165
|
+
# @!method detect_faces(images_file: nil, url: nil, images_file_content_type: nil, images_filename: nil, accept_language: nil)
|
171
166
|
# Detect faces in images.
|
172
167
|
# **Important:** On April 2, 2018, the identity information in the response to calls
|
173
168
|
# to the Face model was removed. The identity information refers to the `name` of
|
174
169
|
# the person, `score`, and `type_hierarchy` knowledge graph. For details about the
|
175
170
|
# enhanced Face model, see the [Release
|
176
|
-
# notes](https://
|
171
|
+
# notes](https://cloud.ibm.com/docs/services/visual-recognition/release-notes.html#2april2018).
|
177
172
|
#
|
178
173
|
# Analyze and get data about faces in images. Responses can include estimated age
|
179
174
|
# and gender. This feature uses a built-in model, so no training is necessary. The
|
@@ -196,9 +191,11 @@ module IBMWatson
|
|
196
191
|
# You can also include images with the **images_file** parameter.
|
197
192
|
# @param images_file_content_type [String] The content type of images_file.
|
198
193
|
# @param images_filename [String] The filename for images_file.
|
194
|
+
# @param accept_language [String] The desired language of parts of the response. See the response for details.
|
199
195
|
# @return [DetailedResponse] A `DetailedResponse` object representing the response.
|
200
|
-
def detect_faces(images_file: nil, url: nil, images_file_content_type: nil, images_filename: nil)
|
196
|
+
def detect_faces(images_file: nil, url: nil, images_file_content_type: nil, images_filename: nil, accept_language: nil)
|
201
197
|
headers = {
|
198
|
+
"Accept-Language" => accept_language
|
202
199
|
}
|
203
200
|
|
204
201
|
params = {
|
@@ -375,7 +372,7 @@ module IBMWatson
|
|
375
372
|
# Update a custom classifier by adding new positive or negative classes (examples)
|
376
373
|
# or by adding new images to existing classes. You must supply at least one set of
|
377
374
|
# positive or negative examples. For details, see [Updating custom
|
378
|
-
# classifiers](https://
|
375
|
+
# classifiers](https://cloud.ibm.com/docs/services/visual-recognition/customizing.html#updating-custom-classifiers).
|
379
376
|
#
|
380
377
|
# Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image
|
381
378
|
# file names, and classifier and class names). The service assumes UTF-8 encoding if
|
@@ -524,7 +521,7 @@ module IBMWatson
|
|
524
521
|
# You associate a customer ID with data by passing the `X-Watson-Metadata` header
|
525
522
|
# with a request that passes data. For more information about personal data and
|
526
523
|
# customer IDs, see [Information
|
527
|
-
# security](https://
|
524
|
+
# security](https://cloud.ibm.com/docs/services/visual-recognition/information-security.html).
|
528
525
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
529
526
|
# @return [nil]
|
530
527
|
def delete_user_data(customer_id:)
|
@@ -36,9 +36,11 @@ class WatsonService
|
|
36
36
|
@url = vars[:url]
|
37
37
|
@username = nil
|
38
38
|
@password = nil
|
39
|
+
@iam_apikey = nil
|
39
40
|
@token_manager = nil
|
40
41
|
@temp_headers = nil
|
41
42
|
@icp_prefix = vars[:password]&.start_with?("icp-") ? true : false
|
43
|
+
@disable_ssl = false
|
42
44
|
|
43
45
|
user_agent_string = "watson-apis-ruby-sdk-" + IBMWatson::VERSION
|
44
46
|
user_agent_string += " #{RbConfig::CONFIG["host"]}"
|
@@ -69,6 +71,10 @@ class WatsonService
|
|
69
71
|
@password = vars[:password]
|
70
72
|
end
|
71
73
|
end
|
74
|
+
raise ArgumentError.new('The username shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your username') if check_bad_first_or_last_char(@username)
|
75
|
+
raise ArgumentError.new('The password shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your password') if check_bad_first_or_last_char(@password)
|
76
|
+
raise ArgumentError.new('The url shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your url') if check_bad_first_or_last_char(@url)
|
77
|
+
raise ArgumentError.new('The apikey shouldn\'t start or end with curly brackets or quotes. Be sure to remove any {} and \" characters surrounding your apikey') if check_bad_first_or_last_char(@iam_apikey)
|
72
78
|
|
73
79
|
@conn = HTTP::Client.new(
|
74
80
|
headers: headers
|
@@ -165,7 +171,7 @@ class WatsonService
|
|
165
171
|
self
|
166
172
|
end
|
167
173
|
|
168
|
-
# @!method configure_http_client(proxy: {}, timeout: {})
|
174
|
+
# @!method configure_http_client(proxy: {}, timeout: {}, disable_ssl: false)
|
169
175
|
# Sets the http client config, currently works with timeout and proxies
|
170
176
|
# @param proxy [Hash] The hash of proxy configurations
|
171
177
|
# @option proxy address [String] The address of the proxy
|
@@ -176,17 +182,28 @@ class WatsonService
|
|
176
182
|
# @param timeout [Hash] The hash for configuring timeouts. `per_operation` has priority over `global`
|
177
183
|
# @option timeout per_operation [Hash] Timeouts per operation. Requires `read`, `write`, `connect`
|
178
184
|
# @option timeout global [Integer] Upper bound on total request time
|
179
|
-
|
185
|
+
# @param disable_ssl [Boolean] Disable the SSL verification (Note that this has serious security implications - only do this if you really mean to!)
|
186
|
+
def configure_http_client(proxy: {}, timeout: {}, disable_ssl: false)
|
180
187
|
raise TypeError("proxy parameter must be a Hash") unless proxy.empty? || proxy.instance_of?(Hash)
|
181
188
|
|
182
189
|
raise TypeError("timeout parameter must be a Hash") unless timeout.empty? || timeout.instance_of?(Hash)
|
183
190
|
|
191
|
+
@disable_ssl = disable_ssl
|
192
|
+
if disable_ssl
|
193
|
+
ssl_context = OpenSSL::SSL::SSLContext.new
|
194
|
+
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
195
|
+
@conn.default_options = { ssl_context: ssl_context }
|
196
|
+
end
|
184
197
|
add_proxy(proxy) unless proxy.empty? || !proxy.dig(:address).is_a?(String) || !proxy.dig(:port).is_a?(Integer)
|
185
198
|
add_timeout(timeout) unless timeout.empty? || (!timeout.key?(:per_operation) && !timeout.key?(:global))
|
186
199
|
end
|
187
200
|
|
188
201
|
private
|
189
202
|
|
203
|
+
def check_bad_first_or_last_char(str)
|
204
|
+
return str.start_with?("{", "\"") || str.end_with?("}", "\"") unless str.nil?
|
205
|
+
end
|
206
|
+
|
190
207
|
def set_token_manager(iam_apikey: nil, iam_access_token: nil, iam_url: nil)
|
191
208
|
@iam_apikey = iam_apikey
|
192
209
|
@iam_access_token = iam_access_token
|
@@ -198,7 +198,6 @@ if !ENV["DISCOVERY_USERNAME"].nil? && !ENV["DISCOVERY_PASSWORD"].nil?
|
|
198
198
|
filter: "extracted_metadata.sha1::9181d244*",
|
199
199
|
return_fields: "extracted_metadata.sha1"
|
200
200
|
).result
|
201
|
-
puts query_results
|
202
201
|
refute(query_results.nil?)
|
203
202
|
end
|
204
203
|
|
@@ -208,6 +207,33 @@ if !ENV["DISCOVERY_USERNAME"].nil? && !ENV["DISCOVERY_PASSWORD"].nil?
|
|
208
207
|
).result
|
209
208
|
refute(credentials.nil?)
|
210
209
|
end
|
210
|
+
|
211
|
+
def test_list_gateways
|
212
|
+
response = @service.list_gateways(
|
213
|
+
environment_id: @environment_id
|
214
|
+
).result
|
215
|
+
refute(response.nil?)
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_create_get_delete_gateways
|
219
|
+
gateway = @service.create_gateway(
|
220
|
+
environment_id: @environment_id,
|
221
|
+
name: "test"
|
222
|
+
).result
|
223
|
+
refute(gateway.nil?)
|
224
|
+
|
225
|
+
response = @service.get_gateway(
|
226
|
+
environment_id: @environment_id,
|
227
|
+
gateway_id: gateway["gateway_id"]
|
228
|
+
).result
|
229
|
+
refute(response.nil?)
|
230
|
+
|
231
|
+
response = @service.delete_gateway(
|
232
|
+
environment_id: @environment_id,
|
233
|
+
gateway_id: gateway["gateway_id"]
|
234
|
+
).result
|
235
|
+
refute(response.nil?)
|
236
|
+
end
|
211
237
|
end
|
212
238
|
else
|
213
239
|
class DiscoveryV1Test < Minitest::Test
|
@@ -141,4 +141,14 @@ class HTTPConfigTest < Minitest::Test
|
|
141
141
|
timeout = service.conn.default_options.timeout_options
|
142
142
|
assert_equal(expected_timeouts, timeout)
|
143
143
|
end
|
144
|
+
|
145
|
+
def test_disable_ssl
|
146
|
+
service = IBMWatson::NaturalLanguageUnderstandingV1.new(
|
147
|
+
version: "2018-03-16",
|
148
|
+
username: "username",
|
149
|
+
password: "password"
|
150
|
+
)
|
151
|
+
service.configure_http_client(disable_ssl: true)
|
152
|
+
refute_nil(service.conn.default_options.ssl_context)
|
153
|
+
end
|
144
154
|
end
|
@@ -1368,4 +1368,128 @@ class DiscoveryV1Test < Minitest::Test
|
|
1368
1368
|
)
|
1369
1369
|
assert_equal({ "updated" => "true" }, service_response.result)
|
1370
1370
|
end
|
1371
|
+
|
1372
|
+
def test_create_stopword_list
|
1373
|
+
service = IBMWatson::DiscoveryV1.new(
|
1374
|
+
username: "username",
|
1375
|
+
password: "password",
|
1376
|
+
version: "2018-03-05"
|
1377
|
+
)
|
1378
|
+
stub_request(:post, "https://gateway.watsonplatform.net/compare-comply/api/v1/element_classification").with do |req|
|
1379
|
+
end
|
1380
|
+
|
1381
|
+
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05").with do |req|
|
1382
|
+
assert_equal(req.headers["Accept"], "application/json")
|
1383
|
+
assert_match(%r{\Amultipart/form-data}, req.headers["Content-Type"])
|
1384
|
+
assert_match(/Content-Disposition: form-data/, req.body)
|
1385
|
+
end
|
1386
|
+
service.create_stopword_list(
|
1387
|
+
environment_id: "envid",
|
1388
|
+
collection_id: "colid",
|
1389
|
+
stopword_file: "file"
|
1390
|
+
)
|
1391
|
+
end
|
1392
|
+
|
1393
|
+
def test_delete_stopword_list
|
1394
|
+
service = IBMWatson::DiscoveryV1.new(
|
1395
|
+
username: "username",
|
1396
|
+
password: "password",
|
1397
|
+
version: "2018-03-05"
|
1398
|
+
)
|
1399
|
+
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/collections/colid/word_lists/stopwords?version=2018-03-05")
|
1400
|
+
.with(
|
1401
|
+
headers: {
|
1402
|
+
"Accept" => "application/json",
|
1403
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
1404
|
+
"Host" => "gateway.watsonplatform.net"
|
1405
|
+
}
|
1406
|
+
).to_return(status: 200, body: { "deleted" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
|
1407
|
+
service_response = service.delete_stopword_list(
|
1408
|
+
environment_id: "envid",
|
1409
|
+
collection_id: "colid"
|
1410
|
+
)
|
1411
|
+
assert_nil(service_response)
|
1412
|
+
end
|
1413
|
+
|
1414
|
+
def test_list_gateways
|
1415
|
+
service = IBMWatson::DiscoveryV1.new(
|
1416
|
+
username: "username",
|
1417
|
+
password: "password",
|
1418
|
+
version: "2018-03-05"
|
1419
|
+
)
|
1420
|
+
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
|
1421
|
+
.with(
|
1422
|
+
headers: {
|
1423
|
+
"Accept" => "application/json",
|
1424
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
1425
|
+
"Host" => "gateway.watsonplatform.net"
|
1426
|
+
}
|
1427
|
+
).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
|
1428
|
+
service_response = service.list_gateways(
|
1429
|
+
environment_id: "envid"
|
1430
|
+
)
|
1431
|
+
assert_equal({ "received" => "true" }, service_response.result)
|
1432
|
+
end
|
1433
|
+
|
1434
|
+
def test_create_gateway
|
1435
|
+
service = IBMWatson::DiscoveryV1.new(
|
1436
|
+
username: "username",
|
1437
|
+
password: "password",
|
1438
|
+
version: "2018-03-05"
|
1439
|
+
)
|
1440
|
+
stub_request(:post, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways?version=2018-03-05")
|
1441
|
+
.with(
|
1442
|
+
headers: {
|
1443
|
+
"Accept" => "application/json",
|
1444
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
1445
|
+
"Host" => "gateway.watsonplatform.net"
|
1446
|
+
}
|
1447
|
+
).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
|
1448
|
+
service_response = service.create_gateway(
|
1449
|
+
environment_id: "envid"
|
1450
|
+
)
|
1451
|
+
assert_equal({ "received" => "true" }, service_response.result)
|
1452
|
+
end
|
1453
|
+
|
1454
|
+
def test_get_gateway
|
1455
|
+
service = IBMWatson::DiscoveryV1.new(
|
1456
|
+
username: "username",
|
1457
|
+
password: "password",
|
1458
|
+
version: "2018-03-05"
|
1459
|
+
)
|
1460
|
+
stub_request(:get, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
|
1461
|
+
.with(
|
1462
|
+
headers: {
|
1463
|
+
"Accept" => "application/json",
|
1464
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
1465
|
+
"Host" => "gateway.watsonplatform.net"
|
1466
|
+
}
|
1467
|
+
).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
|
1468
|
+
service_response = service.get_gateway(
|
1469
|
+
environment_id: "envid",
|
1470
|
+
gateway_id: "gatewayid"
|
1471
|
+
)
|
1472
|
+
assert_equal({ "received" => "true" }, service_response.result)
|
1473
|
+
end
|
1474
|
+
|
1475
|
+
def test_delete_gateway
|
1476
|
+
service = IBMWatson::DiscoveryV1.new(
|
1477
|
+
username: "username",
|
1478
|
+
password: "password",
|
1479
|
+
version: "2018-03-05"
|
1480
|
+
)
|
1481
|
+
stub_request(:delete, "https://gateway.watsonplatform.net/discovery/api/v1/environments/envid/gateways/gatewayid?version=2018-03-05")
|
1482
|
+
.with(
|
1483
|
+
headers: {
|
1484
|
+
"Accept" => "application/json",
|
1485
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
1486
|
+
"Host" => "gateway.watsonplatform.net"
|
1487
|
+
}
|
1488
|
+
).to_return(status: 200, body: { "received" => "true" }.to_json, headers: { "Content-Type" => "application/json" })
|
1489
|
+
service_response = service.delete_gateway(
|
1490
|
+
environment_id: "envid",
|
1491
|
+
gateway_id: "gatewayid"
|
1492
|
+
)
|
1493
|
+
assert_equal({ "received" => "true" }, service_response.result)
|
1494
|
+
end
|
1371
1495
|
end
|
@@ -545,6 +545,87 @@ class SpeechToTextV1Test < Minitest::Test
|
|
545
545
|
assert_equal({ "get response" => "yep" }, service_response.result)
|
546
546
|
end
|
547
547
|
|
548
|
+
def test_list_grammars
|
549
|
+
service = IBMWatson::SpeechToTextV1.new(
|
550
|
+
username: "username",
|
551
|
+
password: "password"
|
552
|
+
)
|
553
|
+
stub_request(:get, "https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/custid/grammars")
|
554
|
+
.with(
|
555
|
+
headers: {
|
556
|
+
"Accept" => "application/json",
|
557
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
558
|
+
"Host" => "stream.watsonplatform.net"
|
559
|
+
}
|
560
|
+
).to_return(status: 200, body: { "get response" => "yep" }.to_json, headers: { "Content-Type" => "application/json" })
|
561
|
+
service_response = service.list_grammars(
|
562
|
+
customization_id: "custid"
|
563
|
+
)
|
564
|
+
assert_equal({ "get response" => "yep" }, service_response.result)
|
565
|
+
end
|
566
|
+
|
567
|
+
def test_add_grammar
|
568
|
+
service = IBMWatson::SpeechToTextV1.new(
|
569
|
+
username: "username",
|
570
|
+
password: "password"
|
571
|
+
)
|
572
|
+
stub_request(:post, "https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/custid/grammars/grammar")
|
573
|
+
.with(
|
574
|
+
headers: {
|
575
|
+
"Accept" => "application/json",
|
576
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
577
|
+
"Host" => "stream.watsonplatform.net"
|
578
|
+
}
|
579
|
+
).to_return(status: 200, body: { "get response" => "yep" }.to_json, headers: { "Content-Type" => "application/json" })
|
580
|
+
response = service.add_grammar(
|
581
|
+
customization_id: "custid",
|
582
|
+
grammar_name: "grammar",
|
583
|
+
grammar_file: "file",
|
584
|
+
content_type: "application/srgs"
|
585
|
+
)
|
586
|
+
assert_nil(response)
|
587
|
+
end
|
588
|
+
|
589
|
+
def test_get_grammar
|
590
|
+
service = IBMWatson::SpeechToTextV1.new(
|
591
|
+
username: "username",
|
592
|
+
password: "password"
|
593
|
+
)
|
594
|
+
stub_request(:get, "https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/custid/grammars/grammar")
|
595
|
+
.with(
|
596
|
+
headers: {
|
597
|
+
"Accept" => "application/json",
|
598
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
599
|
+
"Host" => "stream.watsonplatform.net"
|
600
|
+
}
|
601
|
+
).to_return(status: 200, body: { "get response" => "yep" }.to_json, headers: { "Content-Type" => "application/json" })
|
602
|
+
response = service.get_grammar(
|
603
|
+
customization_id: "custid",
|
604
|
+
grammar_name: "grammar"
|
605
|
+
)
|
606
|
+
assert_equal({ "get response" => "yep" }, response.result)
|
607
|
+
end
|
608
|
+
|
609
|
+
def test_delete_grammar
|
610
|
+
service = IBMWatson::SpeechToTextV1.new(
|
611
|
+
username: "username",
|
612
|
+
password: "password"
|
613
|
+
)
|
614
|
+
stub_request(:delete, "https://stream.watsonplatform.net/speech-to-text/api/v1/customizations/custid/grammars/grammar")
|
615
|
+
.with(
|
616
|
+
headers: {
|
617
|
+
"Accept" => "application/json",
|
618
|
+
"Authorization" => "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
|
619
|
+
"Host" => "stream.watsonplatform.net"
|
620
|
+
}
|
621
|
+
).to_return(status: 200, body: { "get response" => "yep" }.to_json, headers: { "Content-Type" => "application/json" })
|
622
|
+
response = service.delete_grammar(
|
623
|
+
customization_id: "custid",
|
624
|
+
grammar_name: "grammar"
|
625
|
+
)
|
626
|
+
assert_nil(response)
|
627
|
+
end
|
628
|
+
|
548
629
|
def test_custom_audio_resources
|
549
630
|
service = IBMWatson::SpeechToTextV1.new(
|
550
631
|
username: "username",
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require("json")
|
4
|
+
require_relative("./../test_helper.rb")
|
5
|
+
require("webmock/minitest")
|
6
|
+
|
7
|
+
WebMock.disable_net_connect!(allow_localhost: true)
|
8
|
+
|
9
|
+
# Unit tests for the watson_service
|
10
|
+
class WatsonServiceTest < Minitest::Test
|
11
|
+
def test_wrong_username
|
12
|
+
assert_raises do
|
13
|
+
IBMWatson::AssistantV2.new(
|
14
|
+
username: "\"username",
|
15
|
+
password: "password"
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_wrong_apikey
|
21
|
+
assert_raises do
|
22
|
+
IBMWatson::AssistantV1.new(
|
23
|
+
iam_apikey: "{apikey"
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_wrong_url
|
29
|
+
assert_raises do
|
30
|
+
IBMWatson::AssistantV1.new(
|
31
|
+
iam_apikey: "apikey",
|
32
|
+
url: "url}"
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_correct_creds
|
38
|
+
service = IBMWatson::AssistantV1.new(
|
39
|
+
username: "username",
|
40
|
+
password: "password"
|
41
|
+
)
|
42
|
+
refute_nil(service)
|
43
|
+
end
|
44
|
+
end
|
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: 0.
|
4
|
+
version: 0.11.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:
|
11
|
+
date: 2019-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -196,16 +196,16 @@ dependencies:
|
|
196
196
|
name: rubocop
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - '='
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version: '0.
|
201
|
+
version: '0.62'
|
202
202
|
type: :development
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - '='
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version: '0.
|
208
|
+
version: '0.62'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: simplecov
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -294,6 +294,7 @@ files:
|
|
294
294
|
- test/unit/test_tone_analyzer_v3.rb
|
295
295
|
- test/unit/test_vcap_using_personality_insights.rb
|
296
296
|
- test/unit/test_visual_recognition_v3.rb
|
297
|
+
- test/unit/test_watson_service.rb
|
297
298
|
homepage: https://www.github.com/watson-developer-cloud
|
298
299
|
licenses:
|
299
300
|
- Apache-2.0
|
@@ -316,8 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
316
317
|
- !ruby/object:Gem::Version
|
317
318
|
version: '0'
|
318
319
|
requirements: []
|
319
|
-
|
320
|
-
rubygems_version: 2.7.8
|
320
|
+
rubygems_version: 3.0.2
|
321
321
|
signing_key:
|
322
322
|
specification_version: 4
|
323
323
|
summary: Official client library to use the IBM Watson Services
|