Class: AhoyEmail::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/ahoy_email/processor.rb

Constant Summary collapse

UTM_PARAMETERS =
%w(utm_source utm_medium utm_term utm_content utm_campaign)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mailer, options) ⇒ Processor

Returns a new instance of Processor.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
# File 'lib/ahoy_email/processor.rb', line 7

def initialize(mailer, options)
  @mailer = mailer
  @options = options

  unknown_keywords = options.keys - AhoyEmail.default_options.keys
  raise ArgumentError, "unknown keywords: #{unknown_keywords.join(", ")}" if unknown_keywords.any?
end

Instance Attribute Details

#mailerObject (readonly)

Returns the value of attribute mailer.



3
4
5
# File 'lib/ahoy_email/processor.rb', line 3

def mailer
  @mailer
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/ahoy_email/processor.rb', line 3

def options
  @options
end

Instance Method Details

#performObject



15
16
17
18
19
# File 'lib/ahoy_email/processor.rb', line 15

def perform
  track_links if options[:utm_params] || options[:click]
  track_message if options[:message]
  message.ahoy_options = options
end