Class: MailHandler::Sender

Inherits:
Object
  • Object
show all
Defined in:
lib/mailhandler/sender.rb

Overview

Class for sending email, and storing details about the sending.

Direct Known Subclasses

MailHandler::Sending::PostmarkAPISender

Defined Under Namespace

Classes: Sending

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dispatcher) ⇒ Sender

Returns a new instance of Sender.

Parameters:

  • dispatcher (Sending::Oblect)
    • sender type used for sending email



19
20
21
22
# File 'lib/mailhandler/sender.rb', line 19

def initialize(dispatcher)
  @dispatcher = dispatcher
  @sending = Sending.new
end

Instance Attribute Details

#dispatcherObject

Returns the value of attribute dispatcher.



8
9
10
# File 'lib/mailhandler/sender.rb', line 8

def dispatcher
  @dispatcher
end

#sendingObject

Returns the value of attribute sending.



8
9
10
# File 'lib/mailhandler/sender.rb', line 8

def sending
  @sending
end

Instance Method Details

#send_email(email) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/mailhandler/sender.rb', line 24

def send_email(email)
  init_sending_details(email)
  response = dispatcher.send(email)
  update_sending_details(response)

  response
end