Class: Pagerduty
- Inherits:
-
Object
- Object
- Pagerduty
- Defined in:
- lib/pagerduty.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#incident_key ⇒ Object
Returns the value of attribute incident_key.
-
#service_key ⇒ Object
readonly
Returns the value of attribute service_key.
Instance Method Summary collapse
- #get_incident(incident_key) ⇒ Object
-
#initialize(service_key) ⇒ Pagerduty
constructor
A new instance of Pagerduty.
- #trigger(description, details = {}) ⇒ Object
Constructor Details
#initialize(service_key) ⇒ Pagerduty
Returns a new instance of Pagerduty.
17 18 19 20 |
# File 'lib/pagerduty.rb', line 17 def initialize(service_key) @service_key = service_key @incident_key = nil end |
Instance Attribute Details
#incident_key ⇒ Object
Returns the value of attribute incident_key.
15 16 17 |
# File 'lib/pagerduty.rb', line 15 def incident_key @incident_key end |
#service_key ⇒ Object (readonly)
Returns the value of attribute service_key.
15 16 17 |
# File 'lib/pagerduty.rb', line 15 def service_key @service_key end |
Instance Method Details
#get_incident(incident_key) ⇒ Object
33 34 35 |
# File 'lib/pagerduty.rb', line 33 def get_incident(incident_key) PagerdutyIncident.new @service_key, incident_key end |
#trigger(description, details = {}) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/pagerduty.rb', line 26 def trigger(description, details = {}) resp = api_call("trigger", description, details) throw PagerdutyException.new(self, resp) unless resp["status"] == "success" PagerdutyIncident.new @service_key, resp["incident_key"] end |