Skip to content

Instantly share code, notes, and snippets.

@rxbynerd
Created July 25, 2013 08:29
Show Gist options
  • Save rxbynerd/6077856 to your computer and use it in GitHub Desktop.
Save rxbynerd/6077856 to your computer and use it in GitHub Desktop.
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