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 ) @@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 end