Method: Upcloudify::S3#email
- Defined in:
- lib/upcloudify.rb
#email(email_address, filename, attachment, options = { suffix: "", expiration: (Date.today + 7).to_time, from: 'upcloudify', subject: 'your file is attached', body: 'your report is linked ' }) ⇒ Object
Uploads a file to S3 and emails a link to the file. Returns nothing.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/upcloudify.rb', line 83 def email(email_address, filename, , = { suffix: "", expiration: (Date.today + 7).to_time, from: 'upcloudify', subject: 'your file is attached', body: 'your report is linked ' } ) suffix = [:suffix] expiration = [:expiration] file = upload((filename.to_s + suffix.to_s), ) Pony.mail to: email_address, from: [:from], subject: [:subject], body: ([:body] || '') + file.url(expiration) + ' ' end |