Class: CachetIncidents

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

Overview

Inherits CachetClient and handles all Incidents API Calls

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


266
267
268
269
270
# File 'lib/cachet.rb', line 266

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


297
298
299
300
# File 'lib/cachet.rb', line 297

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

#list(options = nil) ⇒ Object

List all Incidents.

Returns:

  • object


237
238
239
240
241
# File 'lib/cachet.rb', line 237

def list(options = nil)
  request method:  :get,
          url:     @base_url + 'incidents',
          headers: {params: options}
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


249
250
251
252
# File 'lib/cachet.rb', line 249

def list_id(options)
  request method:  :get,
          url:     @base_url + 'incidents/' + options['id'].to_s
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


285
286
287
288
289
# File 'lib/cachet.rb', line 285

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