Class: OopsGenie::OopsGenieAlert
- Inherits:
-
Object
- Object
- OopsGenie::OopsGenieAlert
- Defined in:
- lib/oops_genie/oops_genie_alert.rb
Overview
configuration object to hold details of an OpsGenie Alert
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#description ⇒ Object
Returns the value of attribute description.
-
#details ⇒ Object
Returns the value of attribute details.
-
#entity ⇒ Object
Returns the value of attribute entity.
-
#message ⇒ Object
Returns the value of attribute message.
-
#priority ⇒ Object
Returns the value of attribute priority.
-
#responders ⇒ Object
Returns the value of attribute responders.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #alert_hash ⇒ Object
-
#initialize(api_key, message) ⇒ OopsGenieAlert
constructor
A new instance of OopsGenieAlert.
- #send_alert ⇒ Object
Constructor Details
#initialize(api_key, message) ⇒ OopsGenieAlert
Returns a new instance of OopsGenieAlert.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 9 def initialize(api_key, ) @api_key = api_key @message = @alias = nil @actions = nil @tags = nil @details = { description: } @entity = nil @priority = nil @responders = nil end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def actions @actions end |
#alias ⇒ Object
Returns the value of attribute alias.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def alias @alias end |
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def api_key @api_key end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def description @description end |
#details ⇒ Object
Returns the value of attribute details.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def details @details end |
#entity ⇒ Object
Returns the value of attribute entity.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def entity @entity end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def @message end |
#priority ⇒ Object
Returns the value of attribute priority.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def priority @priority end |
#responders ⇒ Object
Returns the value of attribute responders.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def responders @responders end |
#tags ⇒ Object
Returns the value of attribute tags.
6 7 8 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 6 def @tags end |
Instance Method Details
#alert_hash ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 21 def alert_hash attrs = {} instance_variables.each do |var| str = var.to_s.gsub /^@/, '' if respond_to? "#{str}=" attrs[str.to_sym] = instance_variable_get var end end attrs end |
#send_alert ⇒ Object
32 33 34 35 36 |
# File 'lib/oops_genie/oops_genie_alert.rb', line 32 def send_alert og_client = OopsGenie::OopsGenieClient.new(@api_key) response = og_client.send_alert(self) puts response end |