lib/vidar/slack_notification.rb in vidar-0.12.1 vs lib/vidar/slack_notification.rb in vidar-0.13.0

- old
+ new

@@ -4,10 +4,11 @@ @github = github @revision = revision @revision_name = revision_name @deploy_name = deploy_config.name @deploy_url = deploy_config.url + @default_color = deploy_config.default_color @success_color = deploy_config.success_color @failure_color = deploy_config.failure_color @webhook_url = deploy_config.slack_webhook_url @connection = Faraday.new end @@ -24,10 +25,14 @@ def success message = "Successful deploy of #{github_link} to #{deploy_link}" perform_with data(message: message, color: success_color) end + def deliver(message:, color: default_color) + perform_with data(message: message, color: color) + end + def perform_with(data) connection.post do |req| req.url webhook_url req.headers['Content-Type'] = 'application/json' req.body = data.to_json @@ -36,10 +41,10 @@ private attr_reader :github, :revision, :revision_name, :deploy_name, :deploy_url, :webhook_url, - :success_color, :failure_color, + :default_color, :success_color, :failure_color, :connection def data(message:, color:) { "attachments": [