featherdust 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,20 @@
1
- === 1.0.0 / 2008-12-17
1
+ === 0.0.1 / 2008-12-17
2
2
 
3
- * 1 major enhancement
3
+ * First release
4
4
 
5
- * Birthday!
5
+ * Initial release
6
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
@@ -3,8 +3,6 @@ Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
5
  lib/featherdust.rb
6
- lib/particle.rb
7
6
  test/cnn.xml
8
7
  test/test_featherdust.rb
9
- test/test_particle.rb
10
8
  todo.txt
data/README.txt CHANGED
@@ -22,6 +22,11 @@ If you have questions (or suggestions), please feel free to shoot them off to mi
22
22
  == SYNOPSIS:
23
23
 
24
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
25
30
 
26
31
  == REQUIREMENTS:
27
32
 
@@ -30,7 +35,7 @@ If you have questions (or suggestions), please feel free to shoot them off to mi
30
35
 
31
36
  == INSTALL:
32
37
 
33
- * sudo gem install featherdust
38
+ * gem install featherdust
34
39
 
35
40
  == LICENSE:
36
41
 
@@ -3,31 +3,57 @@
3
3
  require 'rubygems'
4
4
  require 'nokogiri'
5
5
  require 'net/http'
6
+ require 'time'
6
7
 
7
8
  class Featherdust
8
- VERSION = '0.0.2'
9
+ VERSION = '0.0.3'
9
10
 
10
11
  attr_accessor :username, :num_posts, :raw_posts, :posts, :url
11
- def initialize(username, num_posts = 20)
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
+
12
26
  @username = username
13
27
  @num_posts = num_posts
14
28
  @raw_posts = Array.new
29
+
30
+
31
+ @url = Nokogiri::XML(Net::HTTP.get("twitter.com", "/statuses/user_timeline/#{@username}.xml?count=#{@num_posts}"))
15
32
  end
16
-
17
- def self.run command
18
- username = ARGV.shift
19
- number = ARGV.shift
20
33
 
21
- twitter_list = Featherdust.new(username, number)
22
-
23
- puts twitter_list.display_statuses
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
24
52
  end
25
53
 
26
54
  def get_statuses
27
- if is_twitter_up? != "true"
28
- raise "Twitter is having issues. Please check back later."
29
- else
30
- status_list = Nokogiri::XML(Net::HTTP.get("twitter.com", "/statuses/user_timeline/#{@username}.xml?count=#{@num_posts}"))
55
+ if is_twitter_up? == "true"
56
+ status_list = @url
31
57
  status_list.xpath('/statuses/status').each do |statuses|
32
58
  status_hash = {}
33
59
  statuses.children.each do |status|
@@ -48,26 +74,22 @@ class Featherdust
48
74
  end
49
75
  return @raw_posts
50
76
  end
51
-
52
- def display_statuses
53
- tweets = get_statuses
54
- @posts = "<ul>"
55
- tweets.each do |tweet|
56
- # TODO: This is really ugly, and I think it can be written better.
57
- @posts += "
58
- <li>
59
- <p class=\"twitter_status\">#{tweet[:text]}</p>
60
- <span><a href=\"http://twitter.com/#{@username}/statuses/#{tweet[:id]}\" title=\"Status update on Twitter\"> on #{tweet[:created_at]}</a></span>
61
- </li>"
62
- end
63
- @posts += "\n</ul>\n"
64
- end
65
-
77
+
66
78
  def is_twitter_up?
67
79
  twitter_status = Nokogiri::XML(Net::HTTP.get("twitter.com","/help/test.xml"))
68
80
  twitter_status.xpath("/ok").inner_text
69
81
  end
70
-
71
- end
72
82
 
73
- Featherdust.run(ARGV) if $0 == __FILE__
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
@@ -9,7 +9,7 @@
9
9
  $: << 'lib'
10
10
 
11
11
  require 'test/unit'
12
- require 'featherdust.rb'
12
+ require 'featherdust'
13
13
 
14
14
  require 'rubygems'
15
15
  require 'nokogiri'
@@ -17,276 +17,149 @@ require 'nokogiri'
17
17
  class TestFeatherdust < Test::Unit::TestCase
18
18
 
19
19
  def setup
20
- @twitter_account = Featherdust.new "cnn", 10
21
- @twitter_account.url = Nokogiri::XML(File.open('./test/cnn.xml'))
22
-
23
- @live_test = Featherdust.new "panpainter", 10
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
24
  end
25
25
 
26
- # TODO: Find out if there's a good way to make sure that this is working - I expect either a "true" or "false" in response
27
- def test_is_twitter_up?
28
- actual = @twitter_account.is_twitter_up?
29
- expected = "true"
30
- assert_equal expected, actual
26
+ def test_that_url_is_working
27
+ @live_test = Featherdust.new "cnn"
28
+ assert @live_test.url
31
29
  end
