smailer 0.7.1 → 0.7.2
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.
- checksums.yaml +4 -4
- data/lib/smailer/models/mail_campaign.rb +20 -14
- data/lib/smailer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a802147c81ef44bbccab4c0dd6319aadb8ba8ad
|
4
|
+
data.tar.gz: 51d003004e3bf9296ec29d656b9119dfaf62c044
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5518b27f7990285c16ec5571da8263b9600eddea60f4c386dca742a1c62aa0833fdb58898220141016e8604b6034e1588f4e6105c86fc7fa658982c6604b16a3
|
7
|
+
data.tar.gz: 45c66ce79bdee5eb44d626990d99c1d1679916248a295205dbe38788d5b21c1d7b61188e8c931c8963cc2569ddb0bc680e40e61e48c54a92a5b9d6223e019ed0
|
@@ -10,24 +10,24 @@ module Smailer
|
|
10
10
|
belongs_to :mailing_list
|
11
11
|
has_many :queued_mails, :dependent => :destroy
|
12
12
|
has_many :finished_mails, :dependent => :destroy
|
13
|
-
has_many :attachments,
|
14
|
-
:class_name => '::Smailer::Models::MailCampaignAttachment'
|
15
13
|
|
16
14
|
validates_presence_of :mailing_list_id, :from
|
17
15
|
validates_numericality_of :mailing_list_id, :unsubscribe_methods, :only_integer => true, :allow_nil => true
|
18
16
|
validates_length_of :from, :subject, :maximum => 255, :allow_nil => true
|
19
17
|
|
20
|
-
|
21
|
-
attr_accessible :mailing_list_id, :from, :subject, :body_html, :body_text
|
22
|
-
end
|
18
|
+
attr_accessible :mailing_list_id, :from, :subject, :body_html, :body_text
|
23
19
|
|
24
|
-
def add_unsubscribe_method(
|
25
|
-
|
20
|
+
def add_unsubscribe_method(method_specification)
|
21
|
+
unsubscribe_methods_list_from(method_specification).each do |method|
|
22
|
+
self.unsubscribe_methods = (self.unsubscribe_methods || 0) | method
|
23
|
+
end
|
26
24
|
end
|
27
25
|
|
28
|
-
def remove_unsubscribe_method(
|
29
|
-
|
30
|
-
|
26
|
+
def remove_unsubscribe_method(method_specification)
|
27
|
+
unsubscribe_methods_list_from(method_specification).each do |method|
|
28
|
+
if has_unsubscribe_method?(method)
|
29
|
+
self.unsubscribe_methods = (self.unsubscribe_methods || 0) ^ method
|
30
|
+
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -50,10 +50,6 @@ module Smailer
|
|
50
50
|
opened_mails_count.to_f / sent_mails_count
|
51
51
|
end
|
52
52
|
|
53
|
-
def add_attachment(filename, path)
|
54
|
-
self.attachments.create!(:filename => filename, :path => path)
|
55
|
-
end
|
56
|
-
|
57
53
|
def self.unsubscribe_methods
|
58
54
|
methods = {}
|
59
55
|
UnsubscribeMethods.constants.map do |method_name|
|
@@ -62,6 +58,16 @@ module Smailer
|
|
62
58
|
|
63
59
|
methods
|
64
60
|
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def unsubscribe_methods_list_from(method_specification)
|
65
|
+
if method_specification == :all
|
66
|
+
self.class.unsubscribe_methods.keys
|
67
|
+
else
|
68
|
+
[method_specification]
|
69
|
+
end
|
70
|
+
end
|
65
71
|
end
|
66
72
|
end
|
67
73
|
end
|
data/lib/smailer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitar Dimitrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|