class Upcloudify
Constants
- VERSION
Public Class Methods
new(uploader: nil, notifier: nil)
click to toggle source
# File lib/upcloudify.rb, line 13 def initialize(uploader: nil, notifier: nil) raise ArgumentError "uploader cannot be nil" unless uploader raise ArgumentError "notifier cannot be nil" unless notifier @uploader = uploader @notifier = notifier end
Public Instance Methods
upload_and_notify(filename: nil, attachment: nil, message: "%s")
click to toggle source
# File lib/upcloudify.rb, line 20 def upload_and_notify(filename: nil, attachment: nil, message: "%s") raise ArgumentError "filename cannot be nil" unless filename raise ArgumentError "attachment cannot be nil" unless attachment expiration = (Date.today + 7).to_time file = @uploader.upload(filename, attachment) @notifier.notify(text: message % file.url(expiration)) end