Class: Upcloudify::Notifiers::Slack
- Inherits:
-
Object
- Object
- Upcloudify::Notifiers::Slack
- Defined in:
- lib/notifiers/slack.rb
Instance Method Summary collapse
-
#initialize(to: nil, url:) ⇒ Slack
constructor
A new instance of Slack.
- #notify(text: nil) ⇒ Object
- #payload ⇒ Object
Constructor Details
#initialize(to: nil, url:) ⇒ Slack
Returns a new instance of Slack.
6 7 8 9 |
# File 'lib/notifiers/slack.rb', line 6 def initialize(to: nil, url:) @url = url @to = to end |
Instance Method Details
#notify(text: nil) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/notifiers/slack.rb', line 11 def notify(text: nil) HTTParty.post( @url, headers: {"Content-Type" => content_type}, body: payload.merge(text: text).to_json ) end |
#payload ⇒ Object
19 20 21 |
# File 'lib/notifiers/slack.rb', line 19 def payload { channel: @to } end |