Sha256: 49ec187ce4e60ac409b69e86c37dc81144a45bb25b75a3a08f570e10a2104d4a

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

require 'pp' #For debugging
require 'aws-sdk'
require 'mail_spy/sendgrid/smtp_api_header'
require 'work_queue'
require "mongoid"
require "mail_spy/engine"
require "mail_spy/manager"
module MailSpy

  extend MailSpy::Manager

  # --------------------------------------------- Configuration
  # Allows the client to configure and add esps to MailSpy
  MailSpyESP = Struct.new(
    :address, :port, :authentication, :user_name, :password, :domain,
    :enable_starttls_auto, :name, :options
  )
  @@esps = {}

  MailSpyConfig = Struct.new(
    :tracker_host, :aws_access_key_id,
    :aws_secret_access_key, :aws_campaign_bucket, :using_delayed_job

  )
  @@config = MailSpyConfig.new

  # Allows the initializer to set the configuration
  def self.configure(&block)
    block.call(@@config)
  end

  #TODO eventually have this be a view with a interface
  def self.add_email_service_provider(&block)
    esp = MailSpyESP.new
    esp.options = {} # Important! provides default options list for internals
    block.call(esp)
    esp.options.to_options!
    @@esps[esp.name] = esp
  end

  def self.esps
    @@esps
  end

  def self.tracker_host
    @@config.tracker_host
  end

  def self.template_directory
    @@config.template_directory
  end

  def self.aws_access_key_id
    @@config.aws_access_key_id
  end

  def self.aws_secret_access_key
    @@config.aws_secret_access_key
  end

  def self.aws_campaign_bucket
    @@config.aws_campaign_bucket
  end

  def self.using_delayed_job
    @@config.using_delayed_job
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mail_spy-0.1.0 lib/mail_spy.rb