Class: SlackErrorNotifier::SlackNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/slack_error_notifier/slack_notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ SlackNotification

Returns a new instance of SlackNotification.



3
4
5
# File 'lib/slack_error_notifier/slack_notification.rb', line 3

def initialize(error)
  @error = error
end

Class Method Details

.send(error) ⇒ Object



7
8
9
# File 'lib/slack_error_notifier/slack_notification.rb', line 7

def self.send(error)
  new(error).send
end

Instance Method Details

#sendObject



11
12
13
14
15
16
17
18
# File 'lib/slack_error_notifier/slack_notification.rb', line 11

def send
  slack_client.chat_postMessage(
    channel: target_channel,
    text: "",
    attachments: attachments,
    as_user: send_as_user
  )
end