Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ NOTE: This is a 3rd party gem and not an official product from Pingdom.
check.last_response_time #=> 200 (ms)
check.status #=> "up"

check.paused(true)
check.status #=> "paused"

result = check.results.first(:probes => [1,2,3], :status => [:up, :down])
#=> #<Pingdom::Result>
result.status #=> :up
Expand Down
4 changes: 4 additions & 0 deletions lib/pingdom/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def results(options = {})
@client.results(id, options)
end

def paused(bool)
@client.paused(id, bool)
end

def summary
@client.summary(id)
end
Expand Down
11 changes: 11 additions & 0 deletions lib/pingdom/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def get(uri, params = {}, &block)
response
end

def put(uri, params = {}, data, &block)
response = @connection.put(@connection.build_url(uri, prepare_params(params)), data, "App-Key" => @options[:key], &block)
update_limits!(response.headers['req-limit-short'], response.headers['req-limit-long'])
response
end

def update_limits!(short, long)
@limit ||= {}
@limit[:short] = parse_limit(short)
Expand All @@ -63,6 +69,7 @@ def test!(options = {})
def checks(options = {})
Check.parse(self, get("checks", options))
end

def check(id)
Check.parse(self, get("checks/#{id}")).first
end
Expand All @@ -73,6 +80,10 @@ def results(id, options = {})
Result.parse(self, get("results/#{id}", options))
end

def paused(id, bool)
Check.parse(self, put("checks/#{id}", {'paused'=>bool.to_s}))
end

def probes(options = {})
Probe.parse(self, get("probes", options))
end
Expand Down