Skip to content

Instantly share code, notes, and snippets.

@chrisallick
Last active October 30, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisallick/125ca28ceee694259edc to your computer and use it in GitHub Desktop.
Save chrisallick/125ca28ceee694259edc to your computer and use it in GitHub Desktop.
Check if a website has changed. Text me if it has.
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