No commit activity in last 3 years
No release in over 3 years
First time of execution, this library get the specifified URL and preserve the result. After the 2nd time, compare the current page contents and previous contents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

WebUpdateChecker

Build Status Code Climate Gem Version

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

  1. Fork it ( http://github.com/matsubo/web_update_checker/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request