rbuzz 0.1 → 0.2
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.
- data/README.md +46 -43
- data/lib/rbuzz.rb +0 -1
- data/lib/rbuzz/feed.rb +3 -6
- data/lib/rbuzz/feed_entry.rb +2 -2
- data/lib/rbuzz/feed_reply.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,63 +1,66 @@
|
|
1
|
-
RBuzz
|
2
|
-
|
1
|
+
Ruby Buzz - RBuzz
|
2
|
+
=================
|
3
3
|
|
4
|
-
A simple wrapper to help retrieve and parse the Google Buzz Atom Feed.
|
4
|
+
A simple Ruby wrapper to help retrieve and parse the Google Buzz Atom Feed.
|
5
5
|
|
6
6
|
Coming soon - subscribing to updates, posting to feed
|
7
7
|
|
8
|
+
Note: This library was renamed from Buzzr to Ruby Buzz. Buzzr.com sent me a friendly trademark
|
9
|
+
infringement notice and threatened a lawsuit if I didn't rename the library immediately.
|
10
|
+
|
8
11
|
Install
|
9
12
|
-------
|
10
13
|
|
11
14
|
gem install rbuzz
|
12
15
|
|
13
|
-
|
16
|
+
Ruby Buzz is hosted on the Gemcutter repository. It depends on the RAtom library - http://github.com/seangeo/ratom
|
14
17
|
|
15
18
|
Example
|
16
19
|
-------
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
puts
|
30
|
-
|
31
|
-
if entry.urls.length > 0
|
32
|
-
puts "Links"
|
33
|
-
entry.urls.each {|u| puts "URI: #{u}" }
|
34
|
-
puts
|
35
|
-
end
|
36
|
-
|
37
|
-
if entry.images.length > 0
|
38
|
-
puts "Images"
|
39
|
-
entry.images.each {|i| puts "URI: #{i}" }
|
40
|
-
puts
|
41
|
-
end
|
42
|
-
|
43
|
-
if entry.videos.length > 0
|
44
|
-
puts "Videos"
|
45
|
-
entry.videos.each {|v| puts "URI: #{v}" }
|
21
|
+
require 'rbuzz'
|
22
|
+
|
23
|
+
feed_url = Rbuzz::Feed.discover("conorhunt")
|
24
|
+
feed = Rbuzz::Feed.retrieve(feed_url)
|
25
|
+
|
26
|
+
feed.entries.each do |entry|
|
27
|
+
puts "Title: #{entry.title}"
|
28
|
+
puts "Author: #{entry.author.name}"
|
29
|
+
puts "Comment Count: #{entry.comment_count}"
|
30
|
+
puts "Content"
|
31
|
+
puts entry.content
|
46
32
|
puts
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
33
|
+
|
34
|
+
if entry.urls.length > 0
|
35
|
+
puts "Links"
|
36
|
+
entry.urls.each {|u| puts "URI: #{u}" }
|
37
|
+
puts
|
38
|
+
end
|
39
|
+
|
40
|
+
if entry.images.length > 0
|
41
|
+
puts "Images"
|
42
|
+
entry.images.each {|i| puts "URI: #{i}" }
|
55
43
|
puts
|
56
44
|
end
|
45
|
+
|
46
|
+
if entry.videos.length > 0
|
47
|
+
puts "Videos"
|
48
|
+
entry.videos.each {|v| puts "URI: #{v}" }
|
49
|
+
puts
|
50
|
+
end
|
51
|
+
|
52
|
+
if entry.comment_count > 0
|
53
|
+
puts "Comments"
|
54
|
+
puts
|
55
|
+
entry.comments.each do |comment|
|
56
|
+
puts "Author: #{comment.author.name}"
|
57
|
+
puts "#{comment.content}"
|
58
|
+
puts
|
59
|
+
end
|
60
|
+
end
|
61
|
+
puts "------"
|
62
|
+
puts
|
57
63
|
end
|
58
|
-
puts "------"
|
59
|
-
puts
|
60
|
-
end
|
61
64
|
|
62
65
|
COPYRIGHT
|
63
66
|
---------
|
data/lib/rbuzz.rb
CHANGED
data/lib/rbuzz/feed.rb
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
|
2
|
-
Debugger.start
|
3
|
-
|
4
|
-
module RBuzz
|
1
|
+
module Rbuzz
|
5
2
|
class FeedError < Exception; end;
|
6
3
|
|
7
4
|
class Feed
|
@@ -13,7 +10,7 @@ module RBuzz
|
|
13
10
|
end
|
14
11
|
|
15
12
|
def self.retrieve(feed_url)
|
16
|
-
feed =
|
13
|
+
feed = Feed.new(feed_url)
|
17
14
|
feed.fetch
|
18
15
|
feed
|
19
16
|
end
|
@@ -41,7 +38,7 @@ module RBuzz
|
|
41
38
|
@atom_feed = Atom::Feed.load_feed(URI.parse(@feed_url))
|
42
39
|
end
|
43
40
|
|
44
|
-
# Retrieve the entries in the buzz atom feed as an array of
|
41
|
+
# Retrieve the entries in the buzz atom feed as an array of FeedEntry objects
|
45
42
|
# This will fetch the feed if it has not already been fetched
|
46
43
|
def entries
|
47
44
|
return @feed_entries if @feed_entries
|
data/lib/rbuzz/feed_entry.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Rbuzz
|
2
2
|
class FeedEntry
|
3
3
|
attr :atom_entry
|
4
4
|
attr :atom_replies
|
@@ -42,7 +42,7 @@ module RBuzz
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def videos
|
45
|
-
@videos ||= @atom_entry.links.find_all {|l| l.type =~ /
|
45
|
+
@videos ||= @atom_entry.links.find_all {|l| l.type =~ %r{application/x-shockwave-flash}i }.collect {|l| l.href}
|
46
46
|
end
|
47
47
|
|
48
48
|
def author
|
data/lib/rbuzz/feed_reply.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbuzz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Conor Hunt
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.6.3
|
24
24
|
version:
|
25
|
-
description: Ruby wrapper for Google Buzz
|
25
|
+
description: Ruby wrapper for Google Buzz atom feeds
|
26
26
|
email: conor.hunt@gmail.com
|
27
27
|
executables: []
|
28
28
|
|
@@ -65,6 +65,6 @@ rubyforge_project:
|
|
65
65
|
rubygems_version: 1.3.5
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
|
-
summary: Ruby wrapper for Google Buzz
|
68
|
+
summary: Ruby wrapper for Google Buzz atom feeds
|
69
69
|
test_files: []
|
70
70
|
|