Class: Billomat::Actions::Pdf

Inherits:
Object
  • Object
show all
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

Constructor Details

#initialize(invoice_id, opts = {}) ⇒ Billomat::Actions::Pdf

Parameters:

  • invoice_id (String)

    The invoice ID

  • opts (Hash) (defaults to: {})

    The options for this action



13
14
15
16
# File 'lib/billomat/actions/pdf.rb', line 13

def initialize(invoice_id, opts = {})
  @invoice_id = invoice_id
  @opts = opts
end

Instance Method Details

#callTrueClass

Calls the gateway

Returns:

  • (TrueClass)


22
23
24
25
# File 'lib/billomat/actions/pdf.rb', line 22

def call
  resp = Billomat::Gateway.new(:get, path).run
  resp['pdf']
end

#pathHash

Wraps the options

Returns:

  • (Hash)

    The wrapped email options



31
32
33
# File 'lib/billomat/actions/pdf.rb', line 31

def path
  "/invoices/#{@invoice_id}/pdf"
end