lib/backup/notifier/http_post.rb in backup-4.1.12 vs lib/backup/notifier/http_post.rb in backup-4.2.0
- old
+ new
@@ -93,21 +93,16 @@
# `: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 :failure then '[Backup::Failure]'
- when :warning then '[Backup::Warning]'
- end
- message = "#{ tag } #{ model.label } (#{ model.trigger })"
+ msg = message.call(model, :status => status_data_for(status))
opts = {
:headers => { 'User-Agent' => "Backup/#{ VERSION }" }.
merge(headers).reject {|k,v| v.nil? }.
merge('Content-Type' => 'application/x-www-form-urlencoded'),
- :body => URI.encode_www_form({ 'message' => message }.
+ :body => URI.encode_www_form({ 'message' => msg }.
merge(params).reject {|k,v| v.nil? }.
merge('status' => status.to_s)),
:expects => success_codes # raise error if unsuccessful
}
opts.merge!(:ssl_verify_peer => ssl_verify_peer) unless ssl_verify_peer.nil?