Module: EmailEvents

Defined in:
lib/email_events/models/sent_email_data.rb,
lib/email_events.rb,
lib/email_events/mailer.rb,
lib/email_events/railtie.rb,
lib/email_events/version.rb,
lib/generators/email_events/install_generator.rb

Overview

Schema Information

Table name: sent_email_data

id            :integer          not null, primary key
uuid          :string
mailer_class  :string
mailer_action :string           not null
to            :string           not null
data          :text
created_at    :datetime
provider_message_id :string

Defined Under Namespace

Modules: Adapters, Mailer Classes: InstallGenerator, Railtie, SentEmailData, Service

Constant Summary collapse

VERSION =
"1.0"

Class Method Summary collapse

Class Method Details

.adapterObject



27
28
29
30
31
32
33
34
35
# File 'lib/email_events.rb', line 27

def self.adapter
  # auto-detect the adapter unless it's already been explicitly set
  @adapter ||= begin
    adapter_initializer = EmailEvents::Adapters::Abstract::Initializer.descendants.find {|adapter| adapter.load_adapter?}
    return nil if adapter_initializer.nil?

    adapter_initializer.parent
  end
end

.adapter=(adapter_module) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/email_events.rb', line 37

def self.adapter=(adapter_module)
  if adapter_module.is_a?(String) || adapter_module.is_a?(Symbol)
    @adapter = "EmailEvents::Adapters::#{adapter_module.to_s.camelize}".constantize
  else
    @adapter = adapter_module
  end
end

.initializeObject



23
24
25
# File 'lib/email_events.rb', line 23

def self.initialize
  adapter.const_get('Initializer').initialize unless adapter.nil?
end