panpainter-grit 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +20 -0
- data/Manifest.txt +8 -0
- data/README.txt +63 -0
- data/Rakefile +14 -0
- data/featherdust.gemspec +22 -0
- data/lib/featherdust.rb +95 -0
- data/test/cnn.xml +443 -0
- data/test/test_featherdust.rb +165 -0
- data/todo.txt +10 -0
- metadata +71 -0
data/History.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
=== 0.0.1 / 2008-12-17
|
2
|
+
|
3
|
+
* First release
|
4
|
+
|
5
|
+
* Initial release
|
6
|
+
|
7
|
+
|
8
|
+
=== 0.0.2 / 2008-12-18
|
9
|
+
|
10
|
+
* Updated release
|
11
|
+
|
12
|
+
* Cleaned up output functionality, and tests that pass are actually testing the gem, not just passing tests.
|
13
|
+
|
14
|
+
=== 0.0.3 / 2008-12-19
|
15
|
+
|
16
|
+
* Third release
|
17
|
+
|
18
|
+
* Added in link detection
|
19
|
+
* Properly structured tests
|
20
|
+
* Plain text version
|
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
= Featherdust
|
2
|
+
|
3
|
+
* http://rubyforge.org/projects/uwruby
|
4
|
+
* http://uwruby.rubyforge.org/featherdust/
|
5
|
+
* http://featherdust.panpainter.com
|
6
|
+
* http://github.com/panpainter/featherdust/tree/master
|
7
|
+
* http://panpainter.lighthouseapp.com/projects/21671/home
|
8
|
+
|
9
|
+
== DESCRIPTION:
|
10
|
+
|
11
|
+
Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API.
|
12
|
+
|
13
|
+
NOTE: This gem does not (and will not) support posting to twitter, adding/removing followers, etc. This is a data grabber only. If you want more interaction with Twitter, check out the Twitter gem (http://twitter.rubyforge.com) or Twitter4R (http://twitter4r.rubyforge.com).
|
14
|
+
|
15
|
+
If you have questions (or suggestions), please feel free to shoot them off to mike [at] panpainter [dot] com and I'll be happy to help.
|
16
|
+
|
17
|
+
== FEATURES/PROBLEMS:
|
18
|
+
|
19
|
+
* Takes in a username and an integer and returns a list of Twitter updates.
|
20
|
+
* KNOWN BUG: Currently, the response is ... well, really minimal. Like, not at all. Just sayin'.
|
21
|
+
|
22
|
+
== SYNOPSIS:
|
23
|
+
|
24
|
+
my_statuses = Featherdust.new("panpainter", 5)
|
25
|
+
my_statuses.display_status
|
26
|
+
|
27
|
+
=== Plain Text
|
28
|
+
plain_statuses = Featherdust.new("panpainter",5,{:display => "plain"})
|
29
|
+
plain_statuses.display_status
|
30
|
+
|
31
|
+
== REQUIREMENTS:
|
32
|
+
|
33
|
+
* nokogiri
|
34
|
+
* net/http
|
35
|
+
|
36
|
+
== INSTALL:
|
37
|
+
|
38
|
+
* gem install featherdust
|
39
|
+
|
40
|
+
== LICENSE:
|
41
|
+
|
42
|
+
(The MIT License)
|
43
|
+
|
44
|
+
Copyright (c) 2008 Michael Tierney
|
45
|
+
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
47
|
+
a copy of this software and associated documentation files (the
|
48
|
+
'Software'), to deal in the Software without restriction, including
|
49
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
50
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
51
|
+
permit persons to whom the Software is furnished to do so, subject to
|
52
|
+
the following conditions:
|
53
|
+
|
54
|
+
The above copyright notice and this permission notice shall be
|
55
|
+
included in all copies or substantial portions of the Software.
|
56
|
+
|
57
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
58
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
59
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
60
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
61
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
62
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
63
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/featherdust.rb'
|
6
|
+
|
7
|
+
Hoe.new('featherdust', Featherdust::VERSION) do |p|
|
8
|
+
p.rubyforge_name = 'uwruby' # if different than lowercase project name
|
9
|
+
p.developer('Michael Tierney', 'mike@panpainter.com')
|
10
|
+
|
11
|
+
p.extra_deps << ['nokogiri', '~> 1.0.0']
|
12
|
+
end
|
13
|
+
|
14
|
+
# vim: syntax=Ruby
|
data/featherdust.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "grit"
|
3
|
+
s.version = "0.0.3"
|
4
|
+
s.date = "2008-12-19"
|
5
|
+
s.summary = "Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API."
|
6
|
+
s.email = "mike@panpainter.com"
|
7
|
+
s.homepage = "http://github.com/panpainter/featherdust"
|
8
|
+
s.description = "Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API."
|
9
|
+
s.has_rdoc = false
|
10
|
+
s.authors = ["Michael Tierney"]
|
11
|
+
s.files = ["History.txt",
|
12
|
+
"README.txt",
|
13
|
+
"Rakefile",
|
14
|
+
"featherdust.gemspec",
|
15
|
+
"Manifest.txt",
|
16
|
+
"todo.txt",
|
17
|
+
"lib/featherdust.rb"]
|
18
|
+
s.test_files = ["test/cnn.xml", "test/test_featherdust.rb"]
|
19
|
+
s.rdoc_options = ["--main", "README.txt"]
|
20
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
21
|
+
s.add_dependency("diff-lcs", ["~> 1.0.0"])
|
22
|
+
end
|
data/lib/featherdust.rb
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Author: Michael Tierney
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'net/http'
|
6
|
+
require 'time'
|
7
|
+
|
8
|
+
class Featherdust
|
9
|
+
VERSION = '0.0.3'
|
10
|
+
|
11
|
+
attr_accessor :username, :num_posts, :raw_posts, :posts, :url
|
12
|
+
def initialize(*args)
|
13
|
+
|
14
|
+
args.each do |a|
|
15
|
+
if a.class == String
|
16
|
+
@username = a
|
17
|
+
elsif a.class == Hash
|
18
|
+
@plain_text = a[:display] if a[:display] = "plain"
|
19
|
+
elsif a.class == Fixnum
|
20
|
+
@num_posts = a
|
21
|
+
else
|
22
|
+
raise "Wrong variable type."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
@username = username
|
27
|
+
@num_posts = num_posts
|
28
|
+
@raw_posts = Array.new
|
29
|
+
|
30
|
+
|
31
|
+
@url = Nokogiri::XML(Net::HTTP.get("twitter.com", "/statuses/user_timeline/#{@username}.xml?count=#{@num_posts}"))
|
32
|
+
end
|
33
|
+
|
34
|
+
def display_statuses
|
35
|
+
tweets = get_statuses
|
36
|
+
if @plain_text
|
37
|
+
@posts = ""
|
38
|
+
tweets.each do |tweet|
|
39
|
+
@posts += "* #{tweet[:text]} (on #{pretty_time(tweet[:created_at])}) [http://twitter.com/#{@username}/statuses/#{tweet[:id]}]\n"
|
40
|
+
end
|
41
|
+
else
|
42
|
+
@posts = "<ul>\n"
|
43
|
+
tweets.each do |tweet|
|
44
|
+
@posts += " <li>
|
45
|
+
<p class=\"twitter_status\">#{urlize(tweet[:text])}</p>
|
46
|
+
<span><a href=\"http://twitter.com/#{@username}/statuses/#{tweet[:id]}\" title=\"Status update on Twitter\"> on #{pretty_time(tweet[:created_at])}</a></span>
|
47
|
+
</li>\n"
|
48
|
+
end
|
49
|
+
@posts += "</ul>\n"
|
50
|
+
end
|
51
|
+
return @posts
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_statuses
|
55
|
+
if is_twitter_up? == "true"
|
56
|
+
status_list = @url
|
57
|
+
status_list.xpath('/statuses/status').each do |statuses|
|
58
|
+
status_hash = {}
|
59
|
+
statuses.children.each do |status|
|
60
|
+
if status.name == "user"
|
61
|
+
status.children.each do |user|
|
62
|
+
user.name == "id" ? key = "user_id".to_sym : key = user.name.to_sym
|
63
|
+
value = user.inner_text
|
64
|
+
status_hash.store(key,value)
|
65
|
+
end
|
66
|
+
else
|
67
|
+
key = status.name.to_sym
|
68
|
+
value = status.inner_text
|
69
|
+
status_hash.store(key,value)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
@raw_posts << status_hash
|
73
|
+
end
|
74
|
+
end
|
75
|
+
return @raw_posts
|
76
|
+
end
|
77
|
+
|
78
|
+
def is_twitter_up?
|
79
|
+
twitter_status = Nokogiri::XML(Net::HTTP.get("twitter.com","/help/test.xml"))
|
80
|
+
twitter_status.xpath("/ok").inner_text
|
81
|
+
end
|
82
|
+
|
83
|
+
def pretty_time(date)
|
84
|
+
human_date = Date.parse(date)
|
85
|
+
pretty_date = human_date.strftime("%A, %b %d")
|
86
|
+
human_time = Time.parse(date)
|
87
|
+
pretty_date += human_time.strftime(" at %I:%M %p")
|
88
|
+
end
|
89
|
+
|
90
|
+
def urlize(string)
|
91
|
+
words = string.split(" ")
|
92
|
+
urlized = words.map{ |word| word =~ /(ht|f)tp(s?)/ ? word = "<a href=\"#{word}\">#{word}</a>" : word = word }
|
93
|
+
urlized.join(" ")
|
94
|
+
end
|
95
|
+
end
|
data/test/cnn.xml
ADDED
@@ -0,0 +1,443 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<statuses type="array">
|
3
|
+
<status>
|
4
|
+
<created_at>Wed Dec 17 03:48:28 +0000 2008</created_at>
|
5
|
+
<id>1062085628</id>
|
6
|
+
<text>Brown: Law lets a little boy down http://tinyurl.com/5qxmnj</text>
|
7
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
8
|
+
<truncated>false</truncated>
|
9
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
10
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
11
|
+
<favorited>false</favorited>
|
12
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
13
|
+
<user>
|
14
|
+
<id>759251</id>
|
15
|
+
<name>CNN.com</name>
|
16
|
+
<screen_name>cnn</screen_name>
|
17
|
+
<location></location>
|
18
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
19
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
20
|
+
<url>http://www.cnn.com</url>
|
21
|
+
<protected>false</protected>
|
22
|
+
<followers_count>14817</followers_count>
|
23
|
+
</user>
|
24
|
+
</status>
|
25
|
+
<status>
|
26
|
+
<created_at>Wed Dec 17 00:48:03 +0000 2008</created_at>
|
27
|
+
<id>1061804619</id>
|
28
|
+
<text>Expect cell phone logjam at inauguration http://tinyurl.com/5wetql</text>
|
29
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
30
|
+
<truncated>false</truncated>
|
31
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
32
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
33
|
+
<favorited>false</favorited>
|
34
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
35
|
+
<user>
|
36
|
+
<id>759251</id>
|
37
|
+
<name>CNN.com</name>
|
38
|
+
<screen_name>cnn</screen_name>
|
39
|
+
<location></location>
|
40
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
41
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
42
|
+
<url>http://www.cnn.com</url>
|
43
|
+
<protected>false</protected>
|
44
|
+
<followers_count>14799</followers_count>
|
45
|
+
</user>
|
46
|
+
</status>
|
47
|
+
<status>
|
48
|
+
<created_at>Tue Dec 16 23:48:21 +0000 2008</created_at>
|
49
|
+
<id>1061708271</id>
|
50
|
+
<text>Reid backs Caroline Kennedy for Senate http://tinyurl.com/6nhsj2</text>
|
51
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
52
|
+
<truncated>false</truncated>
|
53
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
54
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
55
|
+
<favorited>false</favorited>
|
56
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
57
|
+
<user>
|
58
|
+
<id>759251</id>
|
59
|
+
<name>CNN.com</name>
|
60
|
+
<screen_name>cnn</screen_name>
|
61
|
+
<location></location>
|
62
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
63
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
64
|
+
<url>http://www.cnn.com</url>
|
65
|
+
<protected>false</protected>
|
66
|
+
<followers_count>14797</followers_count>
|
67
|
+
</user>
|
68
|
+
</status>
|
69
|
+
<status>
|
70
|
+
<created_at>Tue Dec 16 23:48:15 +0000 2008</created_at>
|
71
|
+
<id>1061708121</id>
|
72
|
+
<text>Diabetes found to raise cancer mortality risk http://tinyurl.com/6m738h</text>
|
73
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
74
|
+
<truncated>false</truncated>
|
75
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
76
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
77
|
+
<favorited>false</favorited>
|
78
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
79
|
+
<user>
|
80
|
+
<id>759251</id>
|
81
|
+
<name>CNN.com</name>
|
82
|
+
<screen_name>cnn</screen_name>
|
83
|
+
<location></location>
|
84
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
85
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
86
|
+
<url>http://www.cnn.com</url>
|
87
|
+
<protected>false</protected>
|
88
|
+
<followers_count>14797</followers_count>
|
89
|
+
</user>
|
90
|
+
</status>
|
91
|
+
<status>
|
92
|
+
<created_at>Tue Dec 16 20:49:32 +0000 2008</created_at>
|
93
|
+
<id>1061386828</id>
|
94
|
+
<text>Detroit papers to end daily home delivery http://tinyurl.com/5eftgg</text>
|
95
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
96
|
+
<truncated>false</truncated>
|
97
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
98
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
99
|
+
<favorited>false</favorited>
|
100
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
101
|
+
<user>
|
102
|
+
<id>759251</id>
|
103
|
+
<name>CNN.com</name>
|
104
|
+
<screen_name>cnn</screen_name>
|
105
|
+
<location></location>
|
106
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
107
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
108
|
+
<url>http://www.cnn.com</url>
|
109
|
+
<protected>false</protected>
|
110
|
+
<followers_count>14781</followers_count>
|
111
|
+
</user>
|
112
|
+
</status>
|
113
|
+
<status>
|
114
|
+
<created_at>Tue Dec 16 19:49:08 +0000 2008</created_at>
|
115
|
+
<id>1061274894</id>
|
116
|
+
<text>'Treasure trove' of new species found http://tinyurl.com/6ey96r</text>
|
117
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
118
|
+
<truncated>false</truncated>
|
119
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
120
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
121
|
+
<favorited>false</favorited>
|
122
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
123
|
+
<user>
|
124
|
+
<id>759251</id>
|
125
|
+
<name>CNN.com</name>
|
126
|
+
<screen_name>cnn</screen_name>
|
127
|
+
<location></location>
|
128
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
129
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
130
|
+
<url>http://www.cnn.com</url>
|
131
|
+
<protected>false</protected>
|
132
|
+
<followers_count>14768</followers_count>
|
133
|
+
</user>
|
134
|
+
</status>
|
135
|
+
<status>
|
136
|
+
<created_at>Tue Dec 16 19:49:05 +0000 2008</created_at>
|
137
|
+
<id>1061274734</id>
|
138
|
+
<text>Bush talks bailout, Iraq, dodging shoes http://tinyurl.com/5we228</text>
|
139
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
140
|
+
<truncated>false</truncated>
|
141
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
142
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
143
|
+
<favorited>false</favorited>
|
144
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
145
|
+
<user>
|
146
|
+
<id>759251</id>
|
147
|
+
<name>CNN.com</name>
|
148
|
+
<screen_name>cnn</screen_name>
|
149
|
+
<location></location>
|
150
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
151
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
152
|
+
<url>http://www.cnn.com</url>
|
153
|
+
<protected>false</protected>
|
154
|
+
<followers_count>14768</followers_count>
|
155
|
+
</user>
|
156
|
+
</status>
|
157
|
+
<status>
|
158
|
+
<created_at>Tue Dec 16 19:49:01 +0000 2008</created_at>
|
159
|
+
<id>1061274627</id>
|
160
|
+
<text>Impeachment panel meets on Blagojevich http://tinyurl.com/5utxxv</text>
|
161
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
162
|
+
<truncated>false</truncated>
|
163
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
164
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
165
|
+
<favorited>false</favorited>
|
166
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
167
|
+
<user>
|
168
|
+
<id>759251</id>
|
169
|
+
<name>CNN.com</name>
|
170
|
+
<screen_name>cnn</screen_name>
|
171
|
+
<location></location>
|
172
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
173
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
174
|
+
<url>http://www.cnn.com</url>
|
175
|
+
<protected>false</protected>
|
176
|
+
<followers_count>14768</followers_count>
|
177
|
+
</user>
|
178
|
+
</status>
|
179
|
+
<status>
|
180
|
+
<created_at>Tue Dec 16 18:48:39 +0000 2008</created_at>
|
181
|
+
<id>1061161605</id>
|
182
|
+
<text>Suspect to be named in '81 Adam Walsh slaying http://tinyurl.com/6da9fa</text>
|
183
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
184
|
+
<truncated>false</truncated>
|
185
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
186
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
187
|
+
<favorited>false</favorited>
|
188
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
189
|
+
<user>
|
190
|
+
<id>759251</id>
|
191
|
+
<name>CNN.com</name>
|
192
|
+
<screen_name>cnn</screen_name>
|
193
|
+
<location></location>
|
194
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
195
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
196
|
+
<url>http://www.cnn.com</url>
|
197
|
+
<protected>false</protected>
|
198
|
+
<followers_count>14760</followers_count>
|
199
|
+
</user>
|
200
|
+
</status>
|
201
|
+
<status>
|
202
|
+
<created_at>Tue Dec 16 14:49:21 +0000 2008</created_at>
|
203
|
+
<id>1060699337</id>
|
204
|
+
<text>Iraqi doctor guilty of planning UK terror attacks http://tinyurl.com/5cvjk8</text>
|
205
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
206
|
+
<truncated>false</truncated>
|
207
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
208
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
209
|
+
<favorited>false</favorited>
|
210
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
211
|
+
<user>
|
212
|
+
<id>759251</id>
|
213
|
+
<name>CNN.com</name>
|
214
|
+
<screen_name>cnn</screen_name>
|
215
|
+
<location></location>
|
216
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
217
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
218
|
+
<url>http://www.cnn.com</url>
|
219
|
+
<protected>false</protected>
|
220
|
+
<followers_count>14723</followers_count>
|
221
|
+
</user>
|
222
|
+
</status>
|
223
|
+
<status>
|
224
|
+
<created_at>Tue Dec 16 14:49:14 +0000 2008</created_at>
|
225
|
+
<id>1060699134</id>
|
226
|
+
<text>Obama set to name more Cabinet picks http://tinyurl.com/5c2do7</text>
|
227
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
228
|
+
<truncated>false</truncated>
|
229
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
230
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
231
|
+
<favorited>false</favorited>
|
232
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
233
|
+
<user>
|
234
|
+
<id>759251</id>
|
235
|
+
<name>CNN.com</name>
|
236
|
+
<screen_name>cnn</screen_name>
|
237
|
+
<location></location>
|
238
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
239
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
240
|
+
<url>http://www.cnn.com</url>
|
241
|
+
<protected>false</protected>
|
242
|
+
<followers_count>14723</followers_count>
|
243
|
+
</user>
|
244
|
+
</status>
|
245
|
+
<status>
|
246
|
+
<created_at>Tue Dec 16 14:49:10 +0000 2008</created_at>
|
247
|
+
<id>1060698991</id>
|
248
|
+
<text>Slain student called 911, but no one came in time http://tinyurl.com/5om6pd</text>
|
249
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
250
|
+
<truncated>false</truncated>
|
251
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
252
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
253
|
+
<favorited>false</favorited>
|
254
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
255
|
+
<user>
|
256
|
+
<id>759251</id>
|
257
|
+
<name>CNN.com</name>
|
258
|
+
<screen_name>cnn</screen_name>
|
259
|
+
<location></location>
|
260
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
261
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
262
|
+
<url>http://www.cnn.com</url>
|
263
|
+
<protected>false</protected>
|
264
|
+
<followers_count>14723</followers_count>
|
265
|
+
</user>
|
266
|
+
</status>
|
267
|
+
<status>
|
268
|
+
<created_at>Tue Dec 16 12:48:28 +0000 2008</created_at>
|
269
|
+
<id>1060514802</id>
|
270
|
+
<text>Report: Dynamite defused in Paris store http://tinyurl.com/5md5oq</text>
|
271
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
272
|
+
<truncated>false</truncated>
|
273
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
274
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
275
|
+
<favorited>false</favorited>
|
276
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
277
|
+
<user>
|
278
|
+
<id>759251</id>
|
279
|
+
<name>CNN.com</name>
|
280
|
+
<screen_name>cnn</screen_name>
|
281
|
+
<location></location>
|
282
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
283
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
284
|
+
<url>http://www.cnn.com</url>
|
285
|
+
<protected>false</protected>
|
286
|
+
<followers_count>14720</followers_count>
|
287
|
+
</user>
|
288
|
+
</status>
|
289
|
+
<status>
|
290
|
+
<created_at>Tue Dec 16 12:48:21 +0000 2008</created_at>
|
291
|
+
<id>1060514656</id>
|
292
|
+
<text>Obamas should adopt shelter pup, poll says http://tinyurl.com/6j5tdn</text>
|
293
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
294
|
+
<truncated>false</truncated>
|
295
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
296
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
297
|
+
<favorited>false</favorited>
|
298
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
299
|
+
<user>
|
300
|
+
<id>759251</id>
|
301
|
+
<name>CNN.com</name>
|
302
|
+
<screen_name>cnn</screen_name>
|
303
|
+
<location></location>
|
304
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
305
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
306
|
+
<url>http://www.cnn.com</url>
|
307
|
+
<protected>false</protected>
|
308
|
+
<followers_count>14720</followers_count>
|
309
|
+
</user>
|
310
|
+
</status>
|
311
|
+
<status>
|
312
|
+
<created_at>Tue Dec 16 12:48:13 +0000 2008</created_at>
|
313
|
+
<id>1060514475</id>
|
314
|
+
<text>Commentary: Illinois voters, it's your fault http://tinyurl.com/5hw9bl</text>
|
315
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
316
|
+
<truncated>false</truncated>
|
317
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
318
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
319
|
+
<favorited>false</favorited>
|
320
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
321
|
+
<user>
|
322
|
+
<id>759251</id>
|
323
|
+
<name>CNN.com</name>
|
324
|
+
<screen_name>cnn</screen_name>
|
325
|
+
<location></location>
|
326
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
327
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
328
|
+
<url>http://www.cnn.com</url>
|
329
|
+
<protected>false</protected>
|
330
|
+
<followers_count>14720</followers_count>
|
331
|
+
</user>
|
332
|
+
</status>
|
333
|
+
<status>
|
334
|
+
<created_at>Tue Dec 16 11:48:14 +0000 2008</created_at>
|
335
|
+
<id>1060445840</id>
|
336
|
+
<text>Brother: Shoe thrower sought to humiliate Bush http://tinyurl.com/62gpzs</text>
|
337
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
338
|
+
<truncated>false</truncated>
|
339
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
340
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
341
|
+
<favorited>false</favorited>
|
342
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
343
|
+
<user>
|
344
|
+
<id>759251</id>
|
345
|
+
<name>CNN.com</name>
|
346
|
+
<screen_name>cnn</screen_name>
|
347
|
+
<location></location>
|
348
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
349
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
350
|
+
<url>http://www.cnn.com</url>
|
351
|
+
<protected>false</protected>
|
352
|
+
<followers_count>14719</followers_count>
|
353
|
+
</user>
|
354
|
+
</status>
|
355
|
+
<status>
|
356
|
+
<created_at>Tue Dec 16 08:49:30 +0000 2008</created_at>
|
357
|
+
<id>1060281163</id>
|
358
|
+
<text>Arctic blast grips much of nation http://tinyurl.com/5dhdye</text>
|
359
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
360
|
+
<truncated>false</truncated>
|
361
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
362
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
363
|
+
<favorited>false</favorited>
|
364
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
365
|
+
<user>
|
366
|
+
<id>759251</id>
|
367
|
+
<name>CNN.com</name>
|
368
|
+
<screen_name>cnn</screen_name>
|
369
|
+
<location></location>
|
370
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
371
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
372
|
+
<url>http://www.cnn.com</url>
|
373
|
+
<protected>false</protected>
|
374
|
+
<followers_count>14717</followers_count>
|
375
|
+
</user>
|
376
|
+
</status>
|
377
|
+
<status>
|
378
|
+
<created_at>Tue Dec 16 04:48:20 +0000 2008</created_at>
|
379
|
+
<id>1060028576</id>
|
380
|
+
<text>Brother: Shoe thrower wanted to humiliate Bush http://tinyurl.com/6agpas</text>
|
381
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
382
|
+
<truncated>false</truncated>
|
383
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
384
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
385
|
+
<favorited>false</favorited>
|
386
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
387
|
+
<user>
|
388
|
+
<id>759251</id>
|
389
|
+
<name>CNN.com</name>
|
390
|
+
<screen_name>cnn</screen_name>
|
391
|
+
<location></location>
|
392
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
393
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
394
|
+
<url>http://www.cnn.com</url>
|
395
|
+
<protected>false</protected>
|
396
|
+
<followers_count>14826</followers_count>
|
397
|
+
</user>
|
398
|
+
</status>
|
399
|
+
<status>
|
400
|
+
<created_at>Tue Dec 16 04:48:13 +0000 2008</created_at>
|
401
|
+
<id>1060028427</id>
|
402
|
+
<text>Marines face toy deficit as Christmas nears http://tinyurl.com/62tehr</text>
|
403
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
404
|
+
<truncated>false</truncated>
|
405
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
406
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
407
|
+
<favorited>false</favorited>
|
408
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
409
|
+
<user>
|
410
|
+
<id>759251</id>
|
411
|
+
<name>CNN.com</name>
|
412
|
+
<screen_name>cnn</screen_name>
|
413
|
+
<location></location>
|
414
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
415
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
416
|
+
<url>http://www.cnn.com</url>
|
417
|
+
<protected>false</protected>
|
418
|
+
<followers_count>14826</followers_count>
|
419
|
+
</user>
|
420
|
+
</status>
|
421
|
+
<status>
|
422
|
+
<created_at>Tue Dec 16 02:48:43 +0000 2008</created_at>
|
423
|
+
<id>1059848165</id>
|
424
|
+
<text>Brown: Who's to blame when a con man hits? http://tinyurl.com/5u7aoj</text>
|
425
|
+
<source><a href="http://twitterfeed.com">twitterfeed</a></source>
|
426
|
+
<truncated>false</truncated>
|
427
|
+
<in_reply_to_status_id></in_reply_to_status_id>
|
428
|
+
<in_reply_to_user_id></in_reply_to_user_id>
|
429
|
+
<favorited>false</favorited>
|
430
|
+
<in_reply_to_screen_name></in_reply_to_screen_name>
|
431
|
+
<user>
|
432
|
+
<id>759251</id>
|
433
|
+
<name>CNN.com</name>
|
434
|
+
<screen_name>cnn</screen_name>
|
435
|
+
<location></location>
|
436
|
+
<description>Breaking News, U.S., World, Weather, Entertainment & Video News</description>
|
437
|
+
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png</profile_image_url>
|
438
|
+
<url>http://www.cnn.com</url>
|
439
|
+
<protected>false</protected>
|
440
|
+
<followers_count>14810</followers_count>
|
441
|
+
</user>
|
442
|
+
</status>
|
443
|
+
</statuses>
|
@@ -0,0 +1,165 @@
|
|
1
|
+
#!/usr/bin/env ruby -w
|
2
|
+
|
3
|
+
##
|
4
|
+
# Author: Michael Tierney
|
5
|
+
# Email: mike@panpainter.com
|
6
|
+
# Featherdust Test Suite
|
7
|
+
#
|
8
|
+
|
9
|
+
$: << 'lib'
|
10
|
+
|
11
|
+
require 'test/unit'
|
12
|
+
require 'featherdust'
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'nokogiri'
|
16
|
+
|
17
|
+
class TestFeatherdust < Test::Unit::TestCase
|
18
|
+
|
19
|
+
def setup
|
20
|
+
@cnn = Featherdust.new "cnn", 20
|
21
|
+
@cnn.url = Nokogiri::XML(File.open('./test/cnn.xml')) # don't want to rely on CNN not updating again, or the internet working for that matter.
|
22
|
+
@plain_cnn = Featherdust.new "cnn", 20, {:display => "plain" }
|
23
|
+
@plain_cnn.url = Nokogiri::XML(File.open('./test/cnn.xml')) # don't want to rely on CNN not updating again, or the internet working for that matter.
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_that_url_is_working
|
27
|
+
@live_test = Featherdust.new "cnn"
|
28
|
+
assert @live_test.url
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_get_statuses_actually_has_something
|
32
|
+
assert @cnn.raw_posts
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_get_statuses
|
36
|
+
assert @cnn.get_statuses
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_pretty_time
|
40
|
+
expected = "Tuesday, Dec 16 at 08:48 PM"
|
41
|
+
actual = @cnn.pretty_time("Tue Dec 16 04:48:13 +0000 2008")
|
42
|
+
assert_equal expected, actual
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_urlize
|
46
|
+
expected = "You can use <a href=\"http://www.ruby-doc.org\">http://www.ruby-doc.org</a> to learn about Ruby."
|
47
|
+
actual = @cnn.urlize("You can use http://www.ruby-doc.org to learn about Ruby.")
|
48
|
+
assert_equal expected, actual
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_display_statuses
|
52
|
+
actual = @cnn.display_statuses
|
53
|
+
expected = "<ul>
|
54
|
+
<li>
|
55
|
+
<p class=\"twitter_status\">Brown: Law lets a little boy down <a href=\"http://tinyurl.com/5qxmnj\">http://tinyurl.com/5qxmnj</a></p>
|
56
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1062085628\" title=\"Status update on Twitter\"> on Wednesday, Dec 17 at 07:48 PM</a></span>
|
57
|
+
</li>
|
58
|
+
<li>
|
59
|
+
<p class=\"twitter_status\">Expect cell phone logjam at inauguration <a href=\"http://tinyurl.com/5wetql\">http://tinyurl.com/5wetql</a></p>
|
60
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061804619\" title=\"Status update on Twitter\"> on Wednesday, Dec 17 at 04:48 PM</a></span>
|
61
|
+
</li>
|
62
|
+
<li>
|
63
|
+
<p class=\"twitter_status\">Reid backs Caroline Kennedy for Senate <a href=\"http://tinyurl.com/6nhsj2\">http://tinyurl.com/6nhsj2</a></p>
|
64
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061708271\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 03:48 PM</a></span>
|
65
|
+
</li>
|
66
|
+
<li>
|
67
|
+
<p class=\"twitter_status\">Diabetes found to raise cancer mortality risk <a href=\"http://tinyurl.com/6m738h\">http://tinyurl.com/6m738h</a></p>
|
68
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061708121\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 03:48 PM</a></span>
|
69
|
+
</li>
|
70
|
+
<li>
|
71
|
+
<p class=\"twitter_status\">Detroit papers to end daily home delivery <a href=\"http://tinyurl.com/5eftgg\">http://tinyurl.com/5eftgg</a></p>
|
72
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061386828\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 12:49 PM</a></span>
|
73
|
+
</li>
|
74
|
+
<li>
|
75
|
+
<p class=\"twitter_status\">'Treasure trove' of new species found <a href=\"http://tinyurl.com/6ey96r\">http://tinyurl.com/6ey96r</a></p>
|
76
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061274894\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 11:49 AM</a></span>
|
77
|
+
</li>
|
78
|
+
<li>
|
79
|
+
<p class=\"twitter_status\">Bush talks bailout, Iraq, dodging shoes <a href=\"http://tinyurl.com/5we228\">http://tinyurl.com/5we228</a></p>
|
80
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061274734\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 11:49 AM</a></span>
|
81
|
+
</li>
|
82
|
+
<li>
|
83
|
+
<p class=\"twitter_status\">Impeachment panel meets on Blagojevich <a href=\"http://tinyurl.com/5utxxv\">http://tinyurl.com/5utxxv</a></p>
|
84
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061274627\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 11:49 AM</a></span>
|
85
|
+
</li>
|
86
|
+
<li>
|
87
|
+
<p class=\"twitter_status\">Suspect to be named in '81 Adam Walsh slaying <a href=\"http://tinyurl.com/6da9fa\">http://tinyurl.com/6da9fa</a></p>
|
88
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1061161605\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 10:48 AM</a></span>
|
89
|
+
</li>
|
90
|
+
<li>
|
91
|
+
<p class=\"twitter_status\">Iraqi doctor guilty of planning UK terror attacks <a href=\"http://tinyurl.com/5cvjk8\">http://tinyurl.com/5cvjk8</a></p>
|
92
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060699337\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 06:49 AM</a></span>
|
93
|
+
</li>
|
94
|
+
<li>
|
95
|
+
<p class=\"twitter_status\">Obama set to name more Cabinet picks <a href=\"http://tinyurl.com/5c2do7\">http://tinyurl.com/5c2do7</a></p>
|
96
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060699134\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 06:49 AM</a></span>
|
97
|
+
</li>
|
98
|
+
<li>
|
99
|
+
<p class=\"twitter_status\">Slain student called 911, but no one came in time <a href=\"http://tinyurl.com/5om6pd\">http://tinyurl.com/5om6pd</a></p>
|
100
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060698991\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 06:49 AM</a></span>
|
101
|
+
</li>
|
102
|
+
<li>
|
103
|
+
<p class=\"twitter_status\">Report: Dynamite defused in Paris store <a href=\"http://tinyurl.com/5md5oq\">http://tinyurl.com/5md5oq</a></p>
|
104
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060514802\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 04:48 AM</a></span>
|
105
|
+
</li>
|
106
|
+
<li>
|
107
|
+
<p class=\"twitter_status\">Obamas should adopt shelter pup, poll says <a href=\"http://tinyurl.com/6j5tdn\">http://tinyurl.com/6j5tdn</a></p>
|
108
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060514656\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 04:48 AM</a></span>
|
109
|
+
</li>
|
110
|
+
<li>
|
111
|
+
<p class=\"twitter_status\">Commentary: Illinois voters, it's your fault <a href=\"http://tinyurl.com/5hw9bl\">http://tinyurl.com/5hw9bl</a></p>
|
112
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060514475\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 04:48 AM</a></span>
|
113
|
+
</li>
|
114
|
+
<li>
|
115
|
+
<p class=\"twitter_status\">Brother: Shoe thrower sought to humiliate Bush <a href=\"http://tinyurl.com/62gpzs\">http://tinyurl.com/62gpzs</a></p>
|
116
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060445840\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 03:48 AM</a></span>
|
117
|
+
</li>
|
118
|
+
<li>
|
119
|
+
<p class=\"twitter_status\">Arctic blast grips much of nation <a href=\"http://tinyurl.com/5dhdye\">http://tinyurl.com/5dhdye</a></p>
|
120
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060281163\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 12:49 AM</a></span>
|
121
|
+
</li>
|
122
|
+
<li>
|
123
|
+
<p class=\"twitter_status\">Brother: Shoe thrower wanted to humiliate Bush <a href=\"http://tinyurl.com/6agpas\">http://tinyurl.com/6agpas</a></p>
|
124
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060028576\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 08:48 PM</a></span>
|
125
|
+
</li>
|
126
|
+
<li>
|
127
|
+
<p class=\"twitter_status\">Marines face toy deficit as Christmas nears <a href=\"http://tinyurl.com/62tehr\">http://tinyurl.com/62tehr</a></p>
|
128
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1060028427\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 08:48 PM</a></span>
|
129
|
+
</li>
|
130
|
+
<li>
|
131
|
+
<p class=\"twitter_status\">Brown: Who's to blame when a con man hits? <a href=\"http://tinyurl.com/5u7aoj\">http://tinyurl.com/5u7aoj</a></p>
|
132
|
+
<span><a href=\"http://twitter.com/cnn/statuses/1059848165\" title=\"Status update on Twitter\"> on Tuesday, Dec 16 at 06:48 PM</a></span>
|
133
|
+
</li>
|
134
|
+
</ul>
|
135
|
+
"
|
136
|
+
assert_equal expected, actual
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_plain_statuses
|
140
|
+
actual = @plain_cnn.display_statuses
|
141
|
+
expected = "* Brown: Law lets a little boy down http://tinyurl.com/5qxmnj (on Wednesday, Dec 17 at 07:48 PM) [http://twitter.com/cnn/statuses/1062085628]
|
142
|
+
* Expect cell phone logjam at inauguration http://tinyurl.com/5wetql (on Wednesday, Dec 17 at 04:48 PM) [http://twitter.com/cnn/statuses/1061804619]
|
143
|
+
* Reid backs Caroline Kennedy for Senate http://tinyurl.com/6nhsj2 (on Tuesday, Dec 16 at 03:48 PM) [http://twitter.com/cnn/statuses/1061708271]
|
144
|
+
* Diabetes found to raise cancer mortality risk http://tinyurl.com/6m738h (on Tuesday, Dec 16 at 03:48 PM) [http://twitter.com/cnn/statuses/1061708121]
|
145
|
+
* Detroit papers to end daily home delivery http://tinyurl.com/5eftgg (on Tuesday, Dec 16 at 12:49 PM) [http://twitter.com/cnn/statuses/1061386828]
|
146
|
+
* 'Treasure trove' of new species found http://tinyurl.com/6ey96r (on Tuesday, Dec 16 at 11:49 AM) [http://twitter.com/cnn/statuses/1061274894]
|
147
|
+
* Bush talks bailout, Iraq, dodging shoes http://tinyurl.com/5we228 (on Tuesday, Dec 16 at 11:49 AM) [http://twitter.com/cnn/statuses/1061274734]
|
148
|
+
* Impeachment panel meets on Blagojevich http://tinyurl.com/5utxxv (on Tuesday, Dec 16 at 11:49 AM) [http://twitter.com/cnn/statuses/1061274627]
|
149
|
+
* Suspect to be named in '81 Adam Walsh slaying http://tinyurl.com/6da9fa (on Tuesday, Dec 16 at 10:48 AM) [http://twitter.com/cnn/statuses/1061161605]
|
150
|
+
* Iraqi doctor guilty of planning UK terror attacks http://tinyurl.com/5cvjk8 (on Tuesday, Dec 16 at 06:49 AM) [http://twitter.com/cnn/statuses/1060699337]
|
151
|
+
* Obama set to name more Cabinet picks http://tinyurl.com/5c2do7 (on Tuesday, Dec 16 at 06:49 AM) [http://twitter.com/cnn/statuses/1060699134]
|
152
|
+
* Slain student called 911, but no one came in time http://tinyurl.com/5om6pd (on Tuesday, Dec 16 at 06:49 AM) [http://twitter.com/cnn/statuses/1060698991]
|
153
|
+
* Report: Dynamite defused in Paris store http://tinyurl.com/5md5oq (on Tuesday, Dec 16 at 04:48 AM) [http://twitter.com/cnn/statuses/1060514802]
|
154
|
+
* Obamas should adopt shelter pup, poll says http://tinyurl.com/6j5tdn (on Tuesday, Dec 16 at 04:48 AM) [http://twitter.com/cnn/statuses/1060514656]
|
155
|
+
* Commentary: Illinois voters, it's your fault http://tinyurl.com/5hw9bl (on Tuesday, Dec 16 at 04:48 AM) [http://twitter.com/cnn/statuses/1060514475]
|
156
|
+
* Brother: Shoe thrower sought to humiliate Bush http://tinyurl.com/62gpzs (on Tuesday, Dec 16 at 03:48 AM) [http://twitter.com/cnn/statuses/1060445840]
|
157
|
+
* Arctic blast grips much of nation http://tinyurl.com/5dhdye (on Tuesday, Dec 16 at 12:49 AM) [http://twitter.com/cnn/statuses/1060281163]
|
158
|
+
* Brother: Shoe thrower wanted to humiliate Bush http://tinyurl.com/6agpas (on Tuesday, Dec 16 at 08:48 PM) [http://twitter.com/cnn/statuses/1060028576]
|
159
|
+
* Marines face toy deficit as Christmas nears http://tinyurl.com/62tehr (on Tuesday, Dec 16 at 08:48 PM) [http://twitter.com/cnn/statuses/1060028427]
|
160
|
+
* Brown: Who's to blame when a con man hits? http://tinyurl.com/5u7aoj (on Tuesday, Dec 16 at 06:48 PM) [http://twitter.com/cnn/statuses/1059848165]
|
161
|
+
"
|
162
|
+
assert_equal expected, actual
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
data/todo.txt
ADDED
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: panpainter-grit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Tierney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-19 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: diff-lcs
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.0
|
23
|
+
version:
|
24
|
+
description: Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API.
|
25
|
+
email: mike@panpainter.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- History.txt
|
32
|
+
- Manifest.txt
|
33
|
+
- README.txt
|
34
|
+
files:
|
35
|
+
- History.txt
|
36
|
+
- README.txt
|
37
|
+
- Rakefile
|
38
|
+
- featherdust.gemspec
|
39
|
+
- Manifest.txt
|
40
|
+
- todo.txt
|
41
|
+
- lib/featherdust.rb
|
42
|
+
has_rdoc: false
|
43
|
+
homepage: http://github.com/panpainter/featherdust
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options:
|
46
|
+
- --main
|
47
|
+
- README.txt
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.2.0
|
66
|
+
signing_key:
|
67
|
+
specification_version: 2
|
68
|
+
summary: Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API.
|
69
|
+
test_files:
|
70
|
+
- test/cnn.xml
|
71
|
+
- test/test_featherdust.rb
|