exacttarget 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/exacttarget.gemspec +1 -1
- data/lib/exacttarget/email.rb +37 -0
- data/lib/exacttarget/templates/email.xml.erb +1 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/exacttarget.gemspec
CHANGED
data/lib/exacttarget/email.rb
CHANGED
@@ -3,6 +3,10 @@ module ExactTarget
|
|
3
3
|
|
4
4
|
public
|
5
5
|
|
6
|
+
def email_find_all(body = false)
|
7
|
+
email_find({ :body => body })
|
8
|
+
end
|
9
|
+
|
6
10
|
def email_find_by_id(id, options = {})
|
7
11
|
email_find({
|
8
12
|
:id => id,
|
@@ -78,8 +82,41 @@ module ExactTarget
|
|
78
82
|
list
|
79
83
|
end
|
80
84
|
|
85
|
+
def email_create(name, subject, html, text = false)
|
86
|
+
id = email_add_html(name, subject, html)
|
87
|
+
email_add_text(id, text) if text
|
88
|
+
id
|
89
|
+
end
|
90
|
+
|
81
91
|
private
|
82
92
|
|
93
|
+
def email_add_html(name, subject, html)
|
94
|
+
@action = 'add'
|
95
|
+
@sub_action = 'HTMLPaste'
|
96
|
+
@name = name.to_s
|
97
|
+
@subject = subject.to_s
|
98
|
+
@body = html
|
99
|
+
|
100
|
+
result = Nokogiri::XML(send(render(:email)))
|
101
|
+
id = result.xpath('//emailID').text
|
102
|
+
|
103
|
+
raise '[ExactTarget] Error: Email HTMLPaste failed.' if id.empty?
|
104
|
+
id
|
105
|
+
end
|
106
|
+
|
107
|
+
def email_add_text(id, text)
|
108
|
+
@action = 'add'
|
109
|
+
@sub_action = 'text'
|
110
|
+
@id = id
|
111
|
+
@body = text
|
112
|
+
|
113
|
+
result = Nokogiri::XML(send(render(:email)))
|
114
|
+
info = result.xpath('//email_info').text
|
115
|
+
|
116
|
+
raise '[ExactTarget] Error: Email text update failed.' if info.empty?
|
117
|
+
true
|
118
|
+
end
|
119
|
+
|
83
120
|
def email_get_body(id)
|
84
121
|
@action = 'retrieve'
|
85
122
|
@sub_action = 'htmlemail'
|
@@ -24,11 +24,7 @@
|
|
24
24
|
<search_type>emailid</search_type>
|
25
25
|
<search_value><%= @id %></search_value>
|
26
26
|
<% end %>
|
27
|
-
|
28
|
-
<file_name><%= @file_name %></file_name>
|
29
|
-
<% else %>
|
30
|
-
<email_body><![ CDATA[<%= @body %>]]></email_body>
|
31
|
-
<% end %>
|
27
|
+
<email_body><![CDATA[<%= @body %>]]></email_body>
|
32
28
|
<% end %>
|
33
29
|
|
34
30
|
</system>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 1
|
9
|
+
version: 0.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Matthew Simpson
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
hash: -
|
128
|
+
hash: -4363040574825173026
|
129
129
|
segments:
|
130
130
|
- 0
|
131
131
|
version: "0"
|