Skip to content

Instantly share code, notes, and snippets.

@nickbarnwell
Created October 9, 2014 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickbarnwell/bb6d713d3eb8ee5da74b to your computer and use it in GitHub Desktop.
Save nickbarnwell/bb6d713d3eb8ee5da74b to your computer and use it in GitHub Desktop.
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