Class: Paratrooper::Pingdom::Notifier

Inherits:
Notifier
  • Object
show all
Defined in:
lib/paratrooper-pingdom.rb

Overview

Public: Sends notification to Pingdom to stop monitoring while deploy is

happening

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_key, username, password) ⇒ Notifier

Public: Initializes PingdomNotifier

app_key - String app key from Pingdom username - String Pingdom username password - String Pingdom password



18
19
20
21
22
# File 'lib/paratrooper-pingdom.rb', line 18

def initialize(app_key, username, password)
  @app_key        = app_key
  @username       = username
  @password       = password
end

Instance Attribute Details

#app_keyObject (readonly)

Returns the value of attribute app_key.



11
12
13
# File 'lib/paratrooper-pingdom.rb', line 11

def app_key
  @app_key
end

#passwordObject (readonly)

Returns the value of attribute password.



11
12
13
# File 'lib/paratrooper-pingdom.rb', line 11

def password
  @password
end

#usernameObject (readonly)

Returns the value of attribute username.



11
12
13
# File 'lib/paratrooper-pingdom.rb', line 11

def username
  @username
end

Instance Method Details

#setup(options = {}) ⇒ Object



24
25
26
# File 'lib/paratrooper-pingdom.rb', line 24

def setup(options = {})
  %x[curl https://api.pingdom.com/api/2.0/checks -X PUT -d "paused=true" -H "App-Key: #{app_key}" -u "#{username}:#{password}"]        
end

#teardown(options = {}) ⇒ Object



28
29
30
# File 'lib/paratrooper-pingdom.rb', line 28

def teardown(options = {})
  %x[curl https://api.pingdom.com/api/2.0/checks -X PUT -d "paused=false" -H "App-Key: #{app_key}" -u "#{username}:#{password}"]        
end