Sha256: 8b733264965269a292f97eec74fd68cf4d4a32009c3c93d7bdb8d8a089822872

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

require 'rest-client'
require 'json'

module Pingdom
  module Cli
    class Core

      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

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

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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pingdom-cli-0.1.0 lib/pingdom/cli/core.rb