Skip to content

Commit

Permalink
Remove alternative converter support
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurynas Butkus committed Sep 14, 2024
1 parent b073aa7 commit a297443
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
20 changes: 0 additions & 20 deletions examples/alternative_converter.rb

This file was deleted.

12 changes: 1 addition & 11 deletions lib/convert_api/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ def run

from_format = @from_format || detect_format(params)
read_timeout = @conversion_timeout + config.conversion_timeout_delta if @conversion_timeout
converter = detect_converter(params)
converter_path = converter ? "/converter/#{converter}" : ''

response = ConvertApi.client.post(
"convert/#{from_format}/to/#{@to_format}#{converter_path}",
"convert/#{from_format}/to/#{@to_format}",
params,
read_timeout: read_timeout,
)
Expand Down Expand Up @@ -70,14 +68,6 @@ def detect_format(params)
FormatDetector.new(resource, @to_format).run
end

def detect_converter(params)
params.each do |key, value|
return value if key.to_s.downcase == 'converter'
end

nil
end

def config
ConvertApi.config
end
Expand Down
12 changes: 0 additions & 12 deletions spec/convert_api/task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@
expect(subject).to be_instance_of(ConvertApi::Result)
end

context 'with converter' do
let(:params) { { File: file, Converter: 'openoffice' } }

it 'adds converter to the path' do
expect(ConvertApi.client).to(
receive(:post).with('convert/txt/to/pdf/converter/openoffice', instance_of(Hash), instance_of(Hash)).and_return(result)
)

expect(subject).to be_instance_of(ConvertApi::Result)
end
end

context 'when file is instance of ResultFile' do
let(:file) { ConvertApi::ResultFile.new('Url' => 'testurl') }
let(:expected_params) { hash_including(File: 'testurl') }
Expand Down

0 comments on commit a297443

Please sign in to comment.