bjornblomqvist-emailer 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -12,6 +12,7 @@ begin
12
12
  gem.authors = ["Erik Hansson","Bjorn Blomqvist"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.4"
14
14
  gem.add_dependency('bjornblomqvist-tmail', '>= 0.0.2')
15
+ gem.add_dependency('uuid', '>= 2.0.2')
15
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
17
  end
17
18
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.9
data/emailer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{emailer}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Erik Hansson", "Bjorn Blomqvist"]
@@ -64,12 +64,15 @@ Gem::Specification.new do |s|
64
64
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
65
65
  s.add_development_dependency(%q<rspec>, [">= 1.2.4"])
66
66
  s.add_runtime_dependency(%q<bjornblomqvist-tmail>, [">= 0.0.2"])
67
+ s.add_runtime_dependency(%q<uuid>, [">= 2.0.2"])
67
68
  else
68
69
  s.add_dependency(%q<rspec>, [">= 1.2.4"])
69
70
  s.add_dependency(%q<bjornblomqvist-tmail>, [">= 0.0.2"])
71
+ s.add_dependency(%q<uuid>, [">= 2.0.2"])
70
72
  end
71
73
  else
72
74
  s.add_dependency(%q<rspec>, [">= 1.2.4"])
73
75
  s.add_dependency(%q<bjornblomqvist-tmail>, [">= 0.0.2"])
76
+ s.add_dependency(%q<uuid>, [">= 2.0.2"])
74
77
  end
75
78
  end
@@ -12,7 +12,7 @@ module Emailer
12
12
  attr_reader :sent
13
13
 
14
14
  def initialize(settings = {})
15
- @sent = []
15
+ @sent = {}
16
16
  super
17
17
  end
18
18
 
@@ -24,7 +24,7 @@ module Emailer
24
24
  # And save, don't send, mail...
25
25
  def send_mail(options)
26
26
  raise ConnectionNotOpenError unless @open
27
- @sent << options
27
+ @sent[UUID.new.to_s] << options
28
28
  true
29
29
  rescue ConnectionNotOpenError => e
30
30
  raise e
@@ -34,5 +34,29 @@ module Emailer
34
34
  false
35
35
  end
36
36
 
37
+
38
+
39
+ def get_url_for uuidString
40
+ return "/getemail/"+uuidString
41
+ end
42
+
43
+ def call(env)
44
+ if env["PATH_INFO"].index("/getemail/")
45
+
46
+ uuid = env["PATH_INFO"].sub("/getemail/".length)
47
+
48
+ return [200, {"Content-Type" => "text/plain"},['Emailer::SmtpFacade.default is not a MockSmtpFacade']] unless
49
+ Emailer::SmtpFacade.default && Emailer::SmtpFacade.default.instance_of? Emailer::MockSmtpFacade
50
+
51
+ return [200, {"Content-Type" => "text/plain"},['No email sent']] if Emailer::SmtpFacade.default.sent.count == 0
52
+
53
+ return [200, {"Content-Type" => "text/html"}, [Emailer::SmtpFacade.default.sent[uuid][:body].to_s]]
54
+ else
55
+ @app.call env
56
+ end
57
+ end
58
+
37
59
  end
38
60
  end
61
+
62
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bjornblomqvist-emailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Hansson
@@ -33,6 +33,16 @@ dependencies:
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.0.2
35
35
  version:
36
+ - !ruby/object:Gem::Dependency
37
+ name: uuid
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.0.2
45
+ version:
36
46
  description: ""
37
47
  email: erik@bits2life.com
38
48
  executables: []