Class: CachetComponents

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

Overview

Inherits CachetClient and handles all Components 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 Component.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :name (string)

    *Required* Component name

  • :status (int)

    *Required* Numeric status of the component; 1-4

  • :description (string)

    Description of the component

  • :link (string)

    A hyperlink to the component

  • :order (int)

    Numeric order of the component

  • :group_id (int)

    Numeric group id component is within

  • :enabled (boolean)

    True/False to enable/disable component

Returns:

  • object


131
132
133
134
135
# File 'lib/cachet.rb', line 131

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

#delete(options) ⇒ Object

Delete Component.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    *Required* Numeric component id

Returns:

  • object


161
162
163
164
# File 'lib/cachet.rb', line 161

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

#groups_create(options) ⇒ Object

Create Component Group.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :name (string)

    *Required* Component group name

  • :order (int)

    Numeric order of the component group

  • :collapsed (int)

    Whether to collapse the group by default

Returns:

  • object


195
196
197
198
199
# File 'lib/cachet.rb', line 195

def groups_create(options)
  request method:  :post,
          url:     @base_url + 'components/groups',
          payload: options
end

#groups_delete(options) ⇒ Object

Delete Component Group.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    *Required* Numeric component group id

Returns:

  • object


222
223
224
225
# File 'lib/cachet.rb', line 222

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

#groups_listObject

List all Component Groups.

Returns:

  • object


171
172
173
174
# File 'lib/cachet.rb', line 171

def groups_list
  request method:  :get,
          url:     @base_url + 'components/groups'
end

#groups_list_id(options) ⇒ Object

List Component Group by ID.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    *Required* Numeric component group id

Returns:

  • object


182
183
184
185
# File 'lib/cachet.rb', line 182

def groups_list_id(options)
  request method:  :get,
          url:     @base_url + 'components/groups/' + options['id'].to_s
end

#groups_update(options) ⇒ Object

Update Component Group.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    *Required* Numeric component group id

  • :name (string)

    Component group name

  • :order (int)

    Numeric order of the component group

  • :collapsed (boolean)

    Whether to collapse the group by default

Returns:

  • object


210
211
212
213
214
# File 'lib/cachet.rb', line 210

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

#list(options = nil) ⇒ Object

List all Components.

Returns:

  • object


103
104
105
106
107
# File 'lib/cachet.rb', line 103

def list(options = nil)
  request method:  :get,
          url:     @base_url + 'components',
          headers: {params: options}
end

#list_id(options) ⇒ Object

List Component by ID.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric component id

Returns:

  • object


114
115
116
117
# File 'lib/cachet.rb', line 114

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

#update(options) ⇒ Object

Update Component.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    *Required* Numeric component id

  • :status (int)

    *Required* Numeric status of the component; 1-4

  • :name (string)

    *Required* Component name

  • :link (string)

    A hyperlink to the component

  • :order (int)

    Numeric order of the component

  • :group_id (int)

    Numeric group id component is within

  • :enabled (boolean)

    True/False to enable/disable component

Returns:

  • object


149
150
151
152
153
# File 'lib/cachet.rb', line 149

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