class EscalationRule
Public Instance Methods
delete()
click to toggle source
# File lib/pagerduty/models/escalationpolicies.rb, line 52 def delete res = curl({ uri: "https://#@@subdomain.pagerduty.com/api/v1/escalation_policies/#{parent_policy.id}/escalation_rules/#{self.id}", method: 'DELETE', raw_response: true }) res.code == '200' ? 'Successfully deleted' : JSON.parse(res.body) end
hashify()
click to toggle source
# File lib/pagerduty/models/escalationpolicies.rb, line 39 def hashify self.attributes.inject({}) { |attrs, (k,v)| v.class == RuleObject ? attrs[k] = v.to_hash : attrs[k] = v attrs } end
parent_policy()
click to toggle source
# File lib/pagerduty/models/escalationpolicies.rb, line 46 def parent_policy escalation_policies.detect { |policy| policy.escalation_rules.detect { |p| p.id == self.id } } end
save()
click to toggle source
# File lib/pagerduty/models/escalationpolicies.rb, line 62 def save self.attributes = curl({ uri: "https://#@@subdomain.pagerduty.com/api/v1/escalation_policies/#{parent_policy.id}/escalation_rules/#{self.id}", data: self.hashify, method: 'PUT' })['escalation_rule'] end