Module: IsDown
- Defined in:
- lib/is_down.rb,
lib/is_down/version.rb
Overview
check if a website is up or not using isitup.org API
Constant Summary collapse
- ISITUP =
"https://isitup.org/"
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.is_down?(host) ⇒ Boolean
check if a website is down takes a domain name as the only argument.
-
.is_up?(host) ⇒ Boolean
opposite of is_down? checks if a website is up takes a domain name as the only argument.
Class Method Details
.is_down?(host) ⇒ Boolean
check if a website is down takes a domain name as the only argument
11 12 13 |
# File 'lib/is_down.rb', line 11 def self.is_down?(host) !is_up?(host) end |
.is_up?(host) ⇒ Boolean
opposite of is_down? checks if a website is up takes a domain name as the only argument
18 19 20 21 |
# 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 |