Skip to content

Commit 98bf63d

Browse files
committed
refactor: make filename mandatory in LT
1 parent cc9cc72 commit 98bf63d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/ibm_watson/language_translator_v3.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ def list_documents
433433
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
434434
def translate_document(file:, filename: nil, file_content_type: nil, model_id: nil, source: nil, target: nil, document_id: nil)
435435
raise ArgumentError.new("file must be provided") if file.nil?
436+
raise ArgumentError.new("filename must be provided") if filename.nil?
436437

437438
headers = {
438439
}

lib/ibm_watson/speech_to_text_v1.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def recognize(audio:, model: nil, language_customization_id: nil, acoustic_custo
436436
end
437437

438438
##
439-
# @!method recognize_using_websocket(content_type:,recognize_callback:,audio: nil,chunk_data: false,model: nil,customization_id: nil,acoustic_customization_id: nil,customization_weight: nil,base_model_version: nil,inactivity_timeout: nil,interim_results: nil,keywords: nil,keywords_threshold: nil,max_alternatives: nil,word_alternatives_threshold: nil,word_confidence: nil,timestamps: nil,profanity_filter: nil,smart_formatting: nil,speaker_labels: nil)
439+
# @!method recognize_using_websocket(content_type: nil,recognize_callback:,audio: nil,chunk_data: false,model: nil,customization_id: nil,acoustic_customization_id: nil,customization_weight: nil,base_model_version: nil,inactivity_timeout: nil,interim_results: nil,keywords: nil,keywords_threshold: nil,max_alternatives: nil,word_alternatives_threshold: nil,word_confidence: nil,timestamps: nil,profanity_filter: nil,smart_formatting: nil,speaker_labels: nil)
440440
# Sends audio for speech recognition using web sockets.
441441
# @param content_type [String] The type of the input: audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg, audio/ogg;codecs=opus, audio/ogg;codecs=vorbis, audio/wav, audio/webm, audio/webm;codecs=opus, audio/webm;codecs=vorbis, or multipart/form-data.
442442
# @param recognize_callback [RecognizeCallback] The instance handling events returned from the service.
@@ -499,11 +499,12 @@ def recognize(audio:, model: nil, language_customization_id: nil, acoustic_custo
499499
# results. By default, the service returns no audio metrics.
500500
# @return [WebSocketClient] Returns a new WebSocketClient object
501501
def recognize_using_websocket(
502-
content_type:,
502+
content_type: nil,
503503
recognize_callback:,
504504
audio: nil,
505505
chunk_data: false,
506506
model: nil,
507+
language_customization_id: nil,
507508
customization_id: nil,
508509
acoustic_customization_id: nil,
509510
customization_weight: nil,
@@ -542,6 +543,7 @@ def recognize_using_websocket(
542543
params = {
543544
"model" => model,
544545
"customization_id" => customization_id,
546+
"langauge_customization_id" => language_customization_id,
545547
"acoustic_customization_id" => acoustic_customization_id,
546548
"customization_weight" => customization_weight,
547549
"base_model_version" => base_model_version
@@ -568,7 +570,7 @@ def recognize_using_websocket(
568570
"audio_metrics" => audio_metrics
569571
}
570572
options.delete_if { |_, v| v.nil? }
571-
WebSocketClient.new(audio: audio, chunk_data: chunk_data, options: options, recognize_callback: recognize_callback, url: url, headers: headers)
573+
WebSocketClient.new(audio: audio, chunk_data: chunk_data, options: options, recognize_callback: recognize_callback, url: url, headers: headers, disable_ssl_verification: @disable_ssl_verification)
572574
end
573575

574576
# :nocov:

test/integration/test_language_translator_v3.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def test_translate_document
7373
File.open(Dir.getwd + "/resources/translation_doc.txt") do |file_info|
7474
service_response = service.translate_document(
7575
file: file_info,
76+
filename: "translation_doc.txt",
7677
model_id: "en-fr"
7778
).result
7879
refute(service_response.nil?)

0 commit comments

Comments
 (0)