jsl-myzofeedtosis 0.0.1.5 → 0.0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +13 -10
- data/lib/myzofeedtosis/result.rb +8 -8
- data/myzofeedtosis.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -12,8 +12,6 @@ process where "one cell pierces another using a feeding tube, and sucks out
|
|
12
12
|
cytoplasm". Myzofeedtosis is kind of like that, except it works with RSS/Atom
|
13
13
|
feeds instead of cytoplasm.
|
14
14
|
|
15
|
-
1 - http://en.wikipedia.org/wiki/List_of_vores
|
16
|
-
|
17
15
|
== Philosophy
|
18
16
|
|
19
17
|
Myzofeedtosis is designed to help you with book-keeping about feed fetching
|
@@ -37,22 +35,23 @@ Assuming that you've followed the directions on gems.github.com to allow your
|
|
37
35
|
computer to install gems from GitHub, the following command will install the
|
38
36
|
Myzofeedtosis library:
|
39
37
|
|
40
|
-
|
38
|
+
sudo gem install jsl-myzofeedtosis
|
41
39
|
|
42
40
|
== Usage
|
43
41
|
|
44
42
|
Myzofeedtosis is easy to use. Just create a client object, and invoke the
|
45
43
|
"fetch" method:
|
46
44
|
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
require 'myzofeedtosis'
|
46
|
+
client = Myzofeedtosis::Client.new('http://feeds.feedburner.com/wooster')
|
47
|
+
result = client.fetch
|
50
48
|
|
51
49
|
+result+ will be a Myzofeedtosis::Result object which delegates methods to
|
52
50
|
the FeedNormalizer::Feed object as well as the Curl::Easy object used to fetch
|
53
51
|
the feed. Useful methods on this object include +entries+, +new_entries+ and
|
54
52
|
+response_code+ among many others (basically all of the methods that
|
55
|
-
FeedNormalizer::Feed and Curl::Easy objects respond to
|
53
|
+
FeedNormalizer::Feed and Curl::Easy objects respond to are implemented and can
|
54
|
+
be called directly, minus the setter methods for these objects).
|
56
55
|
|
57
56
|
Note that since Myzofeedtosis uses HTTP conditional GET, it may not actually
|
58
57
|
have received a full XML response from the server suitable for being parsed
|
@@ -81,9 +80,9 @@ ruby Hash, so it won't keep track of feeds after a particular Client is removed
|
|
81
80
|
from memory. To configure a different backend, pass an options hash to the
|
82
81
|
Myzofeedtosis client initialization:
|
83
82
|
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
url = "http://newsrss.bbc.co.uk/rss/newsonline_world_edition/south_asia/rss.xml"
|
84
|
+
mf = Myzofeedtosis::Client.new(url, :backend => {:moneta_klass => 'Moneta::Memcache', :server => 'localhost:1978'})
|
85
|
+
res = mf.fetch
|
87
86
|
|
88
87
|
This example sets up a Memcache backend, which in this case points to Tokyo
|
89
88
|
Tyrant on port 1978. Note that Moneta::Memcache can be given as a string, in
|
@@ -141,6 +140,10 @@ development of Myzofeedtosis.
|
|
141
140
|
Please let me know if you have any problems with or questions about
|
142
141
|
Myzofeedtosis.
|
143
142
|
|
143
|
+
= References
|
144
|
+
|
145
|
+
(1) http://en.wikipedia.org/wiki/List_of_vores
|
146
|
+
|
144
147
|
= Author
|
145
148
|
|
146
149
|
Justin S. Leitgeb, mailto:justin@phq.org
|
data/lib/myzofeedtosis/result.rb
CHANGED
@@ -30,18 +30,18 @@ module Myzofeedtosis
|
|
30
30
|
# aren't really useful to delegate.
|
31
31
|
Curl::Easy.instance_methods(false).reject do |m|
|
32
32
|
m =~ SETTER_METHOD_RE
|
33
|
-
end.each do |meth|
|
34
|
-
define_method meth do |*args|
|
35
|
-
@curl.
|
36
|
-
end
|
33
|
+
end.each do |meth| # Example method:
|
34
|
+
define_method meth do |*args| # def title
|
35
|
+
@curl.__send__(meth, *args) # @curl.title
|
36
|
+
end # end
|
37
37
|
end
|
38
38
|
|
39
39
|
# Send methods through to the feed object unless it is nil. If feed
|
40
40
|
# object is nil, return nil in response to method call.
|
41
|
-
FEED_METHODS.each do |meth|
|
42
|
-
define_method meth do |*args|
|
43
|
-
@feed.nil? ? nil : @feed.__send__(meth, *args)
|
44
|
-
end
|
41
|
+
FEED_METHODS.each do |meth| # Example method:
|
42
|
+
define_method meth do |*args| # def author
|
43
|
+
@feed.nil? ? nil : @feed.__send__(meth, *args) # @feed.nil? nil : @feed.author
|
44
|
+
end # end
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
data/myzofeedtosis.gemspec
CHANGED