Class: Rivendell::Import::Notifier::Mail
- Defined in:
- lib/rivendell/import/notifier/mail.rb
Defined Under Namespace
Classes: Message
Constant Summary collapse
- @@from =
nil
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#from ⇒ Object
Returns the value of attribute from.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #create_message(tasks) ⇒ Object
- #notify!(tasks) ⇒ Object
-
#parameters ⇒ Object
def valid? [from, to, subject, body].all?(&:present?) end.
- #template(definition) ⇒ Object
Methods inherited from Base
#delay, #logger, #notify, notify, #parameters=, #parameters_hash, #raw_parameters, #read_parameters, #write_parameters
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
10 11 12 |
# File 'lib/rivendell/import/notifier/mail.rb', line 10 def body @body end |
#from ⇒ Object
Returns the value of attribute from.
10 11 12 |
# File 'lib/rivendell/import/notifier/mail.rb', line 10 def from @from end |
#subject ⇒ Object
Returns the value of attribute subject.
10 11 12 |
# File 'lib/rivendell/import/notifier/mail.rb', line 10 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
10 11 12 |
# File 'lib/rivendell/import/notifier/mail.rb', line 10 def to @to end |
Instance Method Details
#create_message(tasks) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/rivendell/import/notifier/mail.rb', line 28 def (tasks) Message.new(tasks).tap do |mail| mail.from = from mail.to = to mail.subject = template(subject) mail.body = template(body) end end |
#notify!(tasks) ⇒ Object
24 25 26 |
# File 'lib/rivendell/import/notifier/mail.rb', line 24 def notify!(tasks) (tasks).deliver! end |
#parameters ⇒ Object
def valid?
[from, to, subject, body].all?(&:present?)
end
87 88 89 90 91 92 93 |
# File 'lib/rivendell/import/notifier/mail.rb', line 87 def parameters %w{from to subject body}.inject({}) do |map, attribute| value = send attribute map[attribute] = value if value map end end |