Class: Billomat::Actions::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/billomat/actions/email.rb

Overview

This actions sends an invoice email. Recipients must be passed like this: { recipients: { to: ‘[email protected]’ } }

Examples:

Billomat::Actions::Email.new('1235', { recipiens: { to: '[email protected]' } })

Instance Method Summary collapse

Constructor Details

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

Parameters:

  • invoice_id (String)

    The invoice ID

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

    The options for this action



17
18
19
20
# File 'lib/billomat/actions/email.rb', line 17

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

Instance Method Details

#callTrueClass

Calls the gateway

Returns:

  • (TrueClass)


26
27
28
29
30
# File 'lib/billomat/actions/email.rb', line 26

def call
  Billomat::Gateway.new(:post, path, wrapped_data).run

  true
end

#pathString

Returns The path for the email action.

Returns:

  • (String)

    The path for the email action



41
42
43
# File 'lib/billomat/actions/email.rb', line 41

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

#wrapped_dataHash

Wraps the options

Returns:

  • (Hash)

    The wrapped email options



36
37
38
# File 'lib/billomat/actions/email.rb', line 36

def wrapped_data
  { email: @opts }
end