Class: Idid::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/idid/delivery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Delivery

Public: Initialize a new Delivery. It will automatically set the correct delivery options

config - The Hash options to use when sending the email to iDoneThis

Returns a new instance of Delivery



12
13
14
15
# File 'lib/idid/delivery.rb', line 12

def initialize(config)
  @config = config
  setup_delivery
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



4
5
6
# File 'lib/idid/delivery.rb', line 4

def config
  @config
end

Instance Method Details

#email(message) ⇒ Object

Public: Send email to iDoneThis for logging

message - The String with the actual activity you want to log

Returns Mail::Message object



22
23
24
25
26
27
28
29
30
31
# File 'lib/idid/delivery.rb', line 22

def email(message)
  config = @config # Needed because @config is not in the block scope below

  Mail.deliver do
    from    config.email
    to      config.idonethis_email
    subject "I did this"
    body    message
  end
end