Created
July 25, 2013 08:29
-
-
Save rxbynerd/6077856 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "nokogiri" | |
require "net/http" | |
require "twilio-ruby" | |
twilio = Twilio::REST::Client.new ENV['TWILIO_SID'], ENV['TWILIO_AUTH'] | |
text_luke = -> (message) do | |
twilio.account.sms.messages.create( | |
from: ENV['TWILIO_PHONE'], | |
to: ENV['LUKE'], | |
body: message | |
) | |
end | |
doc = Nokogiri::HTML.parse Net::HTTP.get URI.parse "https://developer.apple.com/support/system-status/" | |
status = Hash[doc.css(".status-table tr td").map{|element| [element.text, element["class"]] }] | |
if status["Certificates, Identifiers & Profiles"] == "online" | |
puts "CIP online!" | |
puts "Texting luke!!" | |
text_luke.call "CIP is online!!!" | |
else | |
puts "CIP is offline!" | |
end | |
if status["Software Downloads"] == "online" | |
puts "Software Downloads are online!" | |
puts "Texting luke!!!" | |
text_luke.call "Software Downloads are online!" | |
else | |
puts "Software Downloads are offline!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment