Class: CachetIncidents

Inherits:
CachetClient show all
Defined in:
lib/cachet.rb

Constant Summary

Constants inherited from CachetClient

CachetClient::INCIDENT_FIXED, CachetClient::INCIDENT_IDENTIFIED, CachetClient::INCIDENT_INVESTIGATING, CachetClient::INCIDENT_SCHEDULED, CachetClient::INCIDENT_WATCHING, CachetClient::STATUS_MAJOR_OUTAGE, CachetClient::STATUS_OPERATIONAL, CachetClient::STATUS_PARTIAL_OUTAGE, CachetClient::STATUS_PERFORMANCE_ISSUES, CachetClient::VERSION

Instance Method Summary collapse

Methods inherited from CachetClient

#initialize, #ping, #request

Constructor Details

This class inherits a constructor from CachetClient

Instance Method Details

#create(options) ⇒ Object

Create Incident.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :name (string)

    *Required* Incident name

  • :message (string)

    *Required* Description of the incident

  • :status (int)

    *Required* Status of the incident; 1-4

  • :visible (int)

    *Required* value whether the incident public 0/1

  • :component_id (int)

    Component to update.(Required with component_status)

  • :component_status (int)

    The status to update the given component with.

  • :notify (boolean)

    True/False Whether to notify subscribers.

Returns:

  • object


232
233
234
235
236
# File 'lib/cachet.rb', line 232

def create(options)
  request method:  :post,
          url:     @base_url + 'incidents',
          payload: options
end

#delete(options) ⇒ Object

Delete Incident.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric incident id

Returns:

  • object


263
264
265
266
# File 'lib/cachet.rb', line 263

def delete(options)
  request method:  :delete,
          url:     @base_url + 'incidents/' + options['id']
end

#listObject

List all Incidents.

Returns:

  • object


204
205
206
207
# File 'lib/cachet.rb', line 204

def list
  request method:  :get,
          url:     @base_url + 'incidents'
end

#list_id(options) ⇒ Object

List Incident by ID.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric incident id

Returns:

  • object


215
216
217
218
# File 'lib/cachet.rb', line 215

def list_id(options)
  request method:  :get,
          url:     @base_url + 'incidents/' + options['id']
end

#update(options) ⇒ Object

Update Incident.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric incident id

  • :name (string)

    Incident name

  • :message (string)

    Description of the incident

  • :status (int)

    Status of the incident; 1-4

  • :visible (int)

    value whether the incident public 0/1

  • :component_id (int)

    Component to update.(Required with component_status)

  • :component_status (int)

    The status to update the given component with.

  • :notify (boolean)

    True/False Whether to notify subscribers.

Returns:

  • object


251
252
253
254
255
# File 'lib/cachet.rb', line 251

def update(options)
  request method:  :put,
          url:     @base_url + 'incidents/' + options['id'],
          payload: options
end