Class: Upcloudify
- Inherits:
-
Object
- Object
- Upcloudify
- Defined in:
- lib/upcloudify.rb,
lib/notifiers/slack.rb,
lib/upcloudify/version.rb
Defined Under Namespace
Modules: Notifiers Classes: S3
Constant Summary collapse
- VERSION =
"0.3.3"
Instance Method Summary collapse
-
#initialize(uploader: nil, notifier: nil) ⇒ Upcloudify
constructor
A new instance of Upcloudify.
- #upload_and_notify(filename: nil, attachment: nil, message: "%s") ⇒ Object
Constructor Details
#initialize(uploader: nil, notifier: nil) ⇒ Upcloudify
Returns a new instance of Upcloudify.
13 14 15 16 17 18 |
# 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 |
Instance Method Details
#upload_and_notify(filename: nil, attachment: nil, message: "%s") ⇒ Object
20 21 22 23 24 25 26 27 |
# 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 expiration = (Date.today + 7).to_time file = @uploader.upload(filename, ) @notifier.notify(text: % file.url(expiration)) end |