Last active
October 30, 2015 14:48
-
-
Save chrisallick/125ca28ceee694259edc to your computer and use it in GitHub Desktop.
Check if a website has changed. Text me if it has.
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 'rubygems' | |
require 'mechanize' | |
require 'twilio-ruby' | |
mechanize = Mechanize.new | |
page = mechanize.get('_snip_') | |
item = page.at('.coming-soon-sub') | |
account_sid = "_snip_" | |
auth_token = "_snip_" | |
client = Twilio::REST::Client.new account_sid, auth_token | |
friends = ["_snip_", "_snip_"] | |
if item | |
if item.text.strip == "Coming soon" | |
puts "no change" | |
else | |
client.account.messages.create( | |
:from => "_snip_", | |
:to => friends[0], | |
:body => "Potentially a change to biancachandon.com" | |
) | |
end | |
else | |
puts "notifying users of change." | |
friends.each do |friend| | |
client.account.messages.create( | |
:from => "_snip_", | |
:to => friend, | |
:body => "There has been a change to biancachandon.com" | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment