exacttarget 0.0.1 → 0.1.0
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.
- data/VERSION +1 -1
- data/exacttarget.gemspec +1 -1
- data/lib/exacttarget/client.rb +1 -1
- data/lib/exacttarget/email.rb +54 -35
- data/lib/exacttarget/templates/email.xml.erb +5 -6
- data/lib/exacttarget.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/exacttarget.gemspec
CHANGED
data/lib/exacttarget/client.rb
CHANGED
data/lib/exacttarget/email.rb
CHANGED
@@ -3,68 +3,88 @@ module ExactTarget
|
|
3
3
|
|
4
4
|
public
|
5
5
|
|
6
|
-
def
|
7
|
-
|
6
|
+
def email_find_by_id(id, options = {})
|
7
|
+
email_find({
|
8
|
+
:id => id,
|
9
|
+
:body => true
|
10
|
+
}.merge(options))
|
8
11
|
end
|
9
12
|
|
10
|
-
def
|
11
|
-
|
13
|
+
def email_find_by_name(name, options = {})
|
14
|
+
email_find({
|
15
|
+
:name => name,
|
16
|
+
}.merge(options))
|
12
17
|
end
|
13
18
|
|
14
|
-
def
|
15
|
-
|
19
|
+
def email_find_by_subject(subject, options = {})
|
20
|
+
email_find({
|
21
|
+
:subject => subject,
|
22
|
+
}.merge(options))
|
16
23
|
end
|
17
24
|
|
18
|
-
def
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def email_search(filter = :all, value = '', get_body = false)
|
25
|
-
# ExactTarget does not return more than one email
|
26
|
-
# for any search besides all. So we must grab the
|
27
|
-
# entire list and search here (slow, but necessary).
|
28
|
-
|
29
|
-
@action = 'retrieve'
|
25
|
+
def email_find(options = {})
|
26
|
+
@action = 'retrieve'
|
30
27
|
@sub_action = 'all'
|
31
|
-
@type
|
32
|
-
@value
|
28
|
+
@type = ''
|
29
|
+
@value = ''
|
30
|
+
|
31
|
+
id = options[:id] || false
|
32
|
+
name = options[:name] || false
|
33
|
+
subject = options[:subject] || false
|
34
|
+
start_date = options[:start] || false
|
35
|
+
end_date = options[:end] || false
|
36
|
+
get_body = options[:body] || false
|
37
|
+
list = []
|
38
|
+
|
39
|
+
format = Proc.new { |date|
|
40
|
+
begin
|
41
|
+
date if date.instance_of? Date
|
42
|
+
Date.strptime(date, '%m/%d/%Y')
|
43
|
+
rescue
|
44
|
+
raise '[ExactTarget] Error: Invalid date.'
|
45
|
+
end
|
46
|
+
}
|
33
47
|
|
34
|
-
list = []
|
35
48
|
Nokogiri::Slop(send(render(:email)))
|
36
49
|
.exacttarget
|
37
50
|
.system
|
38
51
|
.email
|
39
52
|
.emaillist.each do |email|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
53
|
+
(next if email.emailid.content != id.to_s) if id
|
54
|
+
(next if !email.emailname.content.include? name.to_s) if name
|
55
|
+
(next if !email.emailsubject.content.include? subject.to_s) if subject
|
56
|
+
|
57
|
+
date = format.call(email.emailcreateddate.content)
|
46
58
|
|
47
|
-
|
59
|
+
(next if date < format.call(start_date)) if start_date
|
60
|
+
(next if date > format.call(end_date)) if end_date
|
61
|
+
|
62
|
+
body = email_get_body(email.emailid.content) if get_body
|
48
63
|
|
49
64
|
email.instance_eval do
|
50
|
-
|
65
|
+
new = {
|
51
66
|
:id => emailid.content,
|
52
67
|
:name => emailname.content,
|
53
68
|
:subject => emailsubject.content,
|
54
|
-
:
|
55
|
-
:
|
69
|
+
:date => email.emailcreateddate.content,
|
70
|
+
:category_id => categoryid.content
|
56
71
|
}
|
72
|
+
|
73
|
+
new[:body] = body if get_body
|
74
|
+
list << new
|
57
75
|
end
|
58
76
|
end
|
59
77
|
|
60
78
|
list
|
61
79
|
end
|
62
80
|
|
81
|
+
private
|
82
|
+
|
63
83
|
def email_get_body(id)
|
64
|
-
@action
|
84
|
+
@action = 'retrieve'
|
65
85
|
@sub_action = 'htmlemail'
|
66
|
-
@type
|
67
|
-
@value
|
86
|
+
@type = 'emailid'
|
87
|
+
@value = id.to_s
|
68
88
|
|
69
89
|
begin
|
70
90
|
Nokogiri::XML(send(render(:email)))
|
@@ -75,5 +95,4 @@ module ExactTarget
|
|
75
95
|
end
|
76
96
|
|
77
97
|
end
|
78
|
-
|
79
98
|
end
|
@@ -1,22 +1,20 @@
|
|
1
1
|
<system>
|
2
|
+
|
2
3
|
<system_name>email</system_name>
|
3
4
|
<action><%= @action %></action>
|
4
5
|
<sub_action><%= @sub_action %></sub_action>
|
6
|
+
|
5
7
|
<% if @action == 'retrieve' %>
|
6
8
|
<search_type><%= @type %></search_type>
|
7
9
|
<search_value><%= @value %></search_value>
|
8
10
|
<search_value2></search_value2>
|
9
11
|
<% if @sub_action == 'all' %>
|
10
|
-
<daterange>
|
11
|
-
<% if @type == 'daterange' || @type == 'emailnameanddaterange' %>
|
12
|
-
<startdate><%= @start_date %></startdate>
|
13
|
-
<enddate><%= @end_date %></enddate>
|
14
|
-
<% end %>
|
15
|
-
</daterange>
|
12
|
+
<daterange></daterange>
|
16
13
|
<% else %>
|
17
14
|
<search_value3></search_value3>
|
18
15
|
<% end %>
|
19
16
|
<% end %>
|
17
|
+
|
20
18
|
<% if @action == 'add' %>
|
21
19
|
<% if @sub_action == 'HTMLPaste' %>
|
22
20
|
<category></category>
|
@@ -32,4 +30,5 @@
|
|
32
30
|
<email_body><![ CDATA[<%= @body %>]]></email_body>
|
33
31
|
<% end %>
|
34
32
|
<% end %>
|
33
|
+
|
35
34
|
</system>
|
data/lib/exacttarget.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
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: -1942609719604810864
|
129
129
|
segments:
|
130
130
|
- 0
|
131
131
|
version: "0"
|