Class: CachetComponents

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 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


95
96
97
98
99
# File 'lib/cachet.rb', line 95

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


125
126
127
128
# File 'lib/cachet.rb', line 125

def delete(options)
  request method:  :delete,
          url:     @base_url + 'components/' + options['id']
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 (boolean)

    Whether to collapse the group by default

Returns:

  • object


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

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


186
187
188
189
190
191
192
# File 'lib/cachet.rb', line 186

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

#groups_listObject

List all Component Groups.

Returns:

  • object


135
136
137
138
# File 'lib/cachet.rb', line 135

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


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

def groups_list_id(options)
  request method:  :get,
          url:     @base_url + 'components/groups/' + options['id']
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


174
175
176
177
178
# File 'lib/cachet.rb', line 174

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

#listObject

List all Components.

Returns:

  • object


67
68
69
70
# File 'lib/cachet.rb', line 67

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

#list_id(options) ⇒ Object

List Component by ID. id

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric component id

Returns:

  • object


78
79
80
81
# File 'lib/cachet.rb', line 78

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


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

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