Sha256: 8e303d6441fabd951ae04e5905ea3930a5620caac66d9d4638b985b0348a85b8
Contents?: true
Size: 636 Bytes
Versions: 1
Compression:
Stored size: 636 Bytes
Contents
# frozen_string_literal: true module BreezyPDFLite # Request conversion of a HTML string to PDF class RenderRequest def initialize(body) @body = body end def submit client.post("/render/html", @body) end def to_file raise BreezyPDFLiteError, "#{response.code}: #{response.body}" if response.code != "201" @to_file ||= Tempfile.new(%w[response .pdf]).tap do |file| file.write(response.body) file.flush file.rewind end end private def response @response ||= submit end def client @client ||= Client.new end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
breezy_pdf_lite-0.0.2 | lib/breezy_pdf_lite/render_request.rb |