Skip to content

Instantly share code, notes, and snippets.

@janxious
Created June 20, 2011 04:34
Show Gist options
  • Save janxious/1035132 to your computer and use it in GitHub Desktop.
Save janxious/1035132 to your computer and use it in GitHub Desktop.
Wrest-based interaction with http://docraptor.com
require 'rubygems'
require 'wrest'
Wrest.logger = Logger.new(STDOUT)
Wrest.logger.level = Logger::DEBUG # Set this to Logger::INFO or higher to disable request logging
response =
'https://docraptor.com/docs?user_credentials=YOUR_API_KEY_HERE'.to_uri.
post_form(:doc =>
{
:name => "docraptor_sample.pdf",
:test => true,
:async => false,
:document_type => "pdf",
:document_content => File.read("html-sample.html")
})
File.open("docraptor_sample.pdf", "w+") do |f|
f.write response.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment