Class: Readiness::Pagerduty::EscalationPolicies
- Inherits:
-
Client
- Object
- Client
- Readiness::Pagerduty::EscalationPolicies
show all
- Defined in:
- lib/support_readiness/pagerduty/escalation_policies.rb
Overview
TODO:
Create an escalation policy
TODO:
Delete an escalation policy
TODO:
Update en escalation policy
TODO:
List audit records for an escalation policy
Defines the class EscalationPolicies within the module Readiness::Pagerduty.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 28
def initialize(object = {})
@description = object['description']
@escalation_rules = object['escalation_rules']
@html_url = object['html_url']
@id = object['id']
@name = object['name']
@num_loops = object['num_loops']
@on_call_handoff_notifications = object['on_call_handoff_notifications']
@self = object['self']
@services = object['services']
@summary = object['summary']
@teams = object['teams']
@type = object['type']
end
|
Instance Attribute Details
#description ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def description
@description
end
|
#escalation_rules ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def escalation_rules
@escalation_rules
end
|
#html_url ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def html_url
@html_url
end
|
#id ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def id
@id
end
|
#name ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def name
@name
end
|
#num_loops ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def num_loops
@num_loops
end
|
#on_call_handoff_notifications ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def on_call_handoff_notifications
@on_call_handoff_notifications
end
|
#self ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def self
@self
end
|
#services ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def services
@services
end
|
#summary ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def summary
@summary
end
|
#teams ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def teams
@teams
end
|
#type ⇒ Object
17
18
19
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 17
def type
@type
end
|
Class Method Details
.find(client, pid) ⇒ Hash
Locates an escalation policy within Pagerduty. This will not exit on error (except Authentication errors)
91
92
93
94
95
96
97
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 91
def self.find(client, pid)
response = client.connection.get("escalation_policies/#{pid}")
handle_request_error(0, 'Pagerduty', response.status, { action: 'get', id: pid }) unless response.status == 200
return EscalationPolicies.new(Oj.load(response.body)['escalation_policy']) if response.status == 200
Oj.load(response.body)
end
|
.find!(client, pid) ⇒ Hash
Locates an escalation policy within Pagerduty. This will exit on error
116
117
118
119
120
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 116
def self.find!(client, pid)
response = client.connection.get("escalation_policies/#{pid}")
handle_request_error(1, 'Pagerduty', response.status, { action: 'Find escalation policy', id: pid }) unless response.status == 200
EscalationPolicies.new(Oj.load(response.body)['escalation_policy'])
end
|
.list(client) ⇒ Array
Lists escalation policies
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/support_readiness/pagerduty/escalation_policies.rb', line 59
def self.list(client)
array = []
offset = 0
loop do
response = client.connection.get "escalation_policies?limit=100&offset=#{offset}"
handle_request_error(0, 'Pagerduty', response.status) unless response.status == 200
body = Oj.load(response.body)
array += body['escalation_policies'].map { |e| EscalationPolicies.new(e) }
break unless body['more']
offset += 100
end
array
end
|