module IsDown

check if a website is up or not using isitup.org API

Constants

ISITUP
VERSION

Public Class Methods

is_down?(host) click to toggle source

check if a website is down takes a domain name as the only argument

# File lib/is_down.rb, line 11
def self.is_down?(host)
  !is_up?(host)  
end
is_up?(host) click to toggle source

opposite of is_down? checks if a website is up takes a domain name as the only argument

# File lib/is_down.rb, line 18
def self.is_up?(host)
  resp = Net::HTTP.get_response(URI(ISITUP + host + ".json"))
  JSON.parse(resp.body)['status_code'] == 1
end