fusionary-mail_logger 0.1.4 → 0.1.5

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/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
  require 'rake/testtask'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new("mail_logger", "0.1.4") do |p|
6
+ Echoe.new("mail_logger", "0.1.5") do |p|
7
7
  p.description = "Braindead-simple email logger for ActionMailer using ActiveRecord"
8
8
  p.url = "http://github.com/fusionary/mail_logger"
9
9
  p.author = ["Fusionary Media", "Josh Clayton"]
@@ -8,15 +8,24 @@ module MailLogger
8
8
 
9
9
  module ClassMethods
10
10
  def create_from_mail(email)
11
+ ensure_object_is_email(email)
12
+ ensure_required_attributes_are_assigned(email)
13
+
14
+ self.create(:to => email.to.join(", "), :from => email.from.join(", "), :subject => email.subject, :body => email.quoted_body, :message => email.encoded)
15
+ end
16
+
17
+ private
18
+
19
+ def ensure_object_is_email(email)
11
20
  [:to, :from, :subject, :quoted_body, :encoded].each do |att|
12
21
  raise(ArgumentError, "object is not an email") unless email.respond_to?(att)
13
22
  end
14
-
23
+ end
24
+
25
+ def ensure_required_attributes_are_assigned(email)
15
26
  [:to, :from].each do |required_att|
16
27
  raise(ArgumentError, "email does not have attribute '#{required_att}' assigned") if email.send(required_att).blank?
17
28
  end
18
-
19
- self.create(:to => email.to.join(", "), :from => email.from.join(", "), :subject => email.subject, :body => email.quoted_body, :message => email.encoded)
20
29
  end
21
30
  end
22
31
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{mail_logger}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Fusionary Media, Josh Clayton"]
9
- s.date = %q{2009-04-23}
9
+ s.date = %q{2009-05-15}
10
10
  s.description = %q{Braindead-simple email logger for ActionMailer using ActiveRecord}
11
11
  s.email = %q{joshua.clayton@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/mail_logger/app/models/mail_log.rb", "lib/mail_logger/lib/extensions/action_mailer.rb", "lib/mail_logger.rb", "README.textile"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusionary-mail_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fusionary Media, Josh Clayton
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-23 00:00:00 -07:00
12
+ date: 2009-05-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency