Created
June 20, 2011 04:34
-
-
Save janxious/1035132 to your computer and use it in GitHub Desktop.
Wrest-based interaction with http://docraptor.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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