Class: Pingdom::Cli::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/pingdom/cli/core.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Core

Returns a new instance of Core.



8
9
10
11
12
# File 'lib/pingdom/cli/core.rb', line 8

def initialize(config)
  @config = config
  @url = "https://#{CGI::escape @config['user']}:#{CGI::escape @config['password']}@api.pingdom.com/api/2.0/checks"
  @header = {"App-Key" => @config['app_key']}
end

Instance Method Details

#checksObject



14
15
16
17
# File 'lib/pingdom/cli/core.rb', line 14

def checks
  response = RestClient.get(@url, @header)
  JSON.parse(response.body, :symbolize_names => true)
end

#update(params) ⇒ Object



19
20
21
22
# File 'lib/pingdom/cli/core.rb', line 19

def update(params)
  response = RestClient.put(@url, params, @header)
  response.body
end