Class: Billomat::Actions::Pdf
- Inherits:
-
Object
- Object
- Billomat::Actions::Pdf
- Defined in:
- lib/billomat/actions/pdf.rb
Overview
This class allows to download the invoice as a pdf. The PDF comes in a base64 encoded string in the response body.
Instance Method Summary collapse
-
#call ⇒ TrueClass
Calls the gateway.
- #initialize(invoice_id, opts = {}) ⇒ Billomat::Actions::Pdf constructor
-
#path ⇒ String
The path for the PDF action.
Constructor Details
#initialize(invoice_id, opts = {}) ⇒ Billomat::Actions::Pdf
11 12 13 14 |
# File 'lib/billomat/actions/pdf.rb', line 11 def initialize(invoice_id, opts = {}) @invoice_id = invoice_id @opts = opts end |
Instance Method Details
#call ⇒ TrueClass
Calls the gateway.
19 20 21 22 |
# File 'lib/billomat/actions/pdf.rb', line 19 def call resp = Billomat::Gateway.new(:get, path).run resp['pdf'] end |
#path ⇒ String
Returns the path for the PDF action.
25 26 27 |
# File 'lib/billomat/actions/pdf.rb', line 25 def path "/invoices/#{@invoice_id}/pdf" end |