Class: Suc::Reports::Email
- Inherits:
-
Object
- Object
- Suc::Reports::Email
- Defined in:
- lib/reports/email.rb
Instance Method Summary collapse
- #cc_recipients ⇒ Object
- #export ⇒ Object
-
#initialize(report) ⇒ Email
constructor
A new instance of Email.
- #recipients ⇒ Object
- #subject ⇒ Object
Constructor Details
#initialize(report) ⇒ Email
Returns a new instance of Email.
7 8 9 |
# File 'lib/reports/email.rb', line 7 def initialize(report) @report = report end |
Instance Method Details
#cc_recipients ⇒ Object
19 20 21 |
# File 'lib/reports/email.rb', line 19 def cc_recipients Suc.email_cc_recipients end |
#export ⇒ Object
23 24 25 26 27 28 |
# File 'lib/reports/email.rb', line 23 def export headers = { 'subject' => escape(subject), 'body' => escape(@report.body)} headers.merge!({ 'cc' => cc_recipients }) if cc_recipients escaped_email = URI::MailTo.build({to: recipients, headers: headers}).to_s system(Suc.email_client, escaped_email) end |
#recipients ⇒ Object
15 16 17 |
# File 'lib/reports/email.rb', line 15 def recipients Suc.email_recipients || '[email protected]' end |
#subject ⇒ Object
11 12 13 |
# File 'lib/reports/email.rb', line 11 def subject "Work Report week##{@report.week} #{@report.year}" end |