lib/pdfmonkey/document.rb in pdfmonkey-0.3.0 vs lib/pdfmonkey/document.rb in pdfmonkey-0.4.0
- old
+ new
@@ -28,18 +28,23 @@
MEMBER = 'document'
attr_reader :attributes
def_delegators :attributes, *ATTRIBUTES
- def self.generate!(document_template_id, payload)
- document = generate(document_template_id, payload)
+ def self.fetch(document_id)
+ new(id: document_id).reload!
+ end
+
+ def self.generate!(document_template_id, payload, meta = {})
+ document = generate(document_template_id, payload, meta)
document.reload! until document.done?
document
end
- def self.generate(template_id, payload)
+ def self.generate(template_id, payload, meta = {})
document = new(
document_template_id: template_id,
+ meta: meta.to_json,
payload: payload.to_json,
status: 'pending')
document.send(:save)
end