exacttarget 0.1.0 → 0.1.1

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 CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/exacttarget.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{exacttarget}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthew Simpson"]
@@ -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
- <% if @method == 'file' %>
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
- - 0
9
- version: 0.1.0
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: -1942609719604810864
128
+ hash: -4363040574825173026
129
129
  segments:
130
130
  - 0
131
131
  version: "0"