Class: Pagerduty
- Inherits:
-
Object
- Object
- Pagerduty
- Defined in:
- lib/pagerduty.rb,
lib/pagerduty/version.rb
Direct Known Subclasses
Constant Summary collapse
- VERSION =
"1.3.2"
Instance Attribute Summary collapse
-
#incident_key ⇒ Object
readonly
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, incident_key = nil) ⇒ Pagerduty
constructor
A new instance of Pagerduty.
- #trigger(description, details = {}) ⇒ Object
Constructor Details
#initialize(service_key, incident_key = nil) ⇒ Pagerduty
Returns a new instance of Pagerduty.
18 19 20 21 |
# File 'lib/pagerduty.rb', line 18 def initialize(service_key, incident_key = nil) @service_key = service_key @incident_key = incident_key end |
Instance Attribute Details
#incident_key ⇒ Object (readonly)
Returns the value of attribute incident_key.
16 17 18 |
# File 'lib/pagerduty.rb', line 16 def incident_key @incident_key end |
#service_key ⇒ Object (readonly)
Returns the value of attribute service_key.
16 17 18 |
# File 'lib/pagerduty.rb', line 16 def service_key @service_key end |
Instance Method Details
#get_incident(incident_key) ⇒ Object
30 31 32 |
# File 'lib/pagerduty.rb', line 30 def get_incident(incident_key) PagerdutyIncident.new @service_key, incident_key end |
#trigger(description, details = {}) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/pagerduty.rb', line 23 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 |