Sha256: 43dec4e549fbc68dce8a95ecd30c942301b368c83af3c384249c63f8b94513e6

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

require "mailkick/version"
require "mailkick/engine"
require "mailkick/processor"
require "mailkick/mailer"
require "mailkick/model"
require "mailkick/service"
require "mailkick/service/mailchimp"
require "mailkick/service/mandrill"
require "mailkick/service/sendgrid"

module Mailkick
  mattr_accessor :services, :user_method, :secret_token
  self.services = []
  self.user_method = proc{|email| User.where(email: email).first rescue nil }

  def self.fetch_opt_outs
    services.each do |service|
      service.fetch_opt_outs
    end
  end

  def self.discover_services
    Service.subclasses.each do |service|
      if service.discoverable?
        services << service.new
      end
    end
  end

end

ActionMailer::Base.send :include, Mailkick::Mailer
ActiveRecord::Base.send(:extend, Mailkick::Model) if defined?(ActiveRecord)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailkick-0.0.3 lib/mailkick.rb
mailkick-0.0.2 lib/mailkick.rb