Created
October 9, 2014 15:32
-
-
Save nickbarnwell/bb6d713d3eb8ee5da74b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def headers | |
{ | |
:'Authorization' => "Bearer tokenString" | |
} | |
end | |
def create_page(section_id) | |
html_part = <<-eos | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>A page with an embedded and displayed PDF file</title> | |
</head> | |
<body> | |
<p>Attached is the lease agreement for the expanded offices!</p> | |
<object | |
data-attachment="Presentation.pdf" | |
data="name:Attachment" | |
type="application/pdf" /> | |
<p>Here's the contents of our new lease.</p> | |
<img data-render-src="name:Attachment" width="900"/> | |
</body> | |
</html> | |
eos | |
f = File.open(remote_file.url) | |
response = RestClient.post(URL+"/sections/#{section_id}/pages", {:Presentation => html_part, :Attachment => f} , headers ){|r| r} | |
JSON.parse(response) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment