Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.
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
14 changes: 14 additions & 0 deletions lib/pingdom/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def get(uri, params = {}, &block)
update_limits!(response.headers['req-limit-short'], response.headers['req-limit-long'])
response
end

def post(uri, params)
response = @connection.post(@connection.build_url(uri, prepare_params(params)), nil, "App-Key" => @options[:key])
response
end

def update_limits!(short, long)
@limit ||= {}
Expand All @@ -63,6 +68,15 @@ def test!(options = {})
def checks(options = {})
Check.parse(self, get("checks", options))
end

REQUIRED_FOR_CREATE = [:name, :host, :type]
def create_check(options = {})
missing_keys = REQUIRED_FOR_CREATE - options.keys
raise ArgumentError, "#{missing_keys} required" if missing_keys.any?

Check.parse(self, post("checks", options))
end

def check(id)
Check.parse(self, get("checks/#{id}")).first
end
Expand Down
4 changes: 2 additions & 2 deletions pingdom-client.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = %q{pingdom-client}
s.version = "0.0.6.alpha.af2"
s.version = "0.0.6.oib"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Matt Todd"]
Expand All @@ -25,7 +25,7 @@ Gem::Specification.new do |s|
"lib/pingdom.rb",
"lib/tinder/faraday_response.rb",
"Rakefile",
"Readme.md",
"README.md",
"spec/pingdom-client_spec.rb",
"spec/spec_helper.rb"
]
Expand Down