Sha256: 814222667483c01a3665e0ceef2b874a6980b5bb23e634fffe8223b6a3e2ee9e

Contents?: true

Size: 945 Bytes

Versions: 2

Compression:

Stored size: 945 Bytes

Contents

require "ahoy_email/version"
require "action_mailer"
require "nokogiri"
require "addressable/uri"
require "openssl"
require "ahoy_email/processor"
require "ahoy_email/interceptor"
require "ahoy_email/mailer"
require "ahoy_email/engine"

module AhoyEmail
  mattr_accessor :secret_token, :options

  self.options = {
    message: true,
    open: true,
    click: true,
    utm_params: true,
    utm_source: proc {|message, mailer| mailer.mailer_name },
    utm_medium: "email",
    utm_term: nil,
    utm_content: nil,
    utm_campaign: proc {|message, mailer| mailer.action_name },
    user: proc{|message, mailer| User.where(email: message.to.first).first rescue nil }
  }

  def self.message_model=(message_model)
    @message_model = message_model
  end

  def self.message_model
    @message_model || Ahoy::Message
  end

end

ActionMailer::Base.send :include, AhoyEmail::Mailer
ActionMailer::Base.register_interceptor AhoyEmail::Interceptor

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ahoy_email-0.1.1 lib/ahoy_email.rb
ahoy_email-0.1.0 lib/ahoy_email.rb