lib/flapjack/data/notification.rb in flapjack-0.7.1 vs lib/flapjack/data/notification.rb in flapjack-0.7.2
- old
+ new
@@ -4,14 +4,16 @@
module Flapjack
module Data
class Notification
- attr_accessor :event, :type
+ attr_accessor :event, :type, :max_notified_severity
def self.for_event(event, opts = {})
- self.new(:event => event, :type => opts[:type])
+ self.new(:event => event,
+ :type => opts[:type],
+ :max_notified_severity => opts[:max_notified_severity])
end
def messages(opts = {})
contacts = opts[:contacts]
return [] if contacts.nil?
@@ -26,23 +28,25 @@
}
}.flatten
end
def contents
- @contents ||= {'event_id' => event.id,
- 'state' => event.state,
- 'summary' => event.summary,
- 'time' => event.time,
- 'duration' => event.duration || nil,
- 'notification_type' => type}
+ @contents ||= {'event_id' => event.id,
+ 'state' => event.state,
+ 'summary' => event.summary,
+ 'time' => event.time,
+ 'duration' => event.duration || nil,
+ 'notification_type' => type,
+ 'max_notified_severity' => max_notified_severity }
end
private
def initialize(opts = {})
raise "Event not passed" unless event = opts[:event]
@event = event
@type = opts[:type]
+ @max_notified_severity = opts[:max_notified_severity]
end
end
end
end