Sha256: d995d3211e4f8e7fb0c2b205459f85e44331f8bfb2dcff8dc29ec3c024cc8113
Contents?: true
Size: 602 Bytes
Versions: 1
Compression:
Stored size: 602 Bytes
Contents
module UptimeRobot class Client attr_accessor :api_key def initialize api_key @api_key = api_key end def get resource, headers={} JSON.parse(RestClient.get(resource_url(resource), rest_headers(headers))) rescue RestClient::Exception => e raise UptimeRobot::Exception.new(e.response) end private def rest_headers options={} {:apiKey => @api_key, :format => 'json', :noJsonCallback => '1'}.merge(options) end def resource_url resource req = resource.gsub(/^\//,'') "http://api.uptimerobot.com/#{req}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uptime_robot-0.0.1 | lib/uptime_robot/client.rb |