32
-
30
+
31
+ def test_get_statuses_actually_has_something
32
+ assert @cnn.raw_posts
33
+ end
34
+
33
35
  def test_get_statuses
34
- actual = @twitter_account.get_statuses
35
- expected = [{:location=>"",
36
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
37
- :url=>"http://www.cnn.com",
38
- :profile_image_url=>
39
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
40
- :in_reply_to_status_id=>"",
41
- :in_reply_to_screen_name=>"",
42
- :protected=>"false",
43
- :in_reply_to_user_id=>"",
44
- :created_at=>"Thu Dec 18 13:48:21 +0000 2008",
45
- :name=>"CNN.com",
46
- :user_id=>"759251",
47
- :followers_count=>"14965",
48
- :truncated=>"false",
49
- :description=>
50
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
51
- :text=>
52
- "20 Iraqi Interior Ministry officers arrested http://tinyurl.com/4xghtt",
53
- :favorited=>"false",
54
- :id=>"1064896431",
55
- :screen_name=>"cnn"},
56
- {:location=>"",
57
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
58
- :url=>"http://www.cnn.com",
59
- :profile_image_url=>
60
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
61
- :in_reply_to_status_id=>"",
62
- :in_reply_to_screen_name=>"",
63
- :protected=>"false",
64
- :in_reply_to_user_id=>"",
65
- :created_at=>"Thu Dec 18 10:49:17 +0000 2008",
66
- :name=>"CNN.com",
67
- :user_id=>"759251",
68
- :followers_count=>"14955",
69
- :truncated=>"false",
70
- :description=>
71
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
72
- :text=>"Bagosora guilty of Rwanda genocide http://tinyurl.com/3mw72t",
73
- :favorited=>"false",
74
- :id=>"1064690521",
75
- :screen_name=>"cnn"},
76
- {:location=>"",
77
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
78
- :url=>"http://www.cnn.com",
79
- :profile_image_url=>
80
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
81
- :in_reply_to_status_id=>"",
82
- :in_reply_to_screen_name=>"",
83
- :protected=>"false",
84
- :in_reply_to_user_id=>"",
85
- :created_at=>"Thu Dec 18 09:48:46 +0000 2008",
86
- :name=>"CNN.com",
87
- :user_id=>"759251",
88
- :followers_count=>"14954",
89
- :truncated=>"false",
90
- :description=>
91
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
92
- :text=>"Obama's inaugural choice ignites outrage http://tinyurl.com/52ojol",
93
- :favorited=>"false",
94
- :id=>"1064634944",
95
- :screen_name=>"cnn"},
96
- {:location=>"",
97
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
98
- :url=>"http://www.cnn.com",
99
- :profile_image_url=>
100
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
101
- :in_reply_to_status_id=>"",
102
- :in_reply_to_screen_name=>"",
103
- :protected=>"false",
104
- :in_reply_to_user_id=>"",
105
- :created_at=>"Thu Dec 18 09:48:38 +0000 2008",
106
- :name=>"CNN.com",
107
- :user_id=>"759251",
108
- :followers_count=>"14954",
109
- :truncated=>"false",
110
- :description=>
111
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
112
- :text=>
113
- "Alec Baldwin on divorce, custody and Palin http://tinyurl.com/3e6u37",
114
- :favorited=>"false",
115
- :id=>"1064634845",
116
- :screen_name=>"cnn"},
117
- {:location=>"",
118
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
119
- :url=>"http://www.cnn.com",
120
- :profile_image_url=>
121
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
122
- :in_reply_to_status_id=>"",
123
- :in_reply_to_screen_name=>"",
124
- :protected=>"false",
125
- :in_reply_to_user_id=>"",
126
- :created_at=>"Thu Dec 18 08:49:04 +0000 2008",
127
- :name=>"CNN.com",
128
- :user_id=>"759251",
129
- :followers_count=>"14955",
130
- :truncated=>"false",
131
- :description=>
132
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
133
- :text=>"Holiday health concerns may just be myths http://tinyurl.com/3zx4pd",
134
- :favorited=>"false",
135
- :id=>"1064580674",
136
- :screen_name=>"cnn"},
137
- {:location=>"",
138
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
139
- :url=>"http://www.cnn.com",
140
- :profile_image_url=>
141
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
142
- :in_reply_to_status_id=>"",
143
- :in_reply_to_screen_name=>"",
144
- :protected=>"false",
145
- :in_reply_to_user_id=>"",
146
- :created_at=>"Thu Dec 18 07:48:08 +0000 2008",
147
- :name=>"CNN.com",
148
- :user_id=>"759251",
149
- :followers_count=>"14954",
150
- :truncated=>"false",
151
- :description=>
152
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
153
- :text=>
154
- "Exxon Mobil to pay $6.1 million for air pollution http://tinyurl.com/48ohph",
155
- :favorited=>"false",
156
- :id=>"1064525536",
157
- :screen_name=>"cnn"},
158
- {:location=>"",
159
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
160
- :url=>"http://www.cnn.com",
161
- :profile_image_url=>
162
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
163
- :in_reply_to_status_id=>"",
164
- :in_reply_to_screen_name=>"",
165
- :protected=>"false",
166
- :in_reply_to_user_id=>"",
167
- :created_at=>"Thu Dec 18 04:48:37 +0000 2008",
168
- :name=>"CNN.com",
169
- :user_id=>"759251",
170
- :followers_count=>"14947",
171
- :truncated=>"false",
172
- :description=>
173
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
174
- :text=>
175
- "Rice talks successes, failures of past 8 years http://tinyurl.com/4uo83q",
176
- :favorited=>"false",
177
- :id=>"1064329837",
178
- :screen_name=>"cnn"},
179
- {:location=>"",
180
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
181
- :url=>"http://www.cnn.com",
182
- :profile_image_url=>
183
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
184
- :in_reply_to_status_id=>"",
185
- :in_reply_to_screen_name=>"",
186
- :protected=>"false",
187
- :in_reply_to_user_id=>"",
188
- :created_at=>"Thu Dec 18 04:48:35 +0000 2008",
189
- :name=>"CNN.com",
190
- :user_id=>"759251",
191
- :followers_count=>"14947",
192
- :truncated=>"false",
193
- :description=>
194
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
195
- :text=>
196
- "Credit card holders livid about 'rate-jacking' http://tinyurl.com/3jejsc",
197
- :favorited=>"false",
198
- :id=>"1064329783",
199
- :screen_name=>"cnn"},
200
- {:location=>"",
201
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
202
- :url=>"http://www.cnn.com",
203
- :profile_image_url=>
204
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
205
- :in_reply_to_status_id=>"",
206
- :in_reply_to_screen_name=>"",
207
- :protected=>"false",
208
- :in_reply_to_user_id=>"",
209
- :created_at=>"Thu Dec 18 02:48:53 +0000 2008",
210
- :name=>"CNN.com",
211
- :user_id=>"759251",
212
- :followers_count=>"14933",
213
- :truncated=>"false",
214
- :description=>
215
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
216
- :text=>"Brown: Obama should be more open to press http://tinyurl.com/4avj8n",
217
- :favorited=>"false",
218
- :id=>"1064150989",
219
- :screen_name=>"cnn"},
220
- {:location=>"",
221
- :source=>"<a href=\"http://twitterfeed.com\">twitterfeed</a>",
222
- :url=>"http://www.cnn.com",
223
- :profile_image_url=>
224
- "http://s3.amazonaws.com/twitter_production/profile_images/67228129/icon.cnn_normal.png",
225
- :in_reply_to_status_id=>"",
226
- :in_reply_to_screen_name=>"",
227
- :protected=>"false",
228
- :in_reply_to_user_id=>"",
229
- :created_at=>"Wed Dec 17 23:48:50 +0000 2008",
230
- :name=>"CNN.com",
231
- :user_id=>"759251",
232
- :followers_count=>"14925",
233
- :truncated=>"false",
234
- :description=>
235
- "Breaking News, U.S., World, Weather, Entertainment & Video News",
236
- :text=>
237
- "Walsh's legacy -- awareness of danger to kids http://tinyurl.com/495kwp",
238
- :favorited=>"false",
239
- :id=>"1063867194",
240
- :screen_name=>"cnn"}]
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")
241
42
  assert_equal expected, actual
242
43
  end
243
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
+
244
51
  def test_display_statuses
245
- actual = @twitter_account.display_statuses
246
- expected = "<ul>
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>
247
70
  <li>
248
- <p class=\"twitter_status\">20 Iraqi Interior Ministry officers arrested http://tinyurl.com/4xghtt</p>
249
- <span><a href=\"http://twitter.com/cnn/statuses/1064896431\" title=\"Status update on Twitter\"> on Thu Dec 18 13:48:21 +0000 2008</a></span>
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>
250
73
  </li>
251
74
  <li>
252
- <p class=\"twitter_status\">Bagosora guilty of Rwanda genocide http://tinyurl.com/3mw72t</p>
253
- <span><a href=\"http://twitter.com/cnn/statuses/1064690521\" title=\"Status update on Twitter\"> on Thu Dec 18 10:49:17 +0000 2008</a></span>
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>
254
77
  </li>
255
78
  <li>
256
- <p class=\"twitter_status\">Obama's inaugural choice ignites outrage http://tinyurl.com/52ojol</p>
257
- <span><a href=\"http://twitter.com/cnn/statuses/1064634944\" title=\"Status update on Twitter\"> on Thu Dec 18 09:48:46 +0000 2008</a></span>
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>
258
81
  </li>
259
82
  <li>
260
- <p class=\"twitter_status\">Alec Baldwin on divorce, custody and Palin http://tinyurl.com/3e6u37</p>
261
- <span><a href=\"http://twitter.com/cnn/statuses/1064634845\" title=\"Status update on Twitter\"> on Thu Dec 18 09:48:38 +0000 2008</a></span>
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>
262
85
  </li>
263
86
  <li>
264
- <p class=\"twitter_status\">Holiday health concerns may just be myths http://tinyurl.com/3zx4pd</p>
265
- <span><a href=\"http://twitter.com/cnn/statuses/1064580674\" title=\"Status update on Twitter\"> on Thu Dec 18 08:49:04 +0000 2008</a></span>
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>
266
89
  </li>
267
90
  <li>
268
- <p class=\"twitter_status\">Exxon Mobil to pay $6.1 million for air pollution http://tinyurl.com/48ohph</p>
269
- <span><a href=\"http://twitter.com/cnn/statuses/1064525536\" title=\"Status update on Twitter\"> on Thu Dec 18 07:48:08 +0000 2008</a></span>
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>
270
93
  </li>
271
94
  <li>
272
- <p class=\"twitter_status\">Rice talks successes, failures of past 8 years http://tinyurl.com/4uo83q</p>
273
- <span><a href=\"http://twitter.com/cnn/statuses/1064329837\" title=\"Status update on Twitter\"> on Thu Dec 18 04:48:37 +0000 2008</a></span>
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>
274
97
  </li>
275
98
  <li>
276
- <p class=\"twitter_status\">Credit card holders livid about 'rate-jacking' http://tinyurl.com/3jejsc</p>
277
- <span><a href=\"http://twitter.com/cnn/statuses/1064329783\" title=\"Status update on Twitter\"> on Thu Dec 18 04:48:35 +0000 2008</a></span>
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>
278
101
  </li>
279
102
  <li>
280
- <p class=\"twitter_status\">Brown: Obama should be more open to press http://tinyurl.com/4avj8n</p>
281
- <span><a href=\"http://twitter.com/cnn/statuses/1064150989\" title=\"Status update on Twitter\"> on Thu Dec 18 02:48:53 +0000 2008</a></span>
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>
282
105
  </li>
283
106
  <li>
284
- <p class=\"twitter_status\">Walsh's legacy -- awareness of danger to kids http://tinyurl.com/495kwp</p>
285
- <span><a href=\"http://twitter.com/cnn/statuses/1063867194\" title=\"Status update on Twitter\"> on Wed Dec 17 23:48:50 +0000 2008</a></span>
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>
286
133
  </li>
287
134
  </ul>
288
135
  "
289
- assert_equal expected, actual
290
- end
291
-
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
+
292
165
  end
data/todo.txt CHANGED
@@ -2,22 +2,9 @@ FEATHERDUST: A Twitter gem.
2
2
 
3
3
  TODO:
4
4
 
5
- Write Tests that fail!
6
- Make the tests pass!
7
- (Ok ... enough of being snarky.)
8
-
9
- XML Parser
10
- - take in a username
11
- base output option
12
- - limit output based on optional number of status updates (default is 10)
13
- - HTML Unordered List
14
- regex to detect/add links
15
- take in options block
16
5
  advanced output methods
17
6
  - div vs list (esp. if requested updates number is 1)
18
7
  - DL
19
8
  - others?
20
- headings
21
- default styles?
22
9
  examples
23
10
  documentation
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featherdust
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Tierney
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-18 00:00:00 -08:00
12
+ date: 2008-12-19 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,10 +50,8 @@ files:
50
50
  - README.txt
51
51
  - Rakefile
52
52
  - lib/featherdust.rb
53
- - lib/particle.rb
54
53
  - test/cnn.xml
55
54
  - test/test_featherdust.rb
56
- - test/test_particle.rb
57
55
  - todo.txt
58
56
  has_rdoc: true
59
57
  homepage: http://rubyforge.org/projects/uwruby
@@ -84,4 +82,3 @@ specification_version: 2
84
82
  summary: Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API
85
83
  test_files:
86
84
  - test/test_featherdust.rb
87
- - test/test_particle.rb
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby -w
2
-
3
- class Particle
4
-
5
- ATTRIBUTES = [:created_at, :id, :text, :source, :truncated, :in_reply_to_status_id, :in_reply_to_user_id, :in_reply_to_screen_name, :favorited ]
6
-
7
- ATTRIBUTES.each do |a|
8
- attr_accessor a
9
- end
10
-
11
- def initialize(song_data)
12
- ATTRIBUTES.each do |attr|
13
- self.send("#{attr}=", (song_data[attr] || ""))
14
- end
15
- end
16
- end
File without changes