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



15
16
17
18
# File 'lib/billomat/actions/email.rb', line 15

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

Instance Method Details

#callTrueClass

Calls the gateway.

Returns:

  • (TrueClass)


23
24
25
26
27
# File 'lib/billomat/actions/email.rb', line 23

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



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

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

#wrapped_dataHash

Wraps the options

Returns:

  • (Hash)

    the wrapped email options



32
33
34
# File 'lib/billomat/actions/email.rb', line 32

def wrapped_data
  { email: @opts }
end