Class: Upcloudify

Inherits:
Object
  • Object
show all
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"

Instance Method Summary collapse

Constructor Details

#initialize(uploader:, notifier:) ⇒ Upcloudify

Returns a new instance of Upcloudify.



13
14
15
16
# File 'lib/upcloudify.rb', line 13

def initialize(uploader:, notifier:)
  @uploader = uploader
  @notifier = notifier
end

Instance Method Details

#upload_and_notify(filename:, attachment:, message: "%s") ⇒ Object



18
19
20
21
22
# File 'lib/upcloudify.rb', line 18

def upload_and_notify(filename:, attachment:, message: "%s")
  expiration = (Date.today + 7).to_time
  file = @uploader.upload(filename, attachment)
  @notifier.notify(text: message % file.url(expiration))
end