Class: MailRoom::Mailbox
- Inherits:
-
Struct
- Object
- Struct
- MailRoom::Mailbox
- Defined in:
- lib/mail_room/mailbox.rb
Overview
Holds configuration for each of the email accounts we wish to monitor
and deliver email to when new emails arrive over imap
Instance Method Summary collapse
-
#deliver(message) ⇒ Object
deliver the imap email message.
-
#delivery_klass ⇒ Object
move to a mailbox deliverer class?.
-
#initialize(attributes = {}) ⇒ Mailbox
constructor
Store the configuration and require the appropriate delivery method.
Constructor Details
#initialize(attributes = {}) ⇒ Mailbox
Store the configuration and require the appropriate delivery method
19 20 21 22 23 |
# File 'lib/mail_room/mailbox.rb', line 19 def initialize(attributes={}) super(*attributes.values_at(*members)) require_relative("./delivery/#{(delivery_method || 'postback')}") end |
Instance Method Details
#deliver(message) ⇒ Object
deliver the imap email message
41 42 43 |
# File 'lib/mail_room/mailbox.rb', line 41 def deliver() delivery_klass.new(self).deliver(.attr['RFC822']) end |
#delivery_klass ⇒ Object
move to a mailbox deliverer class?
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mail_room/mailbox.rb', line 26 def delivery_klass case delivery_method when "noop" Delivery::Noop when "logger" Delivery::Logger when "letter_opener" Delivery::LetterOpener else Delivery::Postback end end |