class Billomat::Actions::Complete

Completes an invoice by calling the /complete path on a resource

Public Class Methods

new(invoice_id, opts = {}) click to toggle source

Returns a Complete object

@param [String] invoice_id The ID of the invoice @param [Hash] opts The options for this request @return [Billomat::Actions::Complete]

@example

Billomat::Actions::Complete('12345', { template_id: '10231' })
# File lib/billomat/actions/complete.rb, line 17
def initialize(invoice_id, opts = {})
  @invoice_id = invoice_id
  @opts = opts
end

Public Instance Methods

call() click to toggle source

Calls the gateway

@return [TrueClass]

# File lib/billomat/actions/complete.rb, line 26
def call
  Billomat::Gateway.new(:put, path, wrapped_data).run

  true
end
path() click to toggle source

@return [String] The complete path with the invoice_id

# File lib/billomat/actions/complete.rb, line 41
def path
  "/invoices/#{@invoice_id}/complete"
end
wrapped_data() click to toggle source

The given options have to be wrapped

@return [Hash] The payload for the complete request

# File lib/billomat/actions/complete.rb, line 36
def wrapped_data
  { complete: @opts }
end