Class: MicrosoftTeams::Notifier
- Inherits:
-
Object
- Object
- MicrosoftTeams::Notifier
- Defined in:
- lib/microsoft_teams/notifier.rb
Instance Method Summary collapse
-
#initialize(webhook) ⇒ Notifier
constructor
A new instance of Notifier.
- #ping(options = {}) ⇒ Object
Constructor Details
#initialize(webhook) ⇒ Notifier
Returns a new instance of Notifier.
5 6 7 8 |
# File 'lib/microsoft_teams/notifier.rb', line 5 def initialize(webhook) @webhook = webhook @header = { 'Content-type' => 'application/json' } end |
Instance Method Details
#ping(options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/microsoft_teams/notifier.rb', line 10 def ping( = {}) result = false begin response = Gitlab::HTTP.post( @webhook.to_str, headers: @header, body: body(**) ) result = true if response rescue Gitlab::HTTP::Error, StandardError => error Gitlab::AppLogger.info("#{self.class.name}: Error while connecting to #{@webhook}: #{error.}") end result end |