convertapi / convertapi-ruby Goto Github PK
View Code? Open in Web Editor NEWA Ruby Gem for the ConvertAPI
Home Page: https://www.convertapi.com
License: MIT License
A Ruby Gem for the ConvertAPI
Home Page: https://www.convertapi.com
License: MIT License
Previously, in one of the project, I had been using this gem with ruby-2.6.5. After upgrading the ruby version to 2.7.2 I started getting some errors. Specifically when I tried to save the converted file using the save
method on the ConvertApi::ResultFile
module.
when I try to save the converted file like so: converted.file.save('/path/to/file')
I'm getting this error: ArgumentError (extra arguments)
Some formats have several converters, for example, docx to pdf has three of them listed below.
It should be a possibility to set up an alternative converter from the library in the Convert method.
https://v2.convertapi.com/convert/docx/to/pdf
https://v2.convertapi.com/convert/docx/to/pdf/converter/openoffice
https://v2.convertapi.com/convert/docx/to/pdf/converter/printer
This is only an example of a convert method on how it could implement alternative converters.
Default method
ConvertApi.convert('pdf', File: '/path/to/my_file.docx')
with alternative converter
ConvertApi.convert('pdf', File: '/path/to/my_file.docx', converter: 'openoffice')
We are experiencing an issue while trying to convert and merge a pdf.
The error we get is
ConvertApi::ConnectionFailed end of file reached
AFAIK, we haven't touched our side of the code.
Do you have any idea what the source of this problem might be?
I went through the docs and couldn't find anything.
Also our dashboard shows 0 failures and your status page shows that everything is operational.
Change HTTP request Agent header format from old format
convertapi-ruby-version
to
ConvertAPI-Ruby/version
Such format is more native to HTTP agent specification http://www.bizcoder.com/the-much-maligned-user-agent-header
In this example the parameter name is Url
, but actually this generates a blank PDF (presumably there is some error that isn't reported)
Using File
as the parameter works correctly, which is odd as this contradicts the API documentation, but matches the CLI command.
When running with the Ruby 3 getting this error:
...lib/convert_api/client.rb:51:in 'block in upload': undefined method 'encode' for URI:Module (NoMethodError)
The maximum timeout for Web to PDF API is 180 and the library default timeout is 600 which throw validation exception when used. Please change default Timeout from 600 to 180.
The following code:
result = ConvertApi.convert('txt', { File: document.url, StoreFile: false, RemoveHeadersFooters: true }, from_format: 'pdf')
makes a call to the url with &StoreFile=true.
I think the problem is here:
convertapi-ruby/lib/convert_api/task.rb
Line 11 in 88ed026
I think you merge default parameters over top user parameters when you should be doing the merge the other way.
This seems like kind of a security risk having it this way especially since your documentation at: https://www.convertapi.com/pdf-to-txt#snippet=ruby clearly states that the default is false not true.
A comment from the user:
It would be really helpful if you provided better documentation on how to access elements of the response objects your API returns. It took me forever to figure out how to actually get the files that were converted, and I did it on my own, not with your documentation. For example, it was not obvious that the response object was returning an array of files that I could access like this:
rtf_file = ConvertApi.convert('rtf', File: 'new.pdf')
rtf_url = rtf_file.files[0].url
open('rtf_file.rtf', 'wb') do |file|
file << open(rtf_url).read
end
Add Token authentication to Ruby library.
Description ConvertAPI/convertapi-dotnet#29
I'm trying to get text out .pdf files. Can this module do that?
We have a use case where some of our conversion requests will be synchronous and some will be asynchronous in the same application.
Async requests are specified by a URI path prefix instead of a request param and I don't see a way to add that prefix to the request builder in a ConvertApi::Task
as it is hard-coded to start with /convert
I could modify the base_uri
in ConvertApi::Configuration
but that would change it for all calls to ConvertApi#convert
in the current thread instead of for a single request.
Am I missing something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.