Sha256: dcd3fe5eb57959cc27a0ef548364d2fbc90808e1ba5e9b9d6477e2d194f42d41
Contents?: true
Size: 948 Bytes
Versions: 21
Compression:
Stored size: 948 Bytes
Contents
# frozen_string_literal: true module Notification class Api attr_accessor :notification_type, :notification_level def initialize(notification_type: ENV['NOTIFICATION_TYPE'], notification_level: ENV['NOTIFICATION_LEVEL']) self.notification_type = notification_type self.notification_level = notification_level || 'error' end def send_backup_notification(result, title, content, webhook_data = nil) return if notification_type.nil? case notification_type when 'slack' Slack.new.backup_notification(result, title, content, notification_level) when 'webhook' Webhook.new.backup_notification(result, webhook_data, notification_level) end end def send_notification(message) return if notification_type.nil? case notification_type when 'slack' Slack.new.notify(message) when 'webhook' p 'webhook' end end end end
Version data entries
21 entries across 21 versions & 1 rubygems