StatusCake
It is a StatusCake API client library.
It is a thin library, and methods are dynamically generated.
path.sub(%r|\A/API/|, '').gsub('/', '_').downcase
# "/API/Tests/Details" => "def tests_details"
It supports the following API:
- /API/Alerts
- /API/ContactGroups/Update
- /API/ContactGroups
- /API/Tests/Checks
- /API/Tests/Periods
- /API/Tests
- /API/Tests/Details
- /API/Tests/Update
- /API/Locations/json
- /API/Locations/txt
- /API/Locations/xml
- /API/Auth
Installation
Add this line to your application's Gemfile:
gem 'statuscake'
And then execute:
$ bundle
Or install it yourself as:
$ gem install statuscake
Usage
require 'statuscake'
client = StatusCake::Client.new(API: 'l6OxVJilcD2cETMoNRvn', Username: 'StatusCake')
client.tests_details(TestID: 241)
#=> {"TestID"=>241,
# "TestType"=>"HTTP",
# "Paused"=>false,
# "Affected"=>1,
# ...
client.tests_update(
WebsiteName: 'Example Domain',
WebsiteURL: 'http://example.com',
CheckRate: 300,
TestType: :HTTP)
#=> {"Success"=>true,
# "Message"=>"Test Inserted",
# "Issues"=>nil,
# "Data"=>
# {"WebsiteName"=>"Example Domain",
# ...
Deleting a Test
client.tests_details(
method: :delete,
TestID: 241)
#=> {"TestID"=>6735,
# "Affected"=>1,
# "Success"=>true,
# "Message"=>"This Check Has Been Deleted. It can not be recovered."}
I think this method call is strange.
This is because the original API is strange.
Test
bundle install
bundle exec rake