ibm_watson 0.20.1 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -60
- data/lib/ibm_watson.rb +0 -2
- data/lib/ibm_watson/assistant_v1.rb +82 -60
- data/lib/ibm_watson/assistant_v2.rb +8 -12
- data/lib/ibm_watson/compare_comply_v1.rb +21 -18
- data/lib/ibm_watson/discovery_v1.rb +107 -55
- data/lib/ibm_watson/language_translator_v3.rb +21 -23
- data/lib/ibm_watson/natural_language_classifier_v1.rb +15 -24
- data/lib/ibm_watson/natural_language_understanding_v1.rb +8 -12
- data/lib/ibm_watson/personality_insights_v3.rb +12 -24
- data/lib/ibm_watson/speech_to_text_v1.rb +90 -54
- data/lib/ibm_watson/text_to_speech_v1.rb +38 -32
- data/lib/ibm_watson/tone_analyzer_v3.rb +13 -24
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +37 -25
- data/test/integration/test_assistant_v1.rb +8 -4
- data/test/integration/test_assistant_v2.rb +6 -1
- data/test/integration/test_compare_comply_v1.rb +6 -2
- data/test/integration/test_discovery_v1.rb +4 -1
- data/test/integration/test_language_translator_v3.rb +4 -16
- data/test/integration/test_natural_language_classifier_v1.rb +4 -1
- data/test/integration/test_natural_language_understanding_v1.rb +4 -1
- data/test/integration/test_personality_insights_v3.rb +5 -2
- data/test/integration/test_speech_to_text_v1.rb +9 -3
- data/test/integration/test_text_to_speech_v1.rb +5 -2
- data/test/integration/test_tone_analyzer_v3.rb +5 -2
- data/test/integration/test_visual_recognition_v3.rb +5 -2
- data/test/test_helper.rb +2 -0
- data/test/unit/test_assistant_v1.rb +269 -133
- data/test/unit/test_assistant_v2.rb +18 -9
- data/test/unit/test_compare_comply_v1.rb +72 -40
- data/test/unit/test_configure_http_client.rb +4 -2
- data/test/unit/test_discovery_v1.rb +297 -152
- data/test/unit/test_language_translator_v3.rb +52 -13
- data/test/unit/test_natural_language_classifier_v1.rb +10 -4
- data/test/unit/test_natural_language_understanding_v1.rb +25 -10
- data/test/unit/test_personality_insights_v3.rb +20 -8
- data/test/unit/test_speech_to_text_v1.rb +84 -21
- data/test/unit/test_text_to_speech_v1.rb +30 -5
- data/test/unit/test_tone_analyzer_v3.rb +30 -12
- data/test/unit/test_vcap_using_personality_insights.rb +12 -4
- data/test/unit/test_visual_recognition_v3.rb +37 -10
- metadata +8 -8
- data/test/unit/test_watson_service.rb +0 -59
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# (C) Copyright IBM Corp. 2019.
|
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.
|
@@ -82,21 +82,14 @@ module IBMWatson
|
|
82
82
|
defaults = {}
|
83
83
|
defaults[:version] = nil
|
84
84
|
defaults[:url] = "https://gateway.watsonplatform.net/assistant/api"
|
85
|
-
defaults[:
|
86
|
-
defaults[:password] = nil
|
87
|
-
defaults[:iam_apikey] = nil
|
88
|
-
defaults[:iam_access_token] = nil
|
89
|
-
defaults[:iam_url] = nil
|
90
|
-
defaults[:iam_client_id] = nil
|
91
|
-
defaults[:iam_client_secret] = nil
|
92
|
-
defaults[:icp4d_access_token] = nil
|
93
|
-
defaults[:icp4d_url] = nil
|
85
|
+
defaults[:authenticator] = nil
|
94
86
|
defaults[:authentication_type] = nil
|
95
87
|
args = defaults.merge(args)
|
96
|
-
args[:
|
88
|
+
@version = args[:version]
|
89
|
+
raise ArgumentError.new("version must be provided") if @version.nil?
|
90
|
+
|
97
91
|
args[:display_name] = "Assistant"
|
98
92
|
super
|
99
|
-
@version = args[:version]
|
100
93
|
end
|
101
94
|
|
102
95
|
#########################
|
@@ -129,6 +122,7 @@ module IBMWatson
|
|
129
122
|
|
130
123
|
method_url = "/v2/assistants/%s/sessions" % [ERB::Util.url_encode(assistant_id)]
|
131
124
|
|
125
|
+
headers = authenticator.authenticate(headers)
|
132
126
|
response = request(
|
133
127
|
method: "POST",
|
134
128
|
url: method_url,
|
@@ -167,6 +161,7 @@ module IBMWatson
|
|
167
161
|
|
168
162
|
method_url = "/v2/assistants/%s/sessions/%s" % [ERB::Util.url_encode(assistant_id), ERB::Util.url_encode(session_id)]
|
169
163
|
|
164
|
+
headers = authenticator.authenticate(headers)
|
170
165
|
request(
|
171
166
|
method: "DELETE",
|
172
167
|
url: method_url,
|
@@ -219,6 +214,7 @@ module IBMWatson
|
|
219
214
|
|
220
215
|
method_url = "/v2/assistants/%s/sessions/%s/message" % [ERB::Util.url_encode(assistant_id), ERB::Util.url_encode(session_id)]
|
221
216
|
|
217
|
+
headers = authenticator.authenticate(headers)
|
222
218
|
response = request(
|
223
219
|
method: "POST",
|
224
220
|
url: method_url,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# (C) Copyright IBM Corp. 2019.
|
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.
|
@@ -81,21 +81,14 @@ module IBMWatson
|
|
81
81
|
defaults = {}
|
82
82
|
defaults[:version] = nil
|
83
83
|
defaults[:url] = "https://gateway.watsonplatform.net/compare-comply/api"
|
84
|
-
defaults[:
|
85
|
-
defaults[:password] = nil
|
86
|
-
defaults[:iam_apikey] = nil
|
87
|
-
defaults[:iam_access_token] = nil
|
88
|
-
defaults[:iam_url] = nil
|
89
|
-
defaults[:iam_client_id] = nil
|
90
|
-
defaults[:iam_client_secret] = nil
|
91
|
-
defaults[:icp4d_access_token] = nil
|
92
|
-
defaults[:icp4d_url] = nil
|
84
|
+
defaults[:authenticator] = nil
|
93
85
|
defaults[:authentication_type] = nil
|
94
86
|
args = defaults.merge(args)
|
95
|
-
args[:
|
87
|
+
@version = args[:version]
|
88
|
+
raise ArgumentError.new("version must be provided") if @version.nil?
|
89
|
+
|
96
90
|
args[:display_name] = "Compare Comply"
|
97
91
|
super
|
98
|
-
@version = args[:version]
|
99
92
|
end
|
100
93
|
|
101
94
|
#########################
|
@@ -103,18 +96,17 @@ module IBMWatson
|
|
103
96
|
#########################
|
104
97
|
|
105
98
|
##
|
106
|
-
# @!method convert_to_html(file:,
|
99
|
+
# @!method convert_to_html(file:, file_content_type: nil, model: nil)
|
107
100
|
# Convert document to HTML.
|
108
101
|
# Converts a document to HTML.
|
109
102
|
# @param file [File] The document to convert.
|
110
|
-
# @param filename [String] The filename for file.
|
111
103
|
# @param file_content_type [String] The content type of file.
|
112
104
|
# @param model [String] The analysis model to be used by the service. For the **Element classification**
|
113
105
|
# and **Compare two documents** methods, the default is `contracts`. For the
|
114
106
|
# **Extract tables** method, the default is `tables`. These defaults apply to the
|
115
107
|
# standalone methods as well as to the methods' use in batch-processing requests.
|
116
108
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
117
|
-
def convert_to_html(file:,
|
109
|
+
def convert_to_html(file:, file_content_type: nil, model: nil)
|
118
110
|
raise ArgumentError.new("file must be provided") if file.nil?
|
119
111
|
|
120
112
|
headers = {
|
@@ -132,11 +124,11 @@ module IBMWatson
|
|
132
124
|
unless file.instance_of?(StringIO) || file.instance_of?(File)
|
133
125
|
file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
|
134
126
|
end
|
135
|
-
|
136
|
-
form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename)
|
127
|
+
form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: file.respond_to?(:path) ? file.path : nil)
|
137
128
|
|
138
129
|
method_url = "/v1/html_conversion"
|
139
130
|
|
131
|
+
headers = authenticator.authenticate(headers)
|
140
132
|
response = request(
|
141
133
|
method: "POST",
|
142
134
|
url: method_url,
|
@@ -184,6 +176,7 @@ module IBMWatson
|
|
184
176
|
|
185
177
|
method_url = "/v1/element_classification"
|
186
178
|
|
179
|
+
headers = authenticator.authenticate(headers)
|
187
180
|
response = request(
|
188
181
|
method: "POST",
|
189
182
|
url: method_url,
|
@@ -231,6 +224,7 @@ module IBMWatson
|
|
231
224
|
|
232
225
|
method_url = "/v1/tables"
|
233
226
|
|
227
|
+
headers = authenticator.authenticate(headers)
|
234
228
|
response = request(
|
235
229
|
method: "POST",
|
236
230
|
url: method_url,
|
@@ -291,6 +285,7 @@ module IBMWatson
|
|
291
285
|
|
292
286
|
method_url = "/v1/comparison"
|
293
287
|
|
288
|
+
headers = authenticator.authenticate(headers)
|
294
289
|
response = request(
|
295
290
|
method: "POST",
|
296
291
|
url: method_url,
|
@@ -337,6 +332,7 @@ module IBMWatson
|
|
337
332
|
|
338
333
|
method_url = "/v1/feedback"
|
339
334
|
|
335
|
+
headers = authenticator.authenticate(headers)
|
340
336
|
response = request(
|
341
337
|
method: "POST",
|
342
338
|
url: method_url,
|
@@ -364,7 +360,7 @@ module IBMWatson
|
|
364
360
|
# specified `model_id`. The only permitted value is `contracts`.
|
365
361
|
# @param model_version [String] An optional string that filters the output to include only feedback with the
|
366
362
|
# specified `model_version`.
|
367
|
-
# @param category_removed [String] An optional string in the form of a comma-separated list of categories. If
|
363
|
+
# @param category_removed [String] An optional string in the form of a comma-separated list of categories. If it is
|
368
364
|
# specified, the service filters the output to include only feedback that has at
|
369
365
|
# least one category from the list removed.
|
370
366
|
# @param category_added [String] An optional string in the form of a comma-separated list of categories. If this is
|
@@ -422,6 +418,7 @@ module IBMWatson
|
|
422
418
|
|
423
419
|
method_url = "/v1/feedback"
|
424
420
|
|
421
|
+
headers = authenticator.authenticate(headers)
|
425
422
|
response = request(
|
426
423
|
method: "GET",
|
427
424
|
url: method_url,
|
@@ -457,6 +454,7 @@ module IBMWatson
|
|
457
454
|
|
458
455
|
method_url = "/v1/feedback/%s" % [ERB::Util.url_encode(feedback_id)]
|
459
456
|
|
457
|
+
headers = authenticator.authenticate(headers)
|
460
458
|
response = request(
|
461
459
|
method: "GET",
|
462
460
|
url: method_url,
|
@@ -492,6 +490,7 @@ module IBMWatson
|
|
492
490
|
|
493
491
|
method_url = "/v1/feedback/%s" % [ERB::Util.url_encode(feedback_id)]
|
494
492
|
|
493
|
+
headers = authenticator.authenticate(headers)
|
495
494
|
response = request(
|
496
495
|
method: "DELETE",
|
497
496
|
url: method_url,
|
@@ -583,6 +582,7 @@ module IBMWatson
|
|
583
582
|
|
584
583
|
method_url = "/v1/batches"
|
585
584
|
|
585
|
+
headers = authenticator.authenticate(headers)
|
586
586
|
response = request(
|
587
587
|
method: "POST",
|
588
588
|
url: method_url,
|
@@ -611,6 +611,7 @@ module IBMWatson
|
|
611
611
|
|
612
612
|
method_url = "/v1/batches"
|
613
613
|
|
614
|
+
headers = authenticator.authenticate(headers)
|
614
615
|
response = request(
|
615
616
|
method: "GET",
|
616
617
|
url: method_url,
|
@@ -641,6 +642,7 @@ module IBMWatson
|
|
641
642
|
|
642
643
|
method_url = "/v1/batches/%s" % [ERB::Util.url_encode(batch_id)]
|
643
644
|
|
645
|
+
headers = authenticator.authenticate(headers)
|
644
646
|
response = request(
|
645
647
|
method: "GET",
|
646
648
|
url: method_url,
|
@@ -681,6 +683,7 @@ module IBMWatson
|
|
681
683
|
|
682
684
|
method_url = "/v1/batches/%s" % [ERB::Util.url_encode(batch_id)]
|
683
685
|
|
686
|
+
headers = authenticator.authenticate(headers)
|
684
687
|
response = request(
|
685
688
|
method: "PUT",
|
686
689
|
url: method_url,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright
|
3
|
+
# (C) Copyright IBM Corp. 2019.
|
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.
|
@@ -84,21 +84,14 @@ module IBMWatson
|
|
84
84
|
defaults = {}
|
85
85
|
defaults[:version] = nil
|
86
86
|
defaults[:url] = "https://gateway.watsonplatform.net/discovery/api"
|
87
|
-
defaults[:
|
88
|
-
defaults[:password] = nil
|
89
|
-
defaults[:iam_apikey] = nil
|
90
|
-
defaults[:iam_access_token] = nil
|
91
|
-
defaults[:iam_url] = nil
|
92
|
-
defaults[:iam_client_id] = nil
|
93
|
-
defaults[:iam_client_secret] = nil
|
94
|
-
defaults[:icp4d_access_token] = nil
|
95
|
-
defaults[:icp4d_url] = nil
|
87
|
+
defaults[:authenticator] = nil
|
96
88
|
defaults[:authentication_type] = nil
|
97
89
|
args = defaults.merge(args)
|
98
|
-
args[:
|
90
|
+
@version = args[:version]
|
91
|
+
raise ArgumentError.new("version must be provided") if @version.nil?
|
92
|
+
|
99
93
|
args[:display_name] = "Discovery"
|
100
94
|
super
|
101
|
-
@version = args[:version]
|
102
95
|
end
|
103
96
|
|
104
97
|
#########################
|
@@ -138,6 +131,7 @@ module IBMWatson
|
|
138
131
|
|
139
132
|
method_url = "/v1/environments"
|
140
133
|
|
134
|
+
headers = authenticator.authenticate(headers)
|
141
135
|
response = request(
|
142
136
|
method: "POST",
|
143
137
|
url: method_url,
|
@@ -168,6 +162,7 @@ module IBMWatson
|
|
168
162
|
|
169
163
|
method_url = "/v1/environments"
|
170
164
|
|
165
|
+
headers = authenticator.authenticate(headers)
|
171
166
|
response = request(
|
172
167
|
method: "GET",
|
173
168
|
url: method_url,
|
@@ -197,6 +192,7 @@ module IBMWatson
|
|
197
192
|
|
198
193
|
method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
|
199
194
|
|
195
|
+
headers = authenticator.authenticate(headers)
|
200
196
|
response = request(
|
201
197
|
method: "GET",
|
202
198
|
url: method_url,
|
@@ -239,6 +235,7 @@ module IBMWatson
|
|
239
235
|
|
240
236
|
method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
|
241
237
|
|
238
|
+
headers = authenticator.authenticate(headers)
|
242
239
|
response = request(
|
243
240
|
method: "PUT",
|
244
241
|
url: method_url,
|
@@ -269,6 +266,7 @@ module IBMWatson
|
|
269
266
|
|
270
267
|
method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)]
|
271
268
|
|
269
|
+
headers = authenticator.authenticate(headers)
|
272
270
|
response = request(
|
273
271
|
method: "DELETE",
|
274
272
|
url: method_url,
|
@@ -304,6 +302,7 @@ module IBMWatson
|
|
304
302
|
|
305
303
|
method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)]
|
306
304
|
|
305
|
+
headers = authenticator.authenticate(headers)
|
307
306
|
response = request(
|
308
307
|
method: "GET",
|
309
308
|
url: method_url,
|
@@ -367,6 +366,7 @@ module IBMWatson
|
|
367
366
|
|
368
367
|
method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
|
369
368
|
|
369
|
+
headers = authenticator.authenticate(headers)
|
370
370
|
response = request(
|
371
371
|
method: "POST",
|
372
372
|
url: method_url,
|
@@ -400,6 +400,7 @@ module IBMWatson
|
|
400
400
|
|
401
401
|
method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)]
|
402
402
|
|
403
|
+
headers = authenticator.authenticate(headers)
|
403
404
|
response = request(
|
404
405
|
method: "GET",
|
405
406
|
url: method_url,
|
@@ -432,6 +433,7 @@ module IBMWatson
|
|
432
433
|
|
433
434
|
method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
|
434
435
|
|
436
|
+
headers = authenticator.authenticate(headers)
|
435
437
|
response = request(
|
436
438
|
method: "GET",
|
437
439
|
url: method_url,
|
@@ -492,6 +494,7 @@ module IBMWatson
|
|
492
494
|
|
493
495
|
method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
|
494
496
|
|
497
|
+
headers = authenticator.authenticate(headers)
|
495
498
|
response = request(
|
496
499
|
method: "PUT",
|
497
500
|
url: method_url,
|
@@ -531,6 +534,7 @@ module IBMWatson
|
|
531
534
|
|
532
535
|
method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)]
|
533
536
|
|
537
|
+
headers = authenticator.authenticate(headers)
|
534
538
|
response = request(
|
535
539
|
method: "DELETE",
|
536
540
|
url: method_url,
|
@@ -558,9 +562,8 @@ module IBMWatson
|
|
558
562
|
# the provided configuration is used to process the document. If the
|
559
563
|
# **configuration_id** is also provided (both are present at the same time), then
|
560
564
|
# request is rejected. The maximum supported configuration size is 1 MB.
|
561
|
-
# Configuration parts larger than 1 MB are rejected.
|
562
|
-
#
|
563
|
-
# configuration.
|
565
|
+
# Configuration parts larger than 1 MB are rejected. See the `GET
|
566
|
+
# /configurations/{configuration_id}` operation for an example configuration.
|
564
567
|
# @param file [File] The content of the document to ingest. The maximum supported file size when adding
|
565
568
|
# a file to a collection is 50 megabytes, the maximum supported file size when
|
566
569
|
# testing a confiruration is 1 megabyte. Files larger than the supported size are
|
@@ -568,10 +571,9 @@ module IBMWatson
|
|
568
571
|
# @param filename [String] The filename for file.
|
569
572
|
# @param file_content_type [String] The content type of file.
|
570
573
|
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
571
|
-
# are rejected.
|
572
|
-
#
|
573
|
-
#
|
574
|
-
# \"Subject\": \"Apples\"
|
574
|
+
# are rejected. Example: ``` {
|
575
|
+
# "Creator": "Johnny Appleseed",
|
576
|
+
# "Subject": "Apples"
|
575
577
|
# } ```.
|
576
578
|
# @param step [String] Specify to only run the input document through the given step instead of running
|
577
579
|
# the input document through the entire ingestion workflow. Valid values are
|
@@ -610,6 +612,7 @@ module IBMWatson
|
|
610
612
|
|
611
613
|
method_url = "/v1/environments/%s/preview" % [ERB::Util.url_encode(environment_id)]
|
612
614
|
|
615
|
+
headers = authenticator.authenticate(headers)
|
613
616
|
response = request(
|
614
617
|
method: "POST",
|
615
618
|
url: method_url,
|
@@ -657,6 +660,7 @@ module IBMWatson
|
|
657
660
|
|
658
661
|
method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
|
659
662
|
|
663
|
+
headers = authenticator.authenticate(headers)
|
660
664
|
response = request(
|
661
665
|
method: "POST",
|
662
666
|
url: method_url,
|
@@ -690,6 +694,7 @@ module IBMWatson
|
|
690
694
|
|
691
695
|
method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)]
|
692
696
|
|
697
|
+
headers = authenticator.authenticate(headers)
|
693
698
|
response = request(
|
694
699
|
method: "GET",
|
695
700
|
url: method_url,
|
@@ -722,6 +727,7 @@ module IBMWatson
|
|
722
727
|
|
723
728
|
method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
724
729
|
|
730
|
+
headers = authenticator.authenticate(headers)
|
725
731
|
response = request(
|
726
732
|
method: "GET",
|
727
733
|
url: method_url,
|
@@ -763,6 +769,7 @@ module IBMWatson
|
|
763
769
|
|
764
770
|
method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
765
771
|
|
772
|
+
headers = authenticator.authenticate(headers)
|
766
773
|
response = request(
|
767
774
|
method: "PUT",
|
768
775
|
url: method_url,
|
@@ -796,6 +803,7 @@ module IBMWatson
|
|
796
803
|
|
797
804
|
method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
798
805
|
|
806
|
+
headers = authenticator.authenticate(headers)
|
799
807
|
response = request(
|
800
808
|
method: "DELETE",
|
801
809
|
url: method_url,
|
@@ -829,6 +837,7 @@ module IBMWatson
|
|
829
837
|
|
830
838
|
method_url = "/v1/environments/%s/collections/%s/fields" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
831
839
|
|
840
|
+
headers = authenticator.authenticate(headers)
|
832
841
|
response = request(
|
833
842
|
method: "GET",
|
834
843
|
url: method_url,
|
@@ -866,6 +875,7 @@ module IBMWatson
|
|
866
875
|
|
867
876
|
method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
868
877
|
|
878
|
+
headers = authenticator.authenticate(headers)
|
869
879
|
response = request(
|
870
880
|
method: "GET",
|
871
881
|
url: method_url,
|
@@ -880,8 +890,8 @@ module IBMWatson
|
|
880
890
|
# @!method create_expansions(environment_id:, collection_id:, expansions:)
|
881
891
|
# Create or update expansion list.
|
882
892
|
# Create or replace the Expansion list for this collection. The maximum number of
|
883
|
-
# expanded terms per collection is `500`.
|
884
|
-
#
|
893
|
+
# expanded terms per collection is `500`. The current expansion list is replaced
|
894
|
+
# with the uploaded content.
|
885
895
|
# @param environment_id [String] The ID of the environment.
|
886
896
|
# @param collection_id [String] The ID of the collection.
|
887
897
|
# @param expansions [Array[Expansion]] An array of query expansion definitions.
|
@@ -923,6 +933,7 @@ module IBMWatson
|
|
923
933
|
|
924
934
|
method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
925
935
|
|
936
|
+
headers = authenticator.authenticate(headers)
|
926
937
|
response = request(
|
927
938
|
method: "POST",
|
928
939
|
url: method_url,
|
@@ -958,6 +969,7 @@ module IBMWatson
|
|
958
969
|
|
959
970
|
method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
960
971
|
|
972
|
+
headers = authenticator.authenticate(headers)
|
961
973
|
request(
|
962
974
|
method: "DELETE",
|
963
975
|
url: method_url,
|
@@ -992,6 +1004,7 @@ module IBMWatson
|
|
992
1004
|
|
993
1005
|
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
994
1006
|
|
1007
|
+
headers = authenticator.authenticate(headers)
|
995
1008
|
response = request(
|
996
1009
|
method: "GET",
|
997
1010
|
url: method_url,
|
@@ -1032,6 +1045,7 @@ module IBMWatson
|
|
1032
1045
|
|
1033
1046
|
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1034
1047
|
|
1048
|
+
headers = authenticator.authenticate(headers)
|
1035
1049
|
response = request(
|
1036
1050
|
method: "POST",
|
1037
1051
|
url: method_url,
|
@@ -1066,6 +1080,7 @@ module IBMWatson
|
|
1066
1080
|
|
1067
1081
|
method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1068
1082
|
|
1083
|
+
headers = authenticator.authenticate(headers)
|
1069
1084
|
request(
|
1070
1085
|
method: "DELETE",
|
1071
1086
|
url: method_url,
|
@@ -1099,6 +1114,7 @@ module IBMWatson
|
|
1099
1114
|
|
1100
1115
|
method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1101
1116
|
|
1117
|
+
headers = authenticator.authenticate(headers)
|
1102
1118
|
response = request(
|
1103
1119
|
method: "GET",
|
1104
1120
|
url: method_url,
|
@@ -1144,6 +1160,7 @@ module IBMWatson
|
|
1144
1160
|
|
1145
1161
|
method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1146
1162
|
|
1163
|
+
headers = authenticator.authenticate(headers)
|
1147
1164
|
response = request(
|
1148
1165
|
method: "POST",
|
1149
1166
|
url: method_url,
|
@@ -1179,6 +1196,7 @@ module IBMWatson
|
|
1179
1196
|
|
1180
1197
|
method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1181
1198
|
|
1199
|
+
headers = authenticator.authenticate(headers)
|
1182
1200
|
request(
|
1183
1201
|
method: "DELETE",
|
1184
1202
|
url: method_url,
|
@@ -1232,10 +1250,9 @@ module IBMWatson
|
|
1232
1250
|
# @param filename [String] The filename for file.
|
1233
1251
|
# @param file_content_type [String] The content type of file.
|
1234
1252
|
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
1235
|
-
# are rejected.
|
1236
|
-
#
|
1237
|
-
#
|
1238
|
-
# \"Subject\": \"Apples\"
|
1253
|
+
# are rejected. Example: ``` {
|
1254
|
+
# "Creator": "Johnny Appleseed",
|
1255
|
+
# "Subject": "Apples"
|
1239
1256
|
# } ```.
|
1240
1257
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1241
1258
|
def add_document(environment_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
|
@@ -1266,6 +1283,7 @@ module IBMWatson
|
|
1266
1283
|
|
1267
1284
|
method_url = "/v1/environments/%s/collections/%s/documents" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1268
1285
|
|
1286
|
+
headers = authenticator.authenticate(headers)
|
1269
1287
|
response = request(
|
1270
1288
|
method: "POST",
|
1271
1289
|
url: method_url,
|
@@ -1306,6 +1324,7 @@ module IBMWatson
|
|
1306
1324
|
|
1307
1325
|
method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)]
|
1308
1326
|
|
1327
|
+
headers = authenticator.authenticate(headers)
|
1309
1328
|
response = request(
|
1310
1329
|
method: "GET",
|
1311
1330
|
url: method_url,
|
@@ -1334,10 +1353,9 @@ module IBMWatson
|
|
1334
1353
|
# @param filename [String] The filename for file.
|
1335
1354
|
# @param file_content_type [String] The content type of file.
|
1336
1355
|
# @param metadata [String] The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB
|
1337
|
-
# are rejected.
|
1338
|
-
#
|
1339
|
-
#
|
1340
|
-
# \"Subject\": \"Apples\"
|
1356
|
+
# are rejected. Example: ``` {
|
1357
|
+
# "Creator": "Johnny Appleseed",
|
1358
|
+
# "Subject": "Apples"
|
1341
1359
|
# } ```.
|
1342
1360
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1343
1361
|
def update_document(environment_id:, collection_id:, document_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil)
|
@@ -1370,6 +1388,7 @@ module IBMWatson
|
|
1370
1388
|
|
1371
1389
|
method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)]
|
1372
1390
|
|
1391
|
+
headers = authenticator.authenticate(headers)
|
1373
1392
|
response = request(
|
1374
1393
|
method: "POST",
|
1375
1394
|
url: method_url,
|
@@ -1409,6 +1428,7 @@ module IBMWatson
|
|
1409
1428
|
|
1410
1429
|
method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)]
|
1411
1430
|
|
1431
|
+
headers = authenticator.authenticate(headers)
|
1412
1432
|
response = request(
|
1413
1433
|
method: "DELETE",
|
1414
1434
|
url: method_url,
|
@@ -1423,7 +1443,7 @@ module IBMWatson
|
|
1423
1443
|
#########################
|
1424
1444
|
|
1425
1445
|
##
|
1426
|
-
# @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil,
|
1446
|
+
# @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
|
1427
1447
|
# Query a collection.
|
1428
1448
|
# By using this method, you can construct long queries. For details, see the
|
1429
1449
|
# [Discovery
|
@@ -1443,7 +1463,7 @@ module IBMWatson
|
|
1443
1463
|
# filters. Useful for applications to build lists, tables, and time series. For a
|
1444
1464
|
# full list of possible aggregations, see the Query reference.
|
1445
1465
|
# @param count [Fixnum] Number of results to return.
|
1446
|
-
# @param
|
1466
|
+
# @param _return [String] A comma-separated list of the portion of the document hierarchy to return.
|
1447
1467
|
# @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
|
1448
1468
|
# number of results that are returned is 10 and the offset is 8, it returns the last
|
1449
1469
|
# two results.
|
@@ -1484,15 +1504,15 @@ module IBMWatson
|
|
1484
1504
|
# a **number** type field is specified, returned results are biased towards higher
|
1485
1505
|
# field values. This parameter cannot be used in the same query as the **sort**
|
1486
1506
|
# parameter.
|
1487
|
-
# @param
|
1507
|
+
# @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
|
1488
1508
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1489
|
-
def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil,
|
1509
|
+
def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
|
1490
1510
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1491
1511
|
|
1492
1512
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1493
1513
|
|
1494
1514
|
headers = {
|
1495
|
-
"X-Watson-Logging-Opt-Out" =>
|
1515
|
+
"X-Watson-Logging-Opt-Out" => x_watson_logging_opt_out
|
1496
1516
|
}
|
1497
1517
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query")
|
1498
1518
|
headers.merge!(sdk_headers)
|
@@ -1508,7 +1528,7 @@ module IBMWatson
|
|
1508
1528
|
"passages" => passages,
|
1509
1529
|
"aggregation" => aggregation,
|
1510
1530
|
"count" => count,
|
1511
|
-
"return" =>
|
1531
|
+
"return" => _return,
|
1512
1532
|
"offset" => offset,
|
1513
1533
|
"sort" => sort,
|
1514
1534
|
"highlight" => highlight,
|
@@ -1526,6 +1546,7 @@ module IBMWatson
|
|
1526
1546
|
|
1527
1547
|
method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1528
1548
|
|
1549
|
+
headers = authenticator.authenticate(headers)
|
1529
1550
|
response = request(
|
1530
1551
|
method: "POST",
|
1531
1552
|
url: method_url,
|
@@ -1538,7 +1559,7 @@ module IBMWatson
|
|
1538
1559
|
end
|
1539
1560
|
|
1540
1561
|
##
|
1541
|
-
# @!method query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil,
|
1562
|
+
# @!method query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1542
1563
|
# Query system notices.
|
1543
1564
|
# Queries for notices (errors or warnings) that might have been generated by the
|
1544
1565
|
# system. Notices are generated when ingesting documents and performing relevance
|
@@ -1560,7 +1581,7 @@ module IBMWatson
|
|
1560
1581
|
# full list of possible aggregations, see the Query reference.
|
1561
1582
|
# @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
|
1562
1583
|
# together in any one query is **10000**.
|
1563
|
-
# @param
|
1584
|
+
# @param _return [Array[String]] A comma-separated list of the portion of the document hierarchy to return.
|
1564
1585
|
# @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
|
1565
1586
|
# number of results that are returned is 10 and the offset is 8, it returns the last
|
1566
1587
|
# two results. The maximum for the **count** and **offset** values together in any
|
@@ -1590,7 +1611,7 @@ module IBMWatson
|
|
1590
1611
|
# identify similar documents. If not specified, the entire document is used for
|
1591
1612
|
# comparison.
|
1592
1613
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1593
|
-
def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil,
|
1614
|
+
def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1594
1615
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1595
1616
|
|
1596
1617
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -1608,7 +1629,7 @@ module IBMWatson
|
|
1608
1629
|
"passages" => passages,
|
1609
1630
|
"aggregation" => aggregation,
|
1610
1631
|
"count" => count,
|
1611
|
-
"return" =>
|
1632
|
+
"return" => _return.to_a,
|
1612
1633
|
"offset" => offset,
|
1613
1634
|
"sort" => sort.to_a,
|
1614
1635
|
"highlight" => highlight,
|
@@ -1623,6 +1644,7 @@ module IBMWatson
|
|
1623
1644
|
|
1624
1645
|
method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1625
1646
|
|
1647
|
+
headers = authenticator.authenticate(headers)
|
1626
1648
|
response = request(
|
1627
1649
|
method: "GET",
|
1628
1650
|
url: method_url,
|
@@ -1634,7 +1656,7 @@ module IBMWatson
|
|
1634
1656
|
end
|
1635
1657
|
|
1636
1658
|
##
|
1637
|
-
# @!method federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil,
|
1659
|
+
# @!method federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
|
1638
1660
|
# Query multiple collections.
|
1639
1661
|
# By using this method, you can construct long queries that search multiple
|
1640
1662
|
# collection. For details, see the [Discovery
|
@@ -1653,7 +1675,7 @@ module IBMWatson
|
|
1653
1675
|
# filters. Useful for applications to build lists, tables, and time series. For a
|
1654
1676
|
# full list of possible aggregations, see the Query reference.
|
1655
1677
|
# @param count [Fixnum] Number of results to return.
|
1656
|
-
# @param
|
1678
|
+
# @param _return [String] A comma-separated list of the portion of the document hierarchy to return.
|
1657
1679
|
# @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
|
1658
1680
|
# number of results that are returned is 10 and the offset is 8, it returns the last
|
1659
1681
|
# two results.
|
@@ -1694,13 +1716,13 @@ module IBMWatson
|
|
1694
1716
|
# a **number** type field is specified, returned results are biased towards higher
|
1695
1717
|
# field values. This parameter cannot be used in the same query as the **sort**
|
1696
1718
|
# parameter.
|
1697
|
-
# @param
|
1719
|
+
# @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
|
1698
1720
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1699
|
-
def federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil,
|
1721
|
+
def federated_query(environment_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, collection_ids: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
|
1700
1722
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1701
1723
|
|
1702
1724
|
headers = {
|
1703
|
-
"X-Watson-Logging-Opt-Out" =>
|
1725
|
+
"X-Watson-Logging-Opt-Out" => x_watson_logging_opt_out
|
1704
1726
|
}
|
1705
1727
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query")
|
1706
1728
|
headers.merge!(sdk_headers)
|
@@ -1716,7 +1738,7 @@ module IBMWatson
|
|
1716
1738
|
"passages" => passages,
|
1717
1739
|
"aggregation" => aggregation,
|
1718
1740
|
"count" => count,
|
1719
|
-
"return" =>
|
1741
|
+
"return" => _return,
|
1720
1742
|
"offset" => offset,
|
1721
1743
|
"sort" => sort,
|
1722
1744
|
"highlight" => highlight,
|
@@ -1734,6 +1756,7 @@ module IBMWatson
|
|
1734
1756
|
|
1735
1757
|
method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)]
|
1736
1758
|
|
1759
|
+
headers = authenticator.authenticate(headers)
|
1737
1760
|
response = request(
|
1738
1761
|
method: "POST",
|
1739
1762
|
url: method_url,
|
@@ -1746,7 +1769,7 @@ module IBMWatson
|
|
1746
1769
|
end
|
1747
1770
|
|
1748
1771
|
##
|
1749
|
-
# @!method federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil,
|
1772
|
+
# @!method federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1750
1773
|
# Query multiple collection system notices.
|
1751
1774
|
# Queries for notices (errors or warnings) that might have been generated by the
|
1752
1775
|
# system. Notices are generated when ingesting documents and performing relevance
|
@@ -1767,7 +1790,7 @@ module IBMWatson
|
|
1767
1790
|
# full list of possible aggregations, see the Query reference.
|
1768
1791
|
# @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
|
1769
1792
|
# together in any one query is **10000**.
|
1770
|
-
# @param
|
1793
|
+
# @param _return [Array[String]] A comma-separated list of the portion of the document hierarchy to return.
|
1771
1794
|
# @param offset [Fixnum] The number of query results to skip at the beginning. For example, if the total
|
1772
1795
|
# number of results that are returned is 10 and the offset is 8, it returns the last
|
1773
1796
|
# two results. The maximum for the **count** and **offset** values together in any
|
@@ -1792,7 +1815,7 @@ module IBMWatson
|
|
1792
1815
|
# identify similar documents. If not specified, the entire document is used for
|
1793
1816
|
# comparison.
|
1794
1817
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1795
|
-
def federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil,
|
1818
|
+
def federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil)
|
1796
1819
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1797
1820
|
|
1798
1821
|
raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
|
@@ -1810,7 +1833,7 @@ module IBMWatson
|
|
1810
1833
|
"natural_language_query" => natural_language_query,
|
1811
1834
|
"aggregation" => aggregation,
|
1812
1835
|
"count" => count,
|
1813
|
-
"return" =>
|
1836
|
+
"return" => _return.to_a,
|
1814
1837
|
"offset" => offset,
|
1815
1838
|
"sort" => sort.to_a,
|
1816
1839
|
"highlight" => highlight,
|
@@ -1822,6 +1845,7 @@ module IBMWatson
|
|
1822
1845
|
|
1823
1846
|
method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
|
1824
1847
|
|
1848
|
+
headers = authenticator.authenticate(headers)
|
1825
1849
|
response = request(
|
1826
1850
|
method: "GET",
|
1827
1851
|
url: method_url,
|
@@ -1874,6 +1898,7 @@ module IBMWatson
|
|
1874
1898
|
|
1875
1899
|
method_url = "/v1/environments/%s/collections/%s/query_entities" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1876
1900
|
|
1901
|
+
headers = authenticator.authenticate(headers)
|
1877
1902
|
response = request(
|
1878
1903
|
method: "POST",
|
1879
1904
|
url: method_url,
|
@@ -1931,6 +1956,7 @@ module IBMWatson
|
|
1931
1956
|
|
1932
1957
|
method_url = "/v1/environments/%s/collections/%s/query_relations" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1933
1958
|
|
1959
|
+
headers = authenticator.authenticate(headers)
|
1934
1960
|
response = request(
|
1935
1961
|
method: "POST",
|
1936
1962
|
url: method_url,
|
@@ -1968,6 +1994,7 @@ module IBMWatson
|
|
1968
1994
|
|
1969
1995
|
method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1970
1996
|
|
1997
|
+
headers = authenticator.authenticate(headers)
|
1971
1998
|
response = request(
|
1972
1999
|
method: "GET",
|
1973
2000
|
url: method_url,
|
@@ -2012,6 +2039,7 @@ module IBMWatson
|
|
2012
2039
|
|
2013
2040
|
method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
2014
2041
|
|
2042
|
+
headers = authenticator.authenticate(headers)
|
2015
2043
|
response = request(
|
2016
2044
|
method: "POST",
|
2017
2045
|
url: method_url,
|
@@ -2046,6 +2074,7 @@ module IBMWatson
|
|
2046
2074
|
|
2047
2075
|
method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
2048
2076
|
|
2077
|
+
headers = authenticator.authenticate(headers)
|
2049
2078
|
request(
|
2050
2079
|
method: "DELETE",
|
2051
2080
|
url: method_url,
|
@@ -2083,6 +2112,7 @@ module IBMWatson
|
|
2083
2112
|
|
2084
2113
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2085
2114
|
|
2115
|
+
headers = authenticator.authenticate(headers)
|
2086
2116
|
response = request(
|
2087
2117
|
method: "GET",
|
2088
2118
|
url: method_url,
|
@@ -2120,6 +2150,7 @@ module IBMWatson
|
|
2120
2150
|
|
2121
2151
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2122
2152
|
|
2153
|
+
headers = authenticator.authenticate(headers)
|
2123
2154
|
request(
|
2124
2155
|
method: "DELETE",
|
2125
2156
|
url: method_url,
|
@@ -2156,6 +2187,7 @@ module IBMWatson
|
|
2156
2187
|
|
2157
2188
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2158
2189
|
|
2190
|
+
headers = authenticator.authenticate(headers)
|
2159
2191
|
response = request(
|
2160
2192
|
method: "GET",
|
2161
2193
|
url: method_url,
|
@@ -2201,6 +2233,7 @@ module IBMWatson
|
|
2201
2233
|
|
2202
2234
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)]
|
2203
2235
|
|
2236
|
+
headers = authenticator.authenticate(headers)
|
2204
2237
|
response = request(
|
2205
2238
|
method: "POST",
|
2206
2239
|
url: method_url,
|
@@ -2241,6 +2274,7 @@ module IBMWatson
|
|
2241
2274
|
|
2242
2275
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)]
|
2243
2276
|
|
2277
|
+
headers = authenticator.authenticate(headers)
|
2244
2278
|
request(
|
2245
2279
|
method: "DELETE",
|
2246
2280
|
url: method_url,
|
@@ -2287,6 +2321,7 @@ module IBMWatson
|
|
2287
2321
|
|
2288
2322
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)]
|
2289
2323
|
|
2324
|
+
headers = authenticator.authenticate(headers)
|
2290
2325
|
response = request(
|
2291
2326
|
method: "PUT",
|
2292
2327
|
url: method_url,
|
@@ -2327,6 +2362,7 @@ module IBMWatson
|
|
2327
2362
|
|
2328
2363
|
method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)]
|
2329
2364
|
|
2365
|
+
headers = authenticator.authenticate(headers)
|
2330
2366
|
response = request(
|
2331
2367
|
method: "GET",
|
2332
2368
|
url: method_url,
|
@@ -2367,6 +2403,7 @@ module IBMWatson
|
|
2367
2403
|
|
2368
2404
|
method_url = "/v1/user_data"
|
2369
2405
|
|
2406
|
+
headers = authenticator.authenticate(headers)
|
2370
2407
|
request(
|
2371
2408
|
method: "DELETE",
|
2372
2409
|
url: method_url,
|
@@ -2385,7 +2422,7 @@ module IBMWatson
|
|
2385
2422
|
# Create event.
|
2386
2423
|
# The **Events** API can be used to create log entries that are associated with
|
2387
2424
|
# specific queries. For example, you can record which documents in the results set
|
2388
|
-
# were
|
2425
|
+
# were "clicked" by a user and when that click occured.
|
2389
2426
|
# @param type [String] The event type to be created.
|
2390
2427
|
# @param data [EventData] Query event data object.
|
2391
2428
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -2410,6 +2447,7 @@ module IBMWatson
|
|
2410
2447
|
|
2411
2448
|
method_url = "/v1/events"
|
2412
2449
|
|
2450
|
+
headers = authenticator.authenticate(headers)
|
2413
2451
|
response = request(
|
2414
2452
|
method: "POST",
|
2415
2453
|
url: method_url,
|
@@ -2459,6 +2497,7 @@ module IBMWatson
|
|
2459
2497
|
|
2460
2498
|
method_url = "/v1/logs"
|
2461
2499
|
|
2500
|
+
headers = authenticator.authenticate(headers)
|
2462
2501
|
response = request(
|
2463
2502
|
method: "GET",
|
2464
2503
|
url: method_url,
|
@@ -2495,6 +2534,7 @@ module IBMWatson
|
|
2495
2534
|
|
2496
2535
|
method_url = "/v1/metrics/number_of_queries"
|
2497
2536
|
|
2537
|
+
headers = authenticator.authenticate(headers)
|
2498
2538
|
response = request(
|
2499
2539
|
method: "GET",
|
2500
2540
|
url: method_url,
|
@@ -2509,7 +2549,7 @@ module IBMWatson
|
|
2509
2549
|
# @!method get_metrics_query_event(start_time: nil, end_time: nil, result_type: nil)
|
2510
2550
|
# Number of queries with an event over time.
|
2511
2551
|
# Total number of queries using the **natural_language_query** parameter that have a
|
2512
|
-
# corresponding
|
2552
|
+
# corresponding "click" event over a specified time window. This metric requires
|
2513
2553
|
# having integrated event tracking in your application using the **Events** API.
|
2514
2554
|
# @param start_time [Time] Metric is computed from data recorded after this timestamp; must be in
|
2515
2555
|
# `YYYY-MM-DDThh:mm:ssZ` format.
|
@@ -2532,6 +2572,7 @@ module IBMWatson
|
|
2532
2572
|
|
2533
2573
|
method_url = "/v1/metrics/number_of_queries_with_event"
|
2534
2574
|
|
2575
|
+
headers = authenticator.authenticate(headers)
|
2535
2576
|
response = request(
|
2536
2577
|
method: "GET",
|
2537
2578
|
url: method_url,
|
@@ -2568,6 +2609,7 @@ module IBMWatson
|
|
2568
2609
|
|
2569
2610
|
method_url = "/v1/metrics/number_of_queries_with_no_search_results"
|
2570
2611
|
|
2612
|
+
headers = authenticator.authenticate(headers)
|
2571
2613
|
response = request(
|
2572
2614
|
method: "GET",
|
2573
2615
|
url: method_url,
|
@@ -2582,9 +2624,8 @@ module IBMWatson
|
|
2582
2624
|
# @!method get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil)
|
2583
2625
|
# Percentage of queries with an associated event.
|
2584
2626
|
# The percentage of queries using the **natural_language_query** parameter that have
|
2585
|
-
# a corresponding
|
2586
|
-
#
|
2587
|
-
# API.
|
2627
|
+
# a corresponding "click" event over a specified time window. This metric requires
|
2628
|
+
# having integrated event tracking in your application using the **Events** API.
|
2588
2629
|
# @param start_time [Time] Metric is computed from data recorded after this timestamp; must be in
|
2589
2630
|
# `YYYY-MM-DDThh:mm:ssZ` format.
|
2590
2631
|
# @param end_time [Time] Metric is computed from data recorded before this timestamp; must be in
|
@@ -2606,6 +2647,7 @@ module IBMWatson
|
|
2606
2647
|
|
2607
2648
|
method_url = "/v1/metrics/event_rate"
|
2608
2649
|
|
2650
|
+
headers = authenticator.authenticate(headers)
|
2609
2651
|
response = request(
|
2610
2652
|
method: "GET",
|
2611
2653
|
url: method_url,
|
@@ -2620,7 +2662,7 @@ module IBMWatson
|
|
2620
2662
|
# @!method get_metrics_query_token_event(count: nil)
|
2621
2663
|
# Most frequent query tokens with an event.
|
2622
2664
|
# The most frequent query tokens parsed from the **natural_language_query**
|
2623
|
-
# parameter and their corresponding
|
2665
|
+
# parameter and their corresponding "click" event rate within the recording period
|
2624
2666
|
# (queries and events are stored for 30 days). A query token is an individual word
|
2625
2667
|
# or unigram within the query string.
|
2626
2668
|
# @param count [Fixnum] Number of results to return. The maximum for the **count** and **offset** values
|
@@ -2639,6 +2681,7 @@ module IBMWatson
|
|
2639
2681
|
|
2640
2682
|
method_url = "/v1/metrics/top_query_tokens_with_event_rate"
|
2641
2683
|
|
2684
|
+
headers = authenticator.authenticate(headers)
|
2642
2685
|
response = request(
|
2643
2686
|
method: "GET",
|
2644
2687
|
url: method_url,
|
@@ -2675,6 +2718,7 @@ module IBMWatson
|
|
2675
2718
|
|
2676
2719
|
method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
|
2677
2720
|
|
2721
|
+
headers = authenticator.authenticate(headers)
|
2678
2722
|
response = request(
|
2679
2723
|
method: "GET",
|
2680
2724
|
url: method_url,
|
@@ -2731,6 +2775,7 @@ module IBMWatson
|
|
2731
2775
|
|
2732
2776
|
method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)]
|
2733
2777
|
|
2778
|
+
headers = authenticator.authenticate(headers)
|
2734
2779
|
response = request(
|
2735
2780
|
method: "POST",
|
2736
2781
|
url: method_url,
|
@@ -2768,6 +2813,7 @@ module IBMWatson
|
|
2768
2813
|
|
2769
2814
|
method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
|
2770
2815
|
|
2816
|
+
headers = authenticator.authenticate(headers)
|
2771
2817
|
response = request(
|
2772
2818
|
method: "GET",
|
2773
2819
|
url: method_url,
|
@@ -2826,6 +2872,7 @@ module IBMWatson
|
|
2826
2872
|
|
2827
2873
|
method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
|
2828
2874
|
|
2875
|
+
headers = authenticator.authenticate(headers)
|
2829
2876
|
response = request(
|
2830
2877
|
method: "PUT",
|
2831
2878
|
url: method_url,
|
@@ -2860,6 +2907,7 @@ module IBMWatson
|
|
2860
2907
|
|
2861
2908
|
method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)]
|
2862
2909
|
|
2910
|
+
headers = authenticator.authenticate(headers)
|
2863
2911
|
response = request(
|
2864
2912
|
method: "DELETE",
|
2865
2913
|
url: method_url,
|
@@ -2893,6 +2941,7 @@ module IBMWatson
|
|
2893
2941
|
|
2894
2942
|
method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
|
2895
2943
|
|
2944
|
+
headers = authenticator.authenticate(headers)
|
2896
2945
|
response = request(
|
2897
2946
|
method: "GET",
|
2898
2947
|
url: method_url,
|
@@ -2928,6 +2977,7 @@ module IBMWatson
|
|
2928
2977
|
|
2929
2978
|
method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)]
|
2930
2979
|
|
2980
|
+
headers = authenticator.authenticate(headers)
|
2931
2981
|
response = request(
|
2932
2982
|
method: "POST",
|
2933
2983
|
url: method_url,
|
@@ -2962,6 +3012,7 @@ module IBMWatson
|
|
2962
3012
|
|
2963
3013
|
method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
|
2964
3014
|
|
3015
|
+
headers = authenticator.authenticate(headers)
|
2965
3016
|
response = request(
|
2966
3017
|
method: "GET",
|
2967
3018
|
url: method_url,
|
@@ -2995,6 +3046,7 @@ module IBMWatson
|
|
2995
3046
|
|
2996
3047
|
method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)]
|
2997
3048
|
|
3049
|
+
headers = authenticator.authenticate(headers)
|
2998
3050
|
response = request(
|
2999
3051
|
method: "DELETE",
|
3000
3052
|
url: method_url,
|