redsquirrel-mad_mimi_mailer 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/mad_mimi_mailer.rb +12 -3
  2. metadata +1 -1
@@ -9,6 +9,14 @@ class MadMimiMailer < ActionMailer::Base
9
9
  @@api_settings = {}
10
10
  cattr_accessor :api_settings
11
11
 
12
+ def promotion(promotion = nil)
13
+ if promotion.present?
14
+ @promotion = promotion
15
+ else
16
+ @promotion
17
+ end
18
+ end
19
+
12
20
  class << self
13
21
 
14
22
  def method_missing(method_symbol, *parameters)
@@ -27,8 +35,7 @@ class MadMimiMailer < ActionMailer::Base
27
35
  return unless perform_deliveries
28
36
 
29
37
  if delivery_method == :test
30
- deliveries << self
31
-
38
+ deliveries << mail
32
39
  else
33
40
  call_api!(mail, method)
34
41
  end
@@ -40,7 +47,7 @@ class MadMimiMailer < ActionMailer::Base
40
47
  'username' => api_settings[:username],
41
48
  'api_key' => api_settings[:api_key],
42
49
 
43
- 'promotion_name' => method.to_s.sub(/^mimi_/, ''),
50
+ 'promotion_name' => mail.promotion || method.to_s.sub(/^mimi_/, ''),
44
51
  'recipients' => serialize(mail.recipients),
45
52
  'subject' => mail.subject,
46
53
  'bcc' => serialize(mail.bcc),
@@ -74,6 +81,8 @@ class MadMimiMailer < ActionMailer::Base
74
81
  recipients
75
82
  when Array
76
83
  recipients.join(", ")
84
+ when NilClass
85
+ nil
77
86
  else
78
87
  raise "Please provide a String or an Array for recipients or bcc."
79
88
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redsquirrel-mad_mimi_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Hoover