class T::Mailer::Configuration

Attributes

aws_access_key_id[RW]

Amazon AWS SES

aws_default_region[RW]
aws_secret_access_key[RW]
sparkpost_api_key[RW]

SparkPost

Public Class Methods

new() click to toggle source
# File lib/t/mailer.rb, line 52
def initialize
  %w(
    AWS_ACCESS_KEY_ID
    AWS_DEFAULT_REGION
    AWS_SECRET_ACCESS_KEY
    SPARKPOST_API_KEY
  ).each do |variable_name|
    set_credential(variable_name)
  end
end

Private Instance Methods

set_credential(variable_name) click to toggle source

If environment variables exist then it can pick up and set up those credentials automatically (no need config/initializers/t-mailer.rb file). If environment variable does not exist then it will leave it blank.

@param [String] variable_name the credential/API key variable name

# File lib/t/mailer.rb, line 70
def set_credential(variable_name)
  if ENV[variable_name].nil?
    public_send("#{variable_name.downcase}=", "")
  else
    public_send("#{variable_name.downcase}=", ENV[variable_name])
  end
end