WebUpdateChecker
This library polls an URL and notifies if the contents is changed. This is useful if you want to be notified as soon as a web site contents is changed.
Installation
Add this line to your application's Gemfile:
gem 'web_update_checker'
And then execute:
$ bundle
Or install it yourself as:
$ gem install web_update_checker
Usage
main.rb
require 'mail'
require 'web_update_checker'
regex = /<h1>(.*)<\/h1>/
url = 'http://example.com/'
mail = Mail.new do
from: 'TODO@example.com'
to: 'TODO@example.com'
subject: 'Web site is updated!'
body: url
end
mail.delivery_method :smtp, {
address: 'localhost',
port: 25,
}
WebUpdateChecker::Checker.new(url, regex, mail).execute
Execute like a following CLI
% while [ true ]; do; ruby main.rb; sleep 30; done
Contributing
- Fork it ( http://github.com/matsubo/web_update_checker/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request