lib/deepl/document_api.rb in deepl-rb-3.0.0 vs lib/deepl/document_api.rb in deepl-rb-3.0.1

- old
+ new

@@ -81,16 +81,17 @@ # formatted as ISO 639-1, 2-letter language codes. # @param [String] target_lang Target language to use for the translation. Must be formatted as # ISO 639-1, 2-letter language codes, plus a hyphen "-" with the # variant identifier for languages with variants/dialects/... . # @param [String, nil] filename The filename of the file, including its extension. Used to open - # the different kinds of documents (PDFs, etc). + # the different kinds of documents (PDFs, etc). If nil, will use + # the filename of +input_file_path+. # @param [Hash] options Additional options for the upload. # @param [Hash] additional_headers Additional headers for the upload. # @return [DeepL::Resources::DocumentTranslationStatus] Status of the document translation. - def translate_document(input_file, output_file, source_lang, target_lang, filename, # rubocop:disable Metrics/MethodLength,Metrics/ParameterLists - options = {}, additional_headers = {}) + def translate_document(input_file, output_file, source_lang, target_lang, # rubocop:disable Metrics/MethodLength,Metrics/ParameterLists + filename = nil, options = {}, additional_headers = {}) raise IOError 'File already exists at output path' if File.exist?(output_file) begin handle = upload(input_file, source_lang, target_lang, filename, options, additional_headers)