Class: Py3oFusion
- Inherits:
-
Object
- Object
- Py3oFusion
- Defined in:
- lib/py3o_fusion.rb
Instance Method Summary collapse
- #data(data) ⇒ Object
- #generate_pdf(path) ⇒ Object
-
#initialize(endpoint) ⇒ Py3oFusion
constructor
A new instance of Py3oFusion.
- #static_image(name, file) ⇒ Object
- #template(template) ⇒ Object
Constructor Details
#initialize(endpoint) ⇒ Py3oFusion
Returns a new instance of Py3oFusion.
4 5 6 7 8 |
# File 'lib/py3o_fusion.rb', line 4 def initialize(endpoint) @endpoint = endpoint @payload = {} @image_mapping = {} end |
Instance Method Details
#data(data) ⇒ Object
15 16 17 18 |
# File 'lib/py3o_fusion.rb', line 15 def data(data) @data = data self end |
#generate_pdf(path) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/py3o_fusion.rb', line 26 def generate_pdf(path) response = post if response.code == 200 store path, response.body else raise StandardError.new "Error generating PDF" end end |
#static_image(name, file) ⇒ Object
20 21 22 23 24 |
# File 'lib/py3o_fusion.rb', line 20 def static_image(name, file) @payload[name.to_sym] = File.open(file) @image_mapping[name.to_sym] = "staticimage.#{name}" self end |
#template(template) ⇒ Object
10 11 12 13 |
# File 'lib/py3o_fusion.rb', line 10 def template(template) @payload[:tmpl_file] = File.open(template) self end |