Class: WatchDoge::Notification::Mattermost

Inherits:
Object
  • Object
show all
Defined in:
lib/watchdoge/notification/mattermost.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Mattermost

Returns a new instance of Mattermost.


10
11
12
13
14
15
16
# File 'lib/watchdoge/notification/mattermost.rb', line 10

def initialize args
  super

  @host = args[:host]
  @channel_id = args[:channel_id]
  @auth_token = args[:auth_token]
end

Instance Method Details

#flushObject


18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/watchdoge/notification/mattermost.rb', line 18

def flush
  @message_queue.each do |message|
    case message
    when String
      post matter_most_meta(message)
    when ChunkyPNG::Image
      post_file matter_most_meta(message)
    when WatchDoge::PixelTest
      post_file matter_most_meta(message.diff)
    end
  end

  @message_queue = []
end