Class: Notification::Api
- Inherits:
-
Object
- Object
- Notification::Api
- Defined in:
- lib/capistrano/ops/rails/lib/notification/api.rb
Instance Attribute Summary collapse
-
#notification_level ⇒ Object
Returns the value of attribute notification_level.
-
#notification_type ⇒ Object
Returns the value of attribute notification_type.
Instance Method Summary collapse
-
#initialize(notification_type: ENV['NOTIFICATION_TYPE'], notification_level: ENV['NOTIFICATION_LEVEL']) ⇒ Api
constructor
A new instance of Api.
- #send_backup_notification(result, title, content, webhook_data = nil) ⇒ Object
- #send_notification(message) ⇒ Object
Constructor Details
#initialize(notification_type: ENV['NOTIFICATION_TYPE'], notification_level: ENV['NOTIFICATION_LEVEL']) ⇒ Api
Returns a new instance of Api.
7 8 9 10 |
# File 'lib/capistrano/ops/rails/lib/notification/api.rb', line 7 def initialize(notification_type: ENV['NOTIFICATION_TYPE'], notification_level: ENV['NOTIFICATION_LEVEL']) self.notification_type = notification_type self.notification_level = notification_level || 'error' end |
Instance Attribute Details
#notification_level ⇒ Object
Returns the value of attribute notification_level.
5 6 7 |
# File 'lib/capistrano/ops/rails/lib/notification/api.rb', line 5 def notification_level @notification_level end |
#notification_type ⇒ Object
Returns the value of attribute notification_type.
5 6 7 |
# File 'lib/capistrano/ops/rails/lib/notification/api.rb', line 5 def notification_type @notification_type end |
Instance Method Details
#send_backup_notification(result, title, content, webhook_data = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/capistrano/ops/rails/lib/notification/api.rb', line 12 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 |