Class: Wavefront::Alerting

Inherits:
Object
  • Object
show all
Defined in:
lib/wavefront/alerting.rb

Constant Summary collapse

DEFAULT_HOST =
'metrics.wavefront.com'
DEFAULT_PATH =
'/api/alert/'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ Alerting

Returns a new instance of Alerting.



30
31
32
# File 'lib/wavefront/alerting.rb', line 30

def initialize(token)
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



28
29
30
# File 'lib/wavefront/alerting.rb', line 28

def token
  @token
end

Instance Method Details

#active(options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/wavefront/alerting.rb', line 34

def active(options={})

  options[:host] ||= DEFAULT_HOST
  options[:path] ||= DEFAULT_PATH

  uri = URI::HTTPS.build(:host => options[:host], :path => options[:path])
  uri = URI.join(uri.to_s,"active")
  uri = URI.join(uri.to_s,"?t=#{@token}")
  
  response = RestClient.get(uri.to_s)

  return response
end