Class: Mailpeek::Delivery
- Inherits:
-
Object
- Object
- Mailpeek::Delivery
- Includes:
- Mail::CheckDeliveryParams
- Defined in:
- lib/mailpeek/delivery.rb
Overview
Public: Delivery
Defined Under Namespace
Classes: InvalidOption
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #deliver!(mail) ⇒ Object
-
#initialize(options = {}) ⇒ Delivery
constructor
A new instance of Delivery.
Constructor Details
#initialize(options = {}) ⇒ Delivery
Returns a new instance of Delivery.
12 13 14 15 16 17 18 19 |
# File 'lib/mailpeek/delivery.rb', line 12 def initialize( = {}) if [:location].nil? raise( InvalidOption, 'A location option is required when using Mailpeek') end self.settings = end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
10 11 12 |
# File 'lib/mailpeek/delivery.rb', line 10 def settings @settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mailpeek/delivery.rb', line 21 def deliver!(mail) check_delivery_params(mail) if respond_to?(:check_delivery_params) FileUtils.mkdir_p(settings[:location]) filepath = File.join(settings[:location], Time.now.to_i.to_s) File.open(filepath, 'w') do |f| f.write mail.to_s end end |