ibm_watson 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -1
- data/lib/ibm_watson/assistant_v1.rb +140 -60
- data/lib/ibm_watson/assistant_v2.rb +6 -6
- data/lib/ibm_watson/compare_comply_v1.rb +1 -1
- data/lib/ibm_watson/discovery_v1.rb +1 -1
- data/lib/ibm_watson/discovery_v2.rb +1 -1
- data/lib/ibm_watson/language_translator_v3.rb +1 -1
- data/lib/ibm_watson/natural_language_classifier_v1.rb +2 -2
- data/lib/ibm_watson/natural_language_understanding_v1.rb +1 -1
- data/lib/ibm_watson/personality_insights_v3.rb +9 -9
- data/lib/ibm_watson/speech_to_text_v1.rb +104 -104
- data/lib/ibm_watson/text_to_speech_v1.rb +24 -24
- data/lib/ibm_watson/tone_analyzer_v3.rb +3 -3
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +3 -3
- data/lib/ibm_watson/visual_recognition_v4.rb +146 -2
- data/test/unit/test_personality_insights_v3.rb +4 -0
- data/test/unit/test_visual_recognition_v4.rb +69 -0
- metadata +4 -5
- data/test/unit/test_vcap_using_personality_insights.rb +0 -161
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (C) Copyright IBM Corp. 2020.
|
3
|
+
# (C) Copyright IBM Corp. 2018, 2020.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -75,7 +75,7 @@ module IBMWatson
|
|
75
75
|
# about a specific voice, use the **Get a voice** method.
|
76
76
|
#
|
77
77
|
# **See also:** [Listing all available
|
78
|
-
# voices](https://cloud.ibm.com/docs/
|
78
|
+
# voices](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-voices#listVoices).
|
79
79
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
80
80
|
def list_voices
|
81
81
|
headers = {
|
@@ -104,7 +104,7 @@ module IBMWatson
|
|
104
104
|
# **List voices** method.
|
105
105
|
#
|
106
106
|
# **See also:** [Listing a specific
|
107
|
-
# voice](https://cloud.ibm.com/docs/
|
107
|
+
# voice](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-voices#listVoice).
|
108
108
|
# @param voice [String] The voice for which information is to be returned.
|
109
109
|
# @param customization_id [String] The customization ID (GUID) of a custom voice model for which information is to be
|
110
110
|
# returned. You must make the request with credentials for the instance of the
|
@@ -150,7 +150,7 @@ module IBMWatson
|
|
150
150
|
# specify. The service returns the synthesized audio stream as an array of bytes.
|
151
151
|
#
|
152
152
|
# **See also:** [The HTTP
|
153
|
-
# interface](https://cloud.ibm.com/docs/
|
153
|
+
# interface](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-usingHTTP#usingHTTP).
|
154
154
|
#
|
155
155
|
#
|
156
156
|
# ### Audio formats (accept types)
|
@@ -198,7 +198,7 @@ module IBMWatson
|
|
198
198
|
#
|
199
199
|
# For more information about specifying an audio format, including additional
|
200
200
|
# details about some of the formats, see [Audio
|
201
|
-
# formats](https://cloud.ibm.com/docs/
|
201
|
+
# formats](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-audioFormats#audioFormats).
|
202
202
|
#
|
203
203
|
#
|
204
204
|
# ### Warning messages
|
@@ -267,7 +267,7 @@ module IBMWatson
|
|
267
267
|
# Arabic, Chinese, and Dutch languages.
|
268
268
|
#
|
269
269
|
# **See also:** [Querying a word from a
|
270
|
-
# language](https://cloud.ibm.com/docs/
|
270
|
+
# language](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryLanguage).
|
271
271
|
# @param text [String] The word for which the pronunciation is requested.
|
272
272
|
# @param voice [String] A voice that specifies the language in which the pronunciation is to be returned.
|
273
273
|
# All voices for the same language (for example, `en-US`) return the same
|
@@ -324,7 +324,7 @@ module IBMWatson
|
|
324
324
|
# voice model customization for the Arabic, Chinese, and Dutch languages.
|
325
325
|
#
|
326
326
|
# **See also:** [Creating a custom
|
327
|
-
# model](https://cloud.ibm.com/docs/
|
327
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels#cuModelsCreate).
|
328
328
|
# @param name [String] The name of the new custom voice model.
|
329
329
|
# @param language [String] The language of the new custom voice model. Omit the parameter to use the the
|
330
330
|
# default language, `en-US`.
|
@@ -370,7 +370,7 @@ module IBMWatson
|
|
370
370
|
# **Note:** This method is currently a beta release.
|
371
371
|
#
|
372
372
|
# **See also:** [Querying all custom
|
373
|
-
# models](https://cloud.ibm.com/docs/
|
373
|
+
# models](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels#cuModelsQueryAll).
|
374
374
|
# @param language [String] The language for which custom voice models that are owned by the requesting
|
375
375
|
# credentials are to be returned. Omit the parameter to see all custom voice models
|
376
376
|
# that are owned by the requester.
|
@@ -425,11 +425,11 @@ module IBMWatson
|
|
425
425
|
#
|
426
426
|
# **See also:**
|
427
427
|
# * [Updating a custom
|
428
|
-
# model](https://cloud.ibm.com/docs/
|
428
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels#cuModelsUpdate)
|
429
429
|
# * [Adding words to a Japanese custom
|
430
|
-
# model](https://cloud.ibm.com/docs/
|
430
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuJapaneseAdd)
|
431
431
|
# * [Understanding
|
432
|
-
# customization](https://cloud.ibm.com/docs/
|
432
|
+
# customization](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customIntro#customIntro).
|
433
433
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
434
434
|
# with credentials for the instance of the service that owns the custom model.
|
435
435
|
# @param name [String] A new name for the custom voice model.
|
@@ -475,7 +475,7 @@ module IBMWatson
|
|
475
475
|
# **Note:** This method is currently a beta release.
|
476
476
|
#
|
477
477
|
# **See also:** [Querying a custom
|
478
|
-
# model](https://cloud.ibm.com/docs/
|
478
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels#cuModelsQuery).
|
479
479
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
480
480
|
# with credentials for the instance of the service that owns the custom model.
|
481
481
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -507,7 +507,7 @@ module IBMWatson
|
|
507
507
|
# **Note:** This method is currently a beta release.
|
508
508
|
#
|
509
509
|
# **See also:** [Deleting a custom
|
510
|
-
# model](https://cloud.ibm.com/docs/
|
510
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customModels#cuModelsDelete).
|
511
511
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
512
512
|
# with credentials for the instance of the service that owns the custom model.
|
513
513
|
# @return [nil]
|
@@ -560,11 +560,11 @@ module IBMWatson
|
|
560
560
|
#
|
561
561
|
# **See also:**
|
562
562
|
# * [Adding multiple words to a custom
|
563
|
-
# model](https://cloud.ibm.com/docs/
|
563
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordsAdd)
|
564
564
|
# * [Adding words to a Japanese custom
|
565
|
-
# model](https://cloud.ibm.com/docs/
|
565
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuJapaneseAdd)
|
566
566
|
# * [Understanding
|
567
|
-
# customization](https://cloud.ibm.com/docs/
|
567
|
+
# customization](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customIntro#customIntro).
|
568
568
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
569
569
|
# with credentials for the instance of the service that owns the custom model.
|
570
570
|
# @param words [Array[Word]] The **Add custom words** method accepts an array of `Word` objects. Each object
|
@@ -613,7 +613,7 @@ module IBMWatson
|
|
613
613
|
# **Note:** This method is currently a beta release.
|
614
614
|
#
|
615
615
|
# **See also:** [Querying all words from a custom
|
616
|
-
# model](https://cloud.ibm.com/docs/
|
616
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordsQueryModel).
|
617
617
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
618
618
|
# with credentials for the instance of the service that owns the custom model.
|
619
619
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -663,11 +663,11 @@ module IBMWatson
|
|
663
663
|
#
|
664
664
|
# **See also:**
|
665
665
|
# * [Adding a single word to a custom
|
666
|
-
# model](https://cloud.ibm.com/docs/
|
666
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordAdd)
|
667
667
|
# * [Adding words to a Japanese custom
|
668
|
-
# model](https://cloud.ibm.com/docs/
|
668
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuJapaneseAdd)
|
669
669
|
# * [Understanding
|
670
|
-
# customization](https://cloud.ibm.com/docs/
|
670
|
+
# customization](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customIntro#customIntro).
|
671
671
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
672
672
|
# with credentials for the instance of the service that owns the custom model.
|
673
673
|
# @param word [String] The word that is to be added or updated for the custom voice model.
|
@@ -680,7 +680,7 @@ module IBMWatson
|
|
680
680
|
# with or without a single part of speech, for any word; you cannot create multiple
|
681
681
|
# entries with different parts of speech for the same word. For more information,
|
682
682
|
# see [Working with Japanese
|
683
|
-
# entries](https://cloud.ibm.com/docs/
|
683
|
+
# entries](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-rules#jaNotes).
|
684
684
|
# @return [nil]
|
685
685
|
def add_word(customization_id:, word:, translation:, part_of_speech: nil)
|
686
686
|
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
|
@@ -721,7 +721,7 @@ module IBMWatson
|
|
721
721
|
# **Note:** This method is currently a beta release.
|
722
722
|
#
|
723
723
|
# **See also:** [Querying a single word from a custom
|
724
|
-
# model](https://cloud.ibm.com/docs/
|
724
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordQueryModel).
|
725
725
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
726
726
|
# with credentials for the instance of the service that owns the custom model.
|
727
727
|
# @param word [String] The word that is to be queried from the custom voice model.
|
@@ -757,7 +757,7 @@ module IBMWatson
|
|
757
757
|
# **Note:** This method is currently a beta release.
|
758
758
|
#
|
759
759
|
# **See also:** [Deleting a word from a custom
|
760
|
-
# model](https://cloud.ibm.com/docs/
|
760
|
+
# model](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-customWords#cuWordDelete).
|
761
761
|
# @param customization_id [String] The customization ID (GUID) of the custom voice model. You must make the request
|
762
762
|
# with credentials for the instance of the service that owns the custom model.
|
763
763
|
# @param word [String] The word that is to be deleted from the custom voice model.
|
@@ -799,7 +799,7 @@ module IBMWatson
|
|
799
799
|
# with a request that passes the data.
|
800
800
|
#
|
801
801
|
# **See also:** [Information
|
802
|
-
# security](https://cloud.ibm.com/docs/
|
802
|
+
# security](https://cloud.ibm.com/docs/text-to-speech?topic=text-to-speech-information-security#information-security).
|
803
803
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
804
804
|
# @return [nil]
|
805
805
|
def delete_user_data(customer_id:)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (C) Copyright IBM Corp. 2020.
|
3
|
+
# (C) Copyright IBM Corp. 2018, 2020.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -97,7 +97,7 @@ module IBMWatson
|
|
97
97
|
# analyzes only the textual content.
|
98
98
|
#
|
99
99
|
# **See also:** [Using the general-purpose
|
100
|
-
# endpoint](https://cloud.ibm.com/docs/
|
100
|
+
# endpoint](https://cloud.ibm.com/docs/tone-analyzer?topic=tone-analyzer-utgpe#utgpe).
|
101
101
|
# @param tone_input [ToneInput] JSON, plain text, or HTML input that contains the content to be analyzed. For JSON
|
102
102
|
# input, provide an object of type `ToneInput`.
|
103
103
|
# @param content_type [String] The type of the input. A character encoding can be specified by including a
|
@@ -177,7 +177,7 @@ module IBMWatson
|
|
177
177
|
# character encoding for JSON content is effectively always UTF-8.
|
178
178
|
#
|
179
179
|
# **See also:** [Using the customer-engagement
|
180
|
-
# endpoint](https://cloud.ibm.com/docs/
|
180
|
+
# endpoint](https://cloud.ibm.com/docs/tone-analyzer?topic=tone-analyzer-utco#utco).
|
181
181
|
# @param utterances [Array[Utterance]] An array of `Utterance` objects that provides the input content that the service
|
182
182
|
# is to analyze.
|
183
183
|
# @param content_language [String] The language of the input text for the request: English or French. Regional
|
data/lib/ibm_watson/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (C) Copyright IBM Corp. 2020.
|
3
|
+
# (C) Copyright IBM Corp. 2018, 2020.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -305,7 +305,7 @@ module IBMWatson
|
|
305
305
|
# Update a custom classifier by adding new positive or negative classes or by adding
|
306
306
|
# new images to existing classes. You must supply at least one set of positive or
|
307
307
|
# negative examples. For details, see [Updating custom
|
308
|
-
# classifiers](https://cloud.ibm.com/docs/
|
308
|
+
# classifiers](https://cloud.ibm.com/docs/visual-recognition?topic=visual-recognition-customizing#updating-custom-classifiers).
|
309
309
|
#
|
310
310
|
# Encode all names in UTF-8 if they contain non-ASCII characters (.zip and image
|
311
311
|
# file names, and classifier and class names). The service assumes UTF-8 encoding if
|
@@ -464,7 +464,7 @@ module IBMWatson
|
|
464
464
|
# You associate a customer ID with data by passing the `X-Watson-Metadata` header
|
465
465
|
# with a request that passes data. For more information about personal data and
|
466
466
|
# customer IDs, see [Information
|
467
|
-
# security](https://cloud.ibm.com/docs/
|
467
|
+
# security](https://cloud.ibm.com/docs/visual-recognition?topic=visual-recognition-information-security).
|
468
468
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
469
469
|
# @return [nil]
|
470
470
|
def delete_user_data(customer_id:)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# (C) Copyright IBM Corp. 2020.
|
3
|
+
# (C) Copyright IBM Corp. 2019, 2020.
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
6
|
# you may not use this file except in compliance with the License.
|
@@ -529,6 +529,150 @@ module IBMWatson
|
|
529
529
|
response
|
530
530
|
end
|
531
531
|
#########################
|
532
|
+
# Objects
|
533
|
+
#########################
|
534
|
+
|
535
|
+
##
|
536
|
+
# @!method list_object_metadata(collection_id:)
|
537
|
+
# List object metadata.
|
538
|
+
# Retrieves a list of object names in a collection.
|
539
|
+
# @param collection_id [String] The identifier of the collection.
|
540
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
541
|
+
def list_object_metadata(collection_id:)
|
542
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
543
|
+
|
544
|
+
headers = {
|
545
|
+
}
|
546
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "list_object_metadata")
|
547
|
+
headers.merge!(sdk_headers)
|
548
|
+
|
549
|
+
params = {
|
550
|
+
"version" => @version
|
551
|
+
}
|
552
|
+
|
553
|
+
method_url = "/v4/collections/%s/objects" % [ERB::Util.url_encode(collection_id)]
|
554
|
+
|
555
|
+
response = request(
|
556
|
+
method: "GET",
|
557
|
+
url: method_url,
|
558
|
+
headers: headers,
|
559
|
+
params: params,
|
560
|
+
accept_json: true
|
561
|
+
)
|
562
|
+
response
|
563
|
+
end
|
564
|
+
|
565
|
+
##
|
566
|
+
# @!method update_object_metadata(collection_id:, object:, new_object:)
|
567
|
+
# Update an object name.
|
568
|
+
# Update the name of an object. A successful request updates the training data for
|
569
|
+
# all images that use the object.
|
570
|
+
# @param collection_id [String] The identifier of the collection.
|
571
|
+
# @param object [String] The name of the object.
|
572
|
+
# @param new_object [String] The updated name of the object. The name can contain alphanumeric, underscore,
|
573
|
+
# hyphen, space, and dot characters. It cannot begin with the reserved prefix
|
574
|
+
# `sys-`.
|
575
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
576
|
+
def update_object_metadata(collection_id:, object:, new_object:)
|
577
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
578
|
+
|
579
|
+
raise ArgumentError.new("object must be provided") if object.nil?
|
580
|
+
|
581
|
+
raise ArgumentError.new("new_object must be provided") if new_object.nil?
|
582
|
+
|
583
|
+
headers = {
|
584
|
+
}
|
585
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "update_object_metadata")
|
586
|
+
headers.merge!(sdk_headers)
|
587
|
+
|
588
|
+
params = {
|
589
|
+
"version" => @version
|
590
|
+
}
|
591
|
+
|
592
|
+
data = {
|
593
|
+
"object" => new_object
|
594
|
+
}
|
595
|
+
|
596
|
+
method_url = "/v4/collections/%s/objects/%s" % [ERB::Util.url_encode(collection_id), ERB::Util.url_encode(object)]
|
597
|
+
|
598
|
+
response = request(
|
599
|
+
method: "POST",
|
600
|
+
url: method_url,
|
601
|
+
headers: headers,
|
602
|
+
params: params,
|
603
|
+
json: data,
|
604
|
+
accept_json: true
|
605
|
+
)
|
606
|
+
response
|
607
|
+
end
|
608
|
+
|
609
|
+
##
|
610
|
+
# @!method get_object_metadata(collection_id:, object:)
|
611
|
+
# Get object metadata.
|
612
|
+
# Get the number of bounding boxes for a single object in a collection.
|
613
|
+
# @param collection_id [String] The identifier of the collection.
|
614
|
+
# @param object [String] The name of the object.
|
615
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
616
|
+
def get_object_metadata(collection_id:, object:)
|
617
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
618
|
+
|
619
|
+
raise ArgumentError.new("object must be provided") if object.nil?
|
620
|
+
|
621
|
+
headers = {
|
622
|
+
}
|
623
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "get_object_metadata")
|
624
|
+
headers.merge!(sdk_headers)
|
625
|
+
|
626
|
+
params = {
|
627
|
+
"version" => @version
|
628
|
+
}
|
629
|
+
|
630
|
+
method_url = "/v4/collections/%s/objects/%s" % [ERB::Util.url_encode(collection_id), ERB::Util.url_encode(object)]
|
631
|
+
|
632
|
+
response = request(
|
633
|
+
method: "GET",
|
634
|
+
url: method_url,
|
635
|
+
headers: headers,
|
636
|
+
params: params,
|
637
|
+
accept_json: true
|
638
|
+
)
|
639
|
+
response
|
640
|
+
end
|
641
|
+
|
642
|
+
##
|
643
|
+
# @!method delete_object(collection_id:, object:)
|
644
|
+
# Delete an object.
|
645
|
+
# Delete one object from a collection. A successful request deletes the training
|
646
|
+
# data from all images that use the object.
|
647
|
+
# @param collection_id [String] The identifier of the collection.
|
648
|
+
# @param object [String] The name of the object.
|
649
|
+
# @return [nil]
|
650
|
+
def delete_object(collection_id:, object:)
|
651
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
652
|
+
|
653
|
+
raise ArgumentError.new("object must be provided") if object.nil?
|
654
|
+
|
655
|
+
headers = {
|
656
|
+
}
|
657
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "delete_object")
|
658
|
+
headers.merge!(sdk_headers)
|
659
|
+
|
660
|
+
params = {
|
661
|
+
"version" => @version
|
662
|
+
}
|
663
|
+
|
664
|
+
method_url = "/v4/collections/%s/objects/%s" % [ERB::Util.url_encode(collection_id), ERB::Util.url_encode(object)]
|
665
|
+
|
666
|
+
request(
|
667
|
+
method: "DELETE",
|
668
|
+
url: method_url,
|
669
|
+
headers: headers,
|
670
|
+
params: params,
|
671
|
+
accept_json: true
|
672
|
+
)
|
673
|
+
nil
|
674
|
+
end
|
675
|
+
#########################
|
532
676
|
# Training
|
533
677
|
#########################
|
534
678
|
|
@@ -660,7 +804,7 @@ module IBMWatson
|
|
660
804
|
# You associate a customer ID with data by passing the `X-Watson-Metadata` header
|
661
805
|
# with a request that passes data. For more information about personal data and
|
662
806
|
# customer IDs, see [Information
|
663
|
-
# security](https://cloud.ibm.com/docs/
|
807
|
+
# security](https://cloud.ibm.com/docs/visual-recognition?topic=visual-recognition-information-security).
|
664
808
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
665
809
|
# @return [nil]
|
666
810
|
def delete_user_data(customer_id:)
|
@@ -33,6 +33,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
33
33
|
version: "2017-10-13",
|
34
34
|
authenticator: authenticator
|
35
35
|
)
|
36
|
+
service.service_url = "https://gateway.watsonplatform.net/personality-insights/api"
|
36
37
|
service_response = service.profile(
|
37
38
|
accept: "application/json",
|
38
39
|
content: personality_text,
|
@@ -88,6 +89,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
88
89
|
version: "2017-10-13",
|
89
90
|
authenticator: authenticator
|
90
91
|
)
|
92
|
+
service.service_url = "https://gateway.watsonplatform.net/personality-insights/api"
|
91
93
|
service_response = service.profile(
|
92
94
|
accept: "application/json",
|
93
95
|
content: personality_text,
|
@@ -128,6 +130,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
128
130
|
version: "2017-10-13",
|
129
131
|
authenticator: authenticator
|
130
132
|
)
|
133
|
+
service.service_url = "https://gateway.watsonplatform.net/personality-insights/api"
|
131
134
|
service_response = service.profile(
|
132
135
|
content: personality_text,
|
133
136
|
content_type: "application/json",
|
@@ -171,6 +174,7 @@ class PersonalityInsightsV3Test < Minitest::Test
|
|
171
174
|
version: "2017-10-13",
|
172
175
|
authenticator: authenticator
|
173
176
|
)
|
177
|
+
service.service_url = "https://gateway.watsonplatform.net/personality-insights/api"
|
174
178
|
service_response = service.profile(
|
175
179
|
accept: "application/json",
|
176
180
|
content: personality_text,
|
@@ -332,4 +332,73 @@ class VisualRecognitionV4Test < Minitest::Test
|
|
332
332
|
)
|
333
333
|
assert_equal(response, service_response.result)
|
334
334
|
end
|
335
|
+
|
336
|
+
def test_list_object_metadata
|
337
|
+
response = {
|
338
|
+
"objects" => []
|
339
|
+
}
|
340
|
+
stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects?version=2018-03-19")
|
341
|
+
.with(
|
342
|
+
headers: {
|
343
|
+
"Accept" => "application/json",
|
344
|
+
"Host" => "gateway.watsonplatform.net"
|
345
|
+
}
|
346
|
+
).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
|
347
|
+
service_response = service.list_object_metadata(
|
348
|
+
collection_id: "collid"
|
349
|
+
)
|
350
|
+
assert_equal(response, service_response.result)
|
351
|
+
end
|
352
|
+
|
353
|
+
def test_update_object_metadata
|
354
|
+
response = {
|
355
|
+
"objects" => []
|
356
|
+
}
|
357
|
+
stub_request(:post, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects/old_object?version=2018-03-19")
|
358
|
+
.with(
|
359
|
+
headers: {
|
360
|
+
"Accept" => "application/json",
|
361
|
+
"Host" => "gateway.watsonplatform.net"
|
362
|
+
}
|
363
|
+
).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
|
364
|
+
service_response = service.update_object_metadata(
|
365
|
+
collection_id: "collid",
|
366
|
+
object: "old_object",
|
367
|
+
new_object: "new_object"
|
368
|
+
)
|
369
|
+
assert_equal(response, service_response.result)
|
370
|
+
end
|
371
|
+
|
372
|
+
def test_get_object_metadata
|
373
|
+
response = {
|
374
|
+
"objects" => []
|
375
|
+
}
|
376
|
+
stub_request(:get, "https://gateway.watsonplatform.net/visual-recognition/api/v4/collections/collid/objects/object?version=2018-03-19")
|
377
|
+
.with(
|
378
|
+
headers: {
|
379
|
+
"Accept" => "application/json",
|
380
|
+
"Host" => "gateway.watsonplatform.net"
|
381
|
+
}
|
382
|
+
).to_return(status: 200, body: response.to_json, headers: { "Content-Type" => "application/json" })
|
383
|
+
service_response = service.get_object_metadata(
|
384
|
+
collection_id: "collid",
|
385
|
+
object: "object"
|
386
|
+
)
|
387
|
+
assert_equal(response, service_response.result)
|
388
|
+
end
|
389
|
+
|
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")
|
392
|
+
.with(
|
393
|
+
headers: {
|
394
|
+
"Accept" => "application/json",
|
395
|
+
"Host" => "gateway.watsonplatform.net"
|
396
|
+
}
|
397
|
+
).to_return(status: 200, body: {}.to_json, headers: { "Content-Type" => "application/json" })
|
398
|
+
service_response = service.delete_object(
|
399
|
+
collection_id: "collid",
|
400
|
+
object: "object"
|
401
|
+
)
|
402
|
+
assert_nil(service_response)
|
403
|
+
end
|
335
404
|
end
|