Module: LibratoAlerts

Extended by:
LibratoAlerts
Included in:
LibratoAlerts
Defined in:
lib/librato-alerts.rb

Constant Summary collapse

API_HOST =
"https://metrics-api.librato.com/v1"
DEFAULT_VERSION =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#token=(value) ⇒ Object (writeonly)

Sets the attribute token

Parameters:

  • value

    the value to set the attribute token to.



9
10
11
# File 'lib/librato-alerts.rb', line 9

def token=(value)
  @token = value
end

#user=(value) ⇒ Object (writeonly)

Sets the attribute user

Parameters:

  • value

    the value to set the attribute user to.



9
10
11
# File 'lib/librato-alerts.rb', line 9

def user=(value)
  @user = value
end

Instance Method Details

#allObject



15
16
17
# File 'lib/librato-alerts.rb', line 15

def all
  request(method: :get)[:alerts]
end

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (LibratoAlerts)

    the object that the method was called on



11
12
13
# File 'lib/librato-alerts.rb', line 11

def configure
  yield self
end

#disable(alert_id) ⇒ Object



26
27
28
29
30
31
# File 'lib/librato-alerts.rb', line 26

def disable(alert_id)
  request(
    endpoint: "/#{alert_id}",
    method: :put,
    active: false)
end

#enable(alert_id) ⇒ Object



19
20
21
22
23
24
# File 'lib/librato-alerts.rb', line 19

def enable(alert_id)
  request(
    endpoint: "/#{alert_id}",
    method: :put,
    active: true)
end