Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading