module SGMailer

Constants

ConfigurationError
VERSION

Attributes

client[RW]
delivery_processor[RW]

Public Instance Methods

configure(delivery_processor: default_delivery_processor, test_client: false, **client_options) click to toggle source
# File lib/sg_mailer.rb, line 12
def configure(delivery_processor: default_delivery_processor,
              test_client: false, **client_options)
  self.client = test_client ? TestClient.new : Client.new(**client_options)
  self.delivery_processor = delivery_processor
end
send(mail) click to toggle source
# File lib/sg_mailer.rb, line 18
def send(mail)
  raise ConfigurationError if client.nil?

  client.send(mail)
end

Private Instance Methods

default_delivery_processor() click to toggle source
# File lib/sg_mailer.rb, line 26
def default_delivery_processor
  if defined?(::ActiveJob)
    require 'sg_mailer/delayed_delivery_processor'
    DelayedDeliveryProcessor
  else
    require 'sg_mailer/immediate_delivery_processor'
    ImmediateDeliveryProcessor
  end
end