2015-02-19 00:02:57 -05:00
|
|
|
require 'slack-notifier'
|
|
|
|
|
2015-02-20 08:49:26 -05:00
|
|
|
class SlackService
|
|
|
|
class BaseMessage
|
2015-02-19 00:02:57 -05:00
|
|
|
def initialize(params)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def pretext
|
|
|
|
format(message)
|
|
|
|
end
|
|
|
|
|
2015-12-07 07:23:23 -05:00
|
|
|
def fallback
|
|
|
|
end
|
|
|
|
|
2015-02-19 00:02:57 -05:00
|
|
|
def attachments
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def message
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def format(string)
|
|
|
|
Slack::Notifier::LinkFormatter.format(string)
|
|
|
|
end
|
|
|
|
|
|
|
|
def attachment_color
|
|
|
|
'#345'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|