madmimi 1.0.3 → 1.0.4

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
- 1.0.3
1
+ 1.0.4
data/lib/madmimi.rb CHANGED
@@ -29,11 +29,11 @@
29
29
  require 'uri'
30
30
  require 'net/http'
31
31
  require 'net/https'
32
- require 'active_support' # I want to find a way to get away from this, yet I love the Hash.from_xml method!
32
+ require 'active_support'
33
33
 
34
34
  class MadMimi
35
35
 
36
- BASE_URL = "api.madmimi.com"
36
+ BASE_URL = "madmimi.com"
37
37
  NEW_LISTS_PATH = "/audience_lists"
38
38
  AUDIENCE_MEMBERS_PATH = "/audience_members"
39
39
  AUDIENCE_LISTS_PATH = "/audience_lists/lists.xml"
@@ -181,4 +181,22 @@ class MadMimi
181
181
  opt['body'] = yaml_body.to_yaml
182
182
  do_request('/mailer', :post, opt.merge(default_opt), true)
183
183
  end
184
+
185
+ def send_html(opt, html)
186
+ if html.include?('[[tracking_beacon]]') || html.include?('[[peek_image]]')
187
+ opt['raw_html'] = html
188
+ do_request('/mailer', :post, opt.merge(default_opt), true)
189
+ else
190
+ raise StandardError, "You'll need to include either the [[tracking_beacon]] or [[peek_image]] tag in your HTML before sending."
191
+ end
192
+ end
193
+
194
+ def send_plaintext(opt, plaintext)
195
+ if plaintext.include?('[[unsubscribe]]')
196
+ opt['raw_plain_text'] = plaintext
197
+ do_request('/mailer', :post, opt.merge(default_opt), true)
198
+ else
199
+ raise StandardError, "You'll need to include either the [[unsubscribe]] tag in your text before sending."
200
+ end
201
+ end
184
202
  end
data/madmimi.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{madmimi}
8
- s.version = "1.0.3"
8
+ s.version = "1.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nicholas Young"]
12
- s.date = %q{2010-05-01}
12
+ s.date = %q{2010-05-02}
13
13
  s.description = %q{Send emails, track statistics, and manage your subscriber base with ease.}
14
14
  s.email = %q{nicholas@madmimi.com}
15
15
  s.extra_rdoc_files = [
@@ -23,8 +23,10 @@ Gem::Specification.new do |s|
23
23
  "VERSION",
24
24
  "lib/madmimi.rb",
25
25
  "madmimi.gemspec",
26
+ "mimi_test.rb",
26
27
  "pkg/madmimi-1.0.0.gem",
27
28
  "pkg/madmimi-1.0.1.gem",
29
+ "pkg/madmimi-1.0.3.gem",
28
30
  "test/helper.rb",
29
31
  "test/test_madmimi.rb"
30
32
  ]
data/mimi_test.rb ADDED
@@ -0,0 +1,10 @@
1
+ require './lib/madmimi'
2
+
3
+ mimi = MadMimi.new('nicholas@nicholaswyoung.com', 'f745b56de62ab9b46f613173a10806fb')
4
+
5
+ opt = { 'promotion_name' => 'Test Plaintext', 'recipients' => 'nicholas young <nicholas@madmimi.com>', 'from' => 'mad mimi <rubyclass@madmimi.com>',
6
+ 'subject' => 'rock and roll!' }
7
+
8
+ plaintext = 'this is my plaintext [[unsubscribe]]'
9
+
10
+ mimi.send_plaintext(opt, plaintext)
Binary file
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 3
9
- version: 1.0.3
8
+ - 4
9
+ version: 1.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nicholas Young
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-01 00:00:00 -05:00
17
+ date: 2010-05-02 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -47,8 +47,10 @@ files:
47
47
  - VERSION
48
48
  - lib/madmimi.rb
49
49
  - madmimi.gemspec
50
+ - mimi_test.rb
50
51
  - pkg/madmimi-1.0.0.gem
51
52
  - pkg/madmimi-1.0.1.gem
53
+ - pkg/madmimi-1.0.3.gem
52
54
  - test/helper.rb
53
55
  - test/test_madmimi.rb
54
56
  has_rdoc: true