lib/backup/notifier/twitter.rb in backup-4.1.12 vs lib/backup/notifier/twitter.rb in backup-4.2.0
- old
+ new
@@ -36,16 +36,10 @@
# `:failure`
# : The backup operation failed.
# : Notification will be sent if `on_warning` or `on_success` is `true`.
#
def notify!(status)
- tag = case status
- when :success then '[Backup::Success]'
- when :warning then '[Backup::Warning]'
- when :failure then '[Backup::Failure]'
- end
- message = "#{ tag } #{ model.label } (#{ model.trigger }) (@ #{ model.time })"
- send_message(message)
+ send_message(message.call(model, :status => status_data_for(status)))
end
# Twitter::Client will raise an error if unsuccessful.
def send_message(message)
client = ::Twitter::REST::Client.new do |config|