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 ⇒ Hash
- #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
55 56 57 |
# File 'lib/dogwatch/model/options.rb', line 55 def () @attributes. = .to_s end |
#include_tags(include = true) ⇒ Object
65 66 67 |
# File 'lib/dogwatch/model/options.rb', line 65 def (include = true) @attributes. = !!include end |
#no_data_timeframe(minutes) ⇒ Object
40 41 42 |
# File 'lib/dogwatch/model/options.rb', line 40 def no_data_timeframe(minutes) @attributes.no_data_timeframe = minutes.to_i end |
#notify_audit(notify = false) ⇒ Object
60 61 62 |
# File 'lib/dogwatch/model/options.rb', line 60 def notify_audit(notify = false) @attributes.notify_audit = !!notify end |
#notify_no_data(notify = false) ⇒ Object
35 36 37 |
# File 'lib/dogwatch/model/options.rb', line 35 def notify_no_data(notify = false) @attributes.notify_no_data = !!notify end |
#render ⇒ Hash
25 26 27 |
# File 'lib/dogwatch/model/options.rb', line 25 def render @attributes.each_pair.to_h end |
#renotify_interval(minutes) ⇒ Object
50 51 52 |
# File 'lib/dogwatch/model/options.rb', line 50 def renotify_interval(minutes) @attributes.renotify_interval = minutes.to_i end |
#silenced(args) ⇒ Object
30 31 32 |
# File 'lib/dogwatch/model/options.rb', line 30 def silenced(args) @attributes.silenced = args.to_h end |
#thresholds(thresholds) ⇒ Object
70 71 72 73 |
# File 'lib/dogwatch/model/options.rb', line 70 def thresholds(thresholds) validate_monitor_type_specific_option!(:thresholds) @attributes.thresholds = thresholds end |
#timeout_h(hours) ⇒ Object
45 46 47 |
# File 'lib/dogwatch/model/options.rb', line 45 def timeout_h(hours) @attributes.timeout_h = hours.to_i end |