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



129
130
131
132
133
# File 'lib/cachet.rb', line 129

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



159
160
161
162
# File 'lib/cachet.rb', line 159

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



193
194
195
196
197
# File 'lib/cachet.rb', line 193

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



220
221
222
223
# File 'lib/cachet.rb', line 220

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



169
170
171
172
# File 'lib/cachet.rb', line 169

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



180
181
182
183
# File 'lib/cachet.rb', line 180

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



208
209
210
211
212
# File 'lib/cachet.rb', line 208

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

#listObject

List all Components.

Returns:

  • object



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

def list
  request method:  :get,
          url:     @base_url + 'components'
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



112
113
114
115
# File 'lib/cachet.rb', line 112

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



147
148
149
150
151
# File 'lib/cachet.rb', line 147

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