activity-mailer 0.0.4 → 0.0.5
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/activity_mailer.rb +6 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bc9b2e2099f0c4e1c026e659601585f04f0bd22
|
4
|
+
data.tar.gz: ff016ddac7d5d5f17dcbb6636a56a6fa8e6a527a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f950ec143dad78b5ff56ceacad3c4e2a74d5b7a698f67642ca3da15dc7ecb199e9fca14091d0a4e488bd7c8e1444c53383eca935858f8222d471453b08ed77e
|
7
|
+
data.tar.gz: 6d92f17632c47034da4a50cc05f48bb2b1664da1e7bf39855e6e458b9de6a946b7f6a8dc714ecf1123c5f79606164821315567494cca48cf8baed08ca774359b
|
data/lib/activity_mailer.rb
CHANGED
@@ -31,10 +31,9 @@ class ActivityMailer
|
|
31
31
|
|
32
32
|
# This should only be done once
|
33
33
|
def create_default_template!(from_addr, from_name, subject)
|
34
|
-
|
35
34
|
@supported_languages.each do |lang|
|
36
35
|
name = name_from_labels("default", lang)
|
37
|
-
templ = @mandrill_connection.templates.add(name, from_addr, from_name, subject, "<
|
36
|
+
templ = @mandrill_connection.templates.add(name, from_addr, from_name, subject, "<html><body>Base Template</body></html>", "Base Template", true, [@service_label, "activity-default", "lang-#{lang}"])
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
@@ -43,7 +42,7 @@ class ActivityMailer
|
|
43
42
|
end
|
44
43
|
|
45
44
|
# Registers a new type of template
|
46
|
-
def register_template!(system_name)
|
45
|
+
def register_template!(system_name, from_addr = nil, from_name = nil, subject = nil, html = nil, text = nil)
|
47
46
|
default_templates = @mandrill_connection.templates.list(@service_label).select{|templ|
|
48
47
|
templ["labels"].include?("activity-default") && templ["published_at"] != nil
|
49
48
|
}
|
@@ -59,7 +58,7 @@ class ActivityMailer
|
|
59
58
|
next if lang.nil?
|
60
59
|
|
61
60
|
new_templ_name = name_from_labels(system_name, lang)
|
62
|
-
new_templ = @mandrill_connection.templates.add(new_templ_name, templ["publish_from_email"], templ["publish_from_name"], templ["publish_subject"], templ["publish_code"], templ["publish_text"], true, [@service_label, "activity-#{system_name}", "lang-#{lang}"])
|
61
|
+
new_templ = @mandrill_connection.templates.add(new_templ_name, (from_addr || templ["publish_from_email"]), (from_name || templ["publish_from_name"]), (subject || templ["publish_subject"]), (html || templ["publish_code"]), (text || templ["publish_text"]), true, [@service_label, "activity-#{system_name}", "lang-#{lang}"])
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
@@ -102,11 +101,11 @@ class ActivityMailer
|
|
102
101
|
|
103
102
|
templ = templ_list.first
|
104
103
|
|
105
|
-
|
104
|
+
message_info[:global_merge_vars] ||= {}
|
106
105
|
data.each do |k, v|
|
107
|
-
|
106
|
+
message_info[:global_merge_vars].push({:name => k, :content => v})
|
108
107
|
end
|
109
|
-
|
108
|
+
|
110
109
|
@mandrill_connection.messages.send_template(templ["name"], data, message_info, false, @mandrill_ip_pool)
|
111
110
|
end
|
112
111
|
end
|