Module: MultiMail::Sender::Base

Included in:
Mailgun, Mandrill, Postmark, SendGrid
Defined in:
lib/multi_mail/sender/base.rb

Overview

Abstract class for outgoing email senders.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#settingsObject

Returns the value of attribute settings.



11
12
13
# File 'lib/multi_mail/sender/base.rb', line 11

def settings
  @settings
end

#trackingObject (readonly)

Returns the value of attribute tracking.



12
13
14
# File 'lib/multi_mail/sender/base.rb', line 12

def tracking
  @tracking
end

Class Method Details

.included(subclass) ⇒ Object



5
6
7
8
9
# File 'lib/multi_mail/sender/base.rb', line 5

def self.included(subclass)
  subclass.class_eval do
    extend MultiMail::Service
  end
end

Instance Method Details

#initialize(options = {}) ⇒ Object

Initializes an outgoing email sender.

Parameters:

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

    required and optional arguments



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/multi_mail/sender/base.rb', line 17

def initialize(options = {})
  @settings = {}

  options.keys.each do |key| # based on Hash#symbolize_keys! from Rails
    settings[(key.to_sym rescue key) || key] = options[key]
  end

  self.class.validate_options(settings, false)

  @tracking = settings.delete(:track) || {}
end