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
- #deliver ⇒ 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
#deliver ⇒ Object
51 52 53 54 |
# File 'lib/mallet/mail.rb', line 51 def deliver validate Hooks.on_deliver(self) end |
#malletable ⇒ Object
38 39 40 |
# File 'lib/mallet/mail.rb', line 38 def malletable malletable_type.constantize.find(malletable_id) end |
#malletable=(thing) ⇒ Object
42 43 44 45 |
# File 'lib/mallet/mail.rb', line 42 def malletable=(thing) self.malletable_type = thing.class.name self.malletable_id = thing.id end |
#success ⇒ Object
68 69 70 |
# File 'lib/mallet/mail.rb', line 68 def success Hooks.on_success(self) end |
#validate ⇒ Object
47 48 49 |
# File 'lib/mallet/mail.rb', line 47 def validate raise Exception unless DEFINITIONS.has_key?(definition) end |