docraptor / docraptor-ruby Goto Github PK
View Code? Open in Web Editor NEWA native Ruby client for the DocRaptor HTML to PDF generation API
Home Page: https://docraptor.com
License: MIT License
A native Ruby client for the DocRaptor HTML to PDF generation API
Home Page: https://docraptor.com
License: MIT License
On Rails 4.2.6 (latest is 4.2.7), a NoMethodError
is caused when receiving data after document creation. It looks to be related to rails/rails#25397 which is fixed in 4.2.7 and 5.0.0.
NoMethodError: undefined method `[]' for nil:NilClass
from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/logger_silence.rb:23:in `level'
from /app/vendor/bundle/ruby/2.2.0/gems/ethon-0.9.0/lib/ethon/easy/operations.rb:30:in `perform'
from /app/vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/operations.rb:16:in `run'
from /app/vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/cacheable.rb:18:in `run'
from /app/vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/block_connection.rb:31:in `run'
from /app/vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/stubbable.rb:25:in `run'
from /app/vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/before.rb:26:in `run'
from /app/vendor/bundle/ruby/2.2.0/gems/docraptor-0.3.0/lib/docraptor/api_client.rb:37:in `call_api'
from /app/vendor/bundle/ruby/2.2.0/gems/docraptor-0.3.0/lib/docraptor/api/doc_api.rb:118:in `create_doc_with_http_info'
from /app/vendor/bundle/ruby/2.2.0/gems/docraptor-0.3.0/lib/docraptor/api/doc_api.rb:77:in `create_doc'
from (irb):7
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from /app/bin/rails:8:in `require’
We're using ruby 3.0.1, and this gem fails to work because of the following errors:
docraptor-1.4.0/lib/docraptor/configuration.rb:178:in `base_url': undefined method `encode' for URI:Module (NoMethodError)
docraptor-1.4.0/lib/docraptor/api_client.rb:269:in `build_request_url': undefined method `encode' for URI:Module (NoMethodError)
URI.encode
has been removed in ruby 3
I use the pretty straightforward code below with a paid and working account on Docraptor
require 'docraptor'
DocRaptor.configure do |dr|
dr.username = 'xxxxxxxx'
dr.debugging = true
end
options = {
name: '56cb1f67ea32542ed2000000_csv.xls',
document_type: 'xls',
test: false,
callback_url: '<valid call back url>',
document_url: '<valid amazon url>',
prince_options: { version: '9.0', http_timeout: '60' }
}
docraptor = DocRaptor::DocApi.new
create_response = docraptor.create_async_doc(options)
The server is never called.... Pretty same code works with doc_raptor
What is wrong here?
Thanks
Typhoeus is now at 1.0.2 and is widely popular. Why is this gem depending on such an old version?
https://github.com/DocRaptor/docraptor-ruby/blob/master/docraptor.gemspec#L16
Hello. I was wondering if there are any plans to POST to a webhook when generating a PDF via async_doc
. That would simplify a lot of error handling and looping on the client side.
It's easy for generated clients to return accidentally utf8 encoded data, which ends up corrupting PDF/XLS/XLSX files. Let's add a test to ensure this can never happen.
because:
the string/symbol issues this lib is playing with are deadly/mind-binding ;-/
https://github.com/ahoward/map is a fix if uses generally but a re-work, i'll create a PR tomorrow
root cause seems to be:
even tho
Related to typhoeus/typhoeus#627 as DocRaptor installs Typhoeus.
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.