class Wavefront::Notificant

Manage and query Wavefront notification targets.

Public Instance Methods

create(body) click to toggle source

POST /api/v2/notificant Create a notification target.

@param body [Hash] description of notification target @return [Wavefront::Response]

# File lib/wavefront-sdk/notificant.rb, line 26
def create(body)
  raise ArgumentError unless body.is_a?(Hash)

  api.post('', body, 'application/json')
end
delete(id) click to toggle source

DELETE /api/v2/notificant/id Delete a specific notificant

@param id [String] ID of the notification target @return [Wavefront::Response]

# File lib/wavefront-sdk/notificant.rb, line 38
def delete(id)
  wf_notificant_id?(id)
  api.delete(id)
end
describe(id) click to toggle source

GET /api/v2/notificant/id Get a specific notification target

@param id [String] ID of the notification target @return [Wavefront::Response]

# File lib/wavefront-sdk/notificant.rb, line 49
def describe(id)
  wf_notificant_id?(id)
  api.get(id)
end
list(offset = 0, limit = 100) click to toggle source

GET /api/v2/notificant Get all notification targets for a customer

@param offset [Int] notificant at which the list begins @param limit [Int] the number of notification targets to return

# File lib/wavefront-sdk/notificant.rb, line 16
def list(offset = 0, limit = 100)
  api.get('', offset: offset, limit: limit)
end
test(id) click to toggle source

POST /api/v2/notificant/test/id Create a notification target.

@param body [Hash] description of notification target @return [Wavefront::Response]

# File lib/wavefront-sdk/notificant.rb, line 81
def test(id)
  wf_notificant_id?(id)
  api.post(['test', id].uri_concat, nil)
end
update(id, body, modify = true) click to toggle source

PUT /api/v2/notificant/id Update a specific notification target

@param id [String] a Wavefront notification target ID @param body [Hash] key-value hash of the parameters you wish

to change

@param modify [true, false] if true, use {#describe()} to get

a hash describing the existing object, and modify that with
the new body. If false, pass the new body straight through.

@return [Wavefront::Response]

# File lib/wavefront-sdk/notificant.rb, line 65
def update(id, body, modify = true)
  wf_notificant_id?(id)
  raise ArgumentError unless body.is_a?(Hash)

  return api.put(id, body, 'application/json') unless modify

  api.put(id, hash_for_update(describe(id).response, body),
          'application/json')
end
update_keys() click to toggle source
# File lib/wavefront-sdk/notificant.rb, line 86
def update_keys
  %i[id contentType method description title template triggers
     recipient customHttpHeaders emailSubject isHtmlContent]
end