Class: Mallet::Mail
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Mallet::Mail
- Includes:
- Workflow
- Defined in:
- lib/mallet/mail.rb
Class Method Summary collapse
Instance Method Summary collapse
- #bounce ⇒ Object
- #complain ⇒ Object
- #deliver ⇒ Object
- #drop ⇒ Object
- #error ⇒ Object
- #malletable ⇒ Object
- #malletable=(thing) ⇒ Object
- #success ⇒ Object
- #validate ⇒ Object
Class Method Details
.for(malletable) ⇒ Object
8 9 10 |
# File 'lib/mallet/mail.rb', line 8 def self.for(malletable) where(malletable_type: malletable.class.name, malletable_id: malletable.id) end |
Instance Method Details
#bounce ⇒ Object
93 94 95 |
# File 'lib/mallet/mail.rb', line 93 def bounce Hooks.on_bounce(self) end |
#complain ⇒ Object
101 102 103 |
# File 'lib/mallet/mail.rb', line 101 def complain Hooks.on_complain(self) end |
#deliver ⇒ Object
80 81 82 83 |
# File 'lib/mallet/mail.rb', line 80 def deliver validate Hooks.on_deliver(self) end |
#drop ⇒ Object
97 98 99 |
# File 'lib/mallet/mail.rb', line 97 def drop Hooks.on_drop(self) end |
#error ⇒ Object
85 86 87 |
# File 'lib/mallet/mail.rb', line 85 def error Hooks.on_error(self) end |
#malletable ⇒ Object
67 68 69 |
# File 'lib/mallet/mail.rb', line 67 def malletable malletable_type.constantize.find(malletable_id) end |
#malletable=(thing) ⇒ Object
71 72 73 74 |
# File 'lib/mallet/mail.rb', line 71 def malletable=(thing) self.malletable_type = thing.class.name self.malletable_id = thing.id end |
#success ⇒ Object
89 90 91 |
# File 'lib/mallet/mail.rb', line 89 def success Hooks.on_success(self) end |
#validate ⇒ Object
76 77 78 |
# File 'lib/mallet/mail.rb', line 76 def validate raise Exception unless DEFINITIONS.has_key?(definition) end |