class Billomat::Actions::Email

This actions sends an invoice email. Recipients must be passed like this: { recipients: { to: 'bob@example.org' } }

@example

Billomat::Actions::Email.new('1235', { recipiens: { to: 'a@b.org' } })

Public Class Methods

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

@param [String] invoice_id The invoice ID @param [Hash] opts The options for this action

@return [Billomat::Actions::Email]

# File lib/billomat/actions/email.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/email.rb, line 26
def call
  Billomat::Gateway.new(:post, path, wrapped_data).run

  true
end
path() click to toggle source

@return [String] The path for the email action

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

Wraps the options

@return [Hash] The wrapped email options

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