mad_mimi_two 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -9,7 +9,7 @@ Why use Mad Mimi rather than action mailer? Primarily since it allows you to se
9
9
 
10
10
  == DESCRIPTION:
11
11
 
12
- Using Mad Mimi on rails 3. All of the elegant portions of the code are based on the original http://github.com/redsquirrel/mad_mimi_mailer by ethangunderson.
12
+ Using Mad Mimi on rails 3. All of the elegant portions of the code are based on the original http://github.com/redsquirrel/mad_mimi_mailer by ethangunderson. (MadMimiTwo also runs in Rails 2)
13
13
 
14
14
  All of the terrible stuff is by me. Apologies for taking an elegant solution and just crafting something that works.
15
15
 
@@ -18,7 +18,7 @@ All of the terrible stuff is by me. Apologies for taking an elegant solution an
18
18
  * FIX (list of features or problems)
19
19
  This has only been tested on Ruby 1.8.7.
20
20
  Testing on Ruby 1.9 required.
21
- Currently against rails 3 beta
21
+ Currently tested and working with rails 3 beta
22
22
 
23
23
 
24
24
  == SYNOPSIS:
@@ -59,6 +59,18 @@ IGNORE: warning: peer certificate won't be verified in this SSL session
59
59
  == Mail::Message
60
60
  As this is subclassed from Mail::Message I believe that other ways to create the message will also work (such as passing in hash, etc (see the documentation))
61
61
 
62
+ == Check Status of sent message
63
+ t=MadMimiTwo::MadMimiMessage.new
64
+ r=t.check_status('1159748168') # this is value from ID
65
+ r is 'Sent'
66
+
67
+ == RAILS 2:
68
+ NOTE, The same code works in Rails 2 as well.
69
+ except that you need to change environment.rb
70
+ config.gem 'mad_mimi_two'
71
+ and at the end of the environment.rb file:
72
+ insert the api settings.
73
+
62
74
  == REQUIREMENTS:
63
75
 
64
76
  gem activesupport
@@ -71,7 +83,7 @@ gem install mad_mimi_two (it is now up on rubygems.org)
71
83
 
72
84
  == RAILS TESTING:
73
85
 
74
- Apologies but this needs work. I have simple tests in my application but nothing spectaculre.
86
+ Apologies but this needs work. I have simple tests in my application but nothing spectacular.
75
87
 
76
88
  == LICENSE:
77
89
 
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ $hoe = Hoe.spec 'mad_mimi_two' do
16
16
  self.post_install_message = 'For more information on mad_mimi_two, see
17
17
  http://github.com/semdinsp/mad_mimi_two' # TODO remove if post-install message not required
18
18
  self.rubyforge_name = self.name # TODO this is default value
19
- # self.extra_deps = [['activesupport','>= 2.0.2']]
19
+ #self.add_dependency("httpclient")
20
20
 
21
21
  end
22
22
 
@@ -1,3 +1,14 @@
1
+ require 'cgi'
2
+ require 'rubygems'
3
+ gem 'httpclient'
4
+ require 'httpclient'
5
+ class Hash
6
+ def madmimiurlencode
7
+ to_a.map do |name_value|
8
+ name_value.map { |e| CGI.escape e.to_s }.join '='
9
+ end.join '&'
10
+ end
11
+ end
1
12
  module MadMimiTwo
2
13
  module MadMimiMailer
3
14
  SINGLE_SEND_URL = 'https://api.madmimi.com/mailer'
@@ -5,6 +16,17 @@ module MadMimiTwo
5
16
  def self.included(base)
6
17
  base.extend(ClassMethods)
7
18
  end
19
+ # check the status of a sent email
20
+ def check_status(msg_id)
21
+ url = "#{SINGLE_SEND_URL}s/status/#{msg_id}?#{MadMimiTwo::MadMimiMessage.api_settings.madmimiurlencode}"
22
+ begin
23
+ client= HTTPClient.new
24
+ res=client.get_content(url)
25
+ rescue HTTPClient::BadResponseError
26
+ res="problem retrieving status"
27
+ end
28
+ res
29
+ end
8
30
 
9
31
  # Custom Mailer attributes
10
32
 
data/lib/mad_mimi_two.rb CHANGED
@@ -3,5 +3,5 @@ $:.unshift(File.dirname(__FILE__)) unless
3
3
  Dir[File.join(File.dirname(__FILE__), 'mad_mimi_two/**/*.rb')].sort.each { |lib| require lib }
4
4
 
5
5
  module MadMimiTwo
6
- VERSION = '0.0.5'
6
+ VERSION = '0.0.6'
7
7
  end
@@ -49,9 +49,17 @@ class TestMadMimiTwo < Test::Unit::TestCase
49
49
  r=t.deliver_mimi_message
50
50
  puts "result: #{r} message: t.inspect"
51
51
  assert t.headers.size==0, "headers not empty"
52
- assert t.headers.size==0, "headers not empty"
53
52
  assert t[:to].to_s=='scott.sproule@ficonab.com', "to person not correct #{t[:to]}"
54
53
  assert t.promotion.to_s=='new_crm', 'promotion first wrong'
55
54
  #assert t[:promotion].to_s=='new_crm', 'promotion wrong'
56
55
  end
56
+ def test_check_status
57
+ # puts "message id: 1159748168" (old message id)
58
+ t=MadMimiTwo::MadMimiMessage.new
59
+ r=t.check_status('1159748168')
60
+ puts "'r is ' #{r}"
61
+ assert r.class==String, "response is not string r is: #{r} #{r.class}"
62
+ assert r=='Sent', "message response not correct: #{r}"
63
+
64
+ end
57
65
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mad_mimi_two
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Sproule
@@ -15,10 +15,23 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-23 00:00:00 +08:00
18
+ date: 2010-05-25 00:00:00 +08:00
19
19
  default_executable:
20
- dependencies: []
21
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: httpclient
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
22
35
  description: Update to the original madmimimailer gem to support the new actionmailer of rails3
23
36
  email: scott.sproule@estormtech.com
24
37
  executables: []