Skip to content

Commit 60291d5

Browse files
authored
Merge pull request #117 from watson-developer-cloud/fixrelease-1-2021
fix: remove filename
2 parents 283deef + 86a6fcd commit 60291d5

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

lib/ibm_watson/text_to_speech_v1.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ def list_custom_prompts(customization_id:)
921921
end
922922

923923
##
924-
# @!method add_custom_prompt(customization_id:, prompt_id:, metadata:, file:, filename: nil)
924+
# @!method add_custom_prompt(customization_id:, prompt_id:, metadata:, file:)
925925
# Add a custom prompt.
926926
# Adds a custom prompt to a custom model. A prompt is defined by the text that is to
927927
# be spoken, the audio for that text, a unique user-specified ID for the prompt, and
@@ -1027,9 +1027,8 @@ def list_custom_prompts(customization_id:)
10271027
# 16 kHz. The service accepts audio with higher sampling rates. The service
10281028
# transcodes all audio to 16 kHz before processing it.
10291029
# * The length of the prompt audio is limited to 30 seconds.
1030-
# @param filename [String] The filename for file.
10311030
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
1032-
def add_custom_prompt(customization_id:, prompt_id:, metadata:, file:, filename: nil)
1031+
def add_custom_prompt(customization_id:, prompt_id:, metadata:, file:)
10331032
raise ArgumentError.new("customization_id must be provided") if customization_id.nil?
10341033

10351034
raise ArgumentError.new("prompt_id must be provided") if prompt_id.nil?
@@ -1050,8 +1049,7 @@ def add_custom_prompt(customization_id:, prompt_id:, metadata:, file:, filename:
10501049
unless file.instance_of?(StringIO) || file.instance_of?(File)
10511050
file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file)
10521051
end
1053-
filename = file.path if filename.nil? && file.respond_to?(:path)
1054-
form_data[:file] = HTTP::FormData::File.new(file, content_type: "audio/wav", filename: filename)
1052+
form_data[:file] = HTTP::FormData::File.new(file, content_type: "audio/wav", filename: file.respond_to?(:path) ? file.path : nil)
10551053

10561054
method_url = "/v1/customizations/%s/prompts/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(prompt_id)]
10571055

0 commit comments

Comments
 (0)