Class: Readiness::Pagerduty::Services
- Inherits:
-
Client
- Object
- Client
- Readiness::Pagerduty::Services
show all
- Defined in:
- lib/support_readiness/pagerduty/services.rb
Overview
TODO:
List audit records for a service
TODO:
Update an existing integration
Defines the class Services 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
#initialize(object = {}) ⇒ Services
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/support_readiness/pagerduty/services.rb', line 31
def initialize(object = {})
@acknowledgement_timeout = object['acknowledgement_timeout']
@alert_creation = object['alert_creation']
@auto_pause_notifications_parameters = object['auto_pause_notifications_parameters']
@auto_resolve_timeout = object['auto_resolve_timeout']
@created_at = object['created_at']
@escalation_policy = object['escalation_policy']
@html_url = object['html_url']
@id = object['id']
@incident_urgency_rule = object['incident_urgency_rule']
@integrations = object['integrations']
@name = object['name']
@scheduled_actions = object['scheduled_actions']
@self = object['self']
@status = object['status']
@summary = object['summary']
@support_hours = object['support_hours']
@teams = object['teams']
@type = object['type']
end
|
Instance Attribute Details
#acknowledgement_timeout ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def acknowledgement_timeout
@acknowledgement_timeout
end
|
#alert_creation ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def alert_creation
@alert_creation
end
|
#auto_pause_notifications_parameters ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def auto_pause_notifications_parameters
@auto_pause_notifications_parameters
end
|
#auto_resolve_timeout ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def auto_resolve_timeout
@auto_resolve_timeout
end
|
#created_at ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def created_at
@created_at
end
|
#escalation_policy ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def escalation_policy
@escalation_policy
end
|
#html_url ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def html_url
@html_url
end
|
#id ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def id
@id
end
|
#incident_urgency_rule ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def incident_urgency_rule
@incident_urgency_rule
end
|
#integrations ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def integrations
@integrations
end
|
#name ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def name
@name
end
|
#scheduled_actions ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def scheduled_actions
@scheduled_actions
end
|
#self ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def self
@self
end
|
#status ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def status
@status
end
|
#summary ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def summary
@summary
end
|
#support_hours ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def support_hours
@support_hours
end
|
#teams ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def teams
@teams
end
|
#type ⇒ Object
20
21
22
|
# File 'lib/support_readiness/pagerduty/services.rb', line 20
def type
@type
end
|
Class Method Details
.find(client, sid) ⇒ Hash
Locates a service within Pagerduty. This will not exit on error (except Authentication errors)
100
101
102
103
104
105
106
|
# File 'lib/support_readiness/pagerduty/services.rb', line 100
def self.find(client, sid)
response = client.connection.get("services/#{sid}")
handle_request_error(0, 'Pagerduty', response.status, { action: 'get', id: sid }) unless response.status == 200
return Services.new(Oj.load(response.body)['service']) if response.status == 200
Oj.load(response.body)
end
|
.find!(client, sid) ⇒ Object
Locates a service within Pagerduty. This will exit on error
125
126
127
128
129
|
# File 'lib/support_readiness/pagerduty/services.rb', line 125
def self.find!(client, sid)
response = client.connection.get("services/#{sid}")
handle_request_error(1, 'Pagerduty', response.status, { action: 'Find service', id: sid }) unless response.status == 200
Services.new(Oj.load(response.body)['service'])
end
|
.list(client) ⇒ Array
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/support_readiness/pagerduty/services.rb', line 68
def self.list(client)
array = []
offset = 0
loop do
response = client.connection.get "services?limit=100&offset=#{offset}"
handle_request_error(0, 'Pagerduty', response.status) unless response.status == 200
body = Oj.load(response.body)
array += body['services'].map { |e| Services.new(e) }
break unless body['more']
offset += 100
end
array
end
|