Class: Notifier

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/notifier.rb

Instance Method Summary collapse

Instance Method Details

#daily(client_id) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/mailers/notifier.rb', line 4

def daily(client_id)
  @client = Client.find(client_id)
  @hours = WorkUnit.for_client(@client).sum(:hours)
  @uninvoiced_hours = WorkUnit.for_client(@client).not_invoiced.sum(:hours)
  mail(:to => Contact.for_client(@client).receives_email.map(&:email_address),
       :bcc => ["[email protected]"],
       :subject => 'Daily Hours Summary') {|f| f.text}
end

#work_unit_notification(work_unit_id, addresses) ⇒ Object



13
14
15
16
17
# File 'app/mailers/notifier.rb', line 13

def work_unit_notification(work_unit_id, addresses)
  addresses += %w([email protected] [email protected])
  @work_unit = WorkUnit.find work_unit_id
  mail(:bcc => addresses, :subject => "[Xrono] Work Unit: #{@work_unit.guid}") {|f| f.text}
end