Class: BetterStack::Resources::Incident

Inherits:
Base
  • Object
show all
Defined in:
lib/betterstack/resources/incident.rb

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BetterStack::Resources::Base

Instance Method Details

#add_update(id, update_attributes) ⇒ Object



29
30
31
# File 'lib/betterstack/resources/incident.rb', line 29

def add_update(id, update_attributes)
  client.post("#{resource_path(id)}/incident_updates", update_attributes)
end

#create(attributes) ⇒ Object



12
13
14
# File 'lib/betterstack/resources/incident.rb', line 12

def create(attributes)
  client.post(resource_path, attributes)
end

#delete(id) ⇒ Object



20
21
22
# File 'lib/betterstack/resources/incident.rb', line 20

def delete(id)
  client.delete(resource_path(id))
end

#delete_incident_update(id, update_id) ⇒ Object



41
42
43
# File 'lib/betterstack/resources/incident.rb', line 41

def delete_incident_update(id, update_id)
  client.delete("#{resource_path(id)}/incident_updates/#{update_id}")
end

#get(id) ⇒ Object



8
9
10
# File 'lib/betterstack/resources/incident.rb', line 8

def get(id)
  client.get(resource_path(id))
end

#list(params = {}) ⇒ Object



4
5
6
# File 'lib/betterstack/resources/incident.rb', line 4

def list(params = {})
  client.get(resource_path, params)
end

#resolve(id, message = nil) ⇒ Object



24
25
26
27
# File 'lib/betterstack/resources/incident.rb', line 24

def resolve(id, message = nil)
  body = message ? { message: message } : {}
  client.post("#{resource_path(id)}/resolve", body)
end

#update(id, attributes) ⇒ Object



16
17
18
# File 'lib/betterstack/resources/incident.rb', line 16

def update(id, attributes)
  client.patch(resource_path(id), attributes)
end

#update_incident_update(id, update_id, attributes) ⇒ Object



37
38
39
# File 'lib/betterstack/resources/incident.rb', line 37

def update_incident_update(id, update_id, attributes)
  client.patch("#{resource_path(id)}/incident_updates/#{update_id}", attributes)
end

#updates(id, params = {}) ⇒ Object



33
34
35
# File 'lib/betterstack/resources/incident.rb', line 33

def updates(id, params = {})
  client.get("#{resource_path(id)}/incident_updates", params)
end