Class: PingdomCap::App

Inherits:
Object
  • Object
show all
Defined in:
lib/pingdom_cap/app.rb

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



3
4
# File 'lib/pingdom_cap/app.rb', line 3

def initialize
end

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pingdom_cap/app.rb', line 5

def run
  username = ENV['PINGDOM_USERNAME']
  password = ENV['PINGDOM_PASSWORD']
  key = ENV['PINGDOM_KEY']
  check_name = ARGV[0]
  operation = ARGV[1] || 'status'

  if check_name
    pingdom = PingdomCap::Client.new(username: username, password: password, key: key)
    pingdom.send(operation, check_name)
  else
    puts "usage: pingdom-cap check-name [status | pause | unpause]"
  end
end