123456789101112131415161718192021222324252627282930313233343536373839 |
- require "../support/requester"
- require "time"
- class MattermostNotifier
- class << self
- def review_message(results)
- color_map = {
- 1 => 'danger',
- 2 => '#ff4500',
- 3 => 'warning',
- 4 => '#9acd32',
- 5 => 'good',
- }
- text = "|QA_Test|Status: Mac Web, #{Time.now.strftime('%Y-%m-%d_%H.%M.%S')}|Link|\n"
- text+= "|:---|:---|:---|\n"
- text+= results
- content = {
- attachments: [
- {
- color: color_map[5],
- text: text
- }
- ]
- }
- #find which channel should go
- publish(content, "/hooks/d8i7w5sktfr5i864bcqsc8ieto")
- end
- private
- def publish(message_content, path)
- host = Requester.new('http://chat.kdanmobile.com')
- host.json_send(:post, path, message_content)
- end
-
- end
- end
|