Class: DogWatch::Model::Options
- Inherits:
-
Object
- Object
- DogWatch::Model::Options
- Defined in:
- lib/dogwatch/model/options.rb
Overview
Handles the options block methods
Constant Summary collapse
- MONITOR_TYPE_OPTIONS_MAP =
{ :metric_alert => [:thresholds].freeze, :service_check => [:thresholds].freeze }.freeze
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
- #escalation_message(message) ⇒ Object
- #include_tags(include = true) ⇒ Object
-
#initialize(monitor_type = nil) ⇒ Options
constructor
A new instance of Options.
- #no_data_timeframe(minutes) ⇒ Object
- #notify_audit(notify = false) ⇒ Object
- #notify_no_data(notify = false) ⇒ Object
- #render ⇒ Object
- #renotify_interval(minutes) ⇒ Object
- #silenced(args) ⇒ Object
- #thresholds(thresholds) ⇒ Object
- #timeout_h(hours) ⇒ Object
Constructor Details
#initialize(monitor_type = nil) ⇒ Options
Returns a new instance of Options.
19 20 21 22 |
# File 'lib/dogwatch/model/options.rb', line 19 def initialize(monitor_type = nil) @attributes = OpenStruct.new @monitor_type = monitor_type end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
14 15 16 |
# File 'lib/dogwatch/model/options.rb', line 14 def attributes @attributes end |
Instance Method Details
#escalation_message(message) ⇒ Object
54 55 56 |
# File 'lib/dogwatch/model/options.rb', line 54 def () @attributes. = .to_s end |
#include_tags(include = true) ⇒ Object
64 65 66 |
# File 'lib/dogwatch/model/options.rb', line 64 def (include = true) @attributes. = !!include end |
#no_data_timeframe(minutes) ⇒ Object
39 40 41 |
# File 'lib/dogwatch/model/options.rb', line 39 def no_data_timeframe(minutes) @attributes.no_data_timeframe = minutes.to_i end |
#notify_audit(notify = false) ⇒ Object
59 60 61 |
# File 'lib/dogwatch/model/options.rb', line 59 def notify_audit(notify = false) @attributes.notify_audit = !!notify end |
#notify_no_data(notify = false) ⇒ Object
34 35 36 |
# File 'lib/dogwatch/model/options.rb', line 34 def notify_no_data(notify = false) @attributes.notify_no_data = !!notify end |
#render ⇒ Object
24 25 26 |
# File 'lib/dogwatch/model/options.rb', line 24 def render @attributes.each_pair.to_h end |
#renotify_interval(minutes) ⇒ Object
49 50 51 |
# File 'lib/dogwatch/model/options.rb', line 49 def renotify_interval(minutes) @attributes.renotify_interval = minutes.to_i end |
#silenced(args) ⇒ Object
29 30 31 |
# File 'lib/dogwatch/model/options.rb', line 29 def silenced(args) @attributes.silenced = args.to_h end |
#thresholds(thresholds) ⇒ Object
69 70 71 72 |
# File 'lib/dogwatch/model/options.rb', line 69 def thresholds(thresholds) validate_monitor_type_specific_option!(:thresholds) @attributes.thresholds = thresholds end |
#timeout_h(hours) ⇒ Object
44 45 46 |
# File 'lib/dogwatch/model/options.rb', line 44 def timeout_h(hours) @attributes.timeout_h = hours.to_i end |