rss_watcher 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +23 -8
- data/lib/rss_watcher/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94b2b6ef86513054d4efe4a6417ade9da7e039cea4e5e42e62125de1b839ba5e
|
4
|
+
data.tar.gz: c58fba31efed4b4b8a40eed0ce5ba23e7a08315781794964dd50ec712553da4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d36ec2bd2d94012cce47cce619de49384dc94303f2a4f1916496df19de15050bcb77b9b32b4aeacc7a7f4b7f098c247ee604e1a84012c34f743f9455572b816
|
7
|
+
data.tar.gz: '068c4c7fb855e2f49d26c8569b5593ad9e76b468b379fd6e9a6d148d79a7d29ba0bd5122371c72eeb5d2b2bfe3b8650e11881cd1f3cab06e4390a904ab1625aa'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# RssWatcher
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
2
|
+
[](https://badge.fury.io/rb/rss_watcher) [](https://badge.fury.io/rb/rss_watcher)
|
3
|
+
A Ruby Gem For Watching RSS Feeds
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -20,10 +18,27 @@ Or install it yourself as:
|
|
20
18
|
|
21
19
|
$ gem install rss_watcher
|
22
20
|
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
## Usage Example
|
22
|
+
Whenever a new item is detected on the RSS feed, the given block is called with the item that was detected. ```item``` is an instance of a parsed RSS item using the [Ruby RSS library](https://github.com/ruby/rss). You should be able to access properties of the item using methods of the same name (e.g title, description, link, pubDate)
|
23
|
+
```ruby
|
24
|
+
require "rss_watcher"
|
25
|
+
RssWatcher.watch(url: "http://lorem-rss.herokuapp.com/feed") do |item|
|
26
|
+
puts item.title
|
27
|
+
puts item.description
|
28
|
+
puts item.link
|
29
|
+
end
|
30
|
+
```
|
31
|
+
### Options
|
32
|
+
* url : URL of the RSS Feed to be watched (*Required | String*)
|
33
|
+
* update_interval: Time (**in seconds**) to wait between checking the url for updates (*Optional | Default: 10 | Integer*)
|
34
|
+
* cache_file: Path to a file that this gem uses internally for remembering the last seen item (*Optional | Default: ```"rss_watcher.cache"``` | String*)
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
RssWatcher.watch(url: "http://lorem-rss.herokuapp.com/feed", update_interval: 1, cache_file: "~/.tmp/rss_watcher_cache") do |item|
|
38
|
+
puts item.pubDate
|
39
|
+
puts item.link
|
40
|
+
end
|
41
|
+
```
|
27
42
|
## Development
|
28
43
|
|
29
44
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/rss_watcher/version.rb
CHANGED