featherdust 0.0.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.
- data/History.txt +6 -0
- data/Manifest.txt +7 -0
- data/README.txt +58 -0
- data/Rakefile +14 -0
- data/lib/featherdust.rb +68 -0
- data/test/cnn.xml +443 -0
- data/test/test_featherdust.rb +49 -0
- metadata +82 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,58 @@
|
|
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
|
+
|
26
|
+
== REQUIREMENTS:
|
27
|
+
|
28
|
+
* nokogiri
|
29
|
+
* net/http
|
30
|
+
|
31
|
+
== INSTALL:
|
32
|
+
|
33
|
+
* sudo gem install featherdust
|
34
|
+
|
35
|
+
== LICENSE:
|
36
|
+
|
37
|
+
(The MIT License)
|
38
|
+
|
39
|
+
Copyright (c) 2008 Michael Tierney
|
40
|
+
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
42
|
+
a copy of this software and associated documentation files (the
|
43
|
+
'Software'), to deal in the Software without restriction, including
|
44
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
45
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
46
|
+
permit persons to whom the Software is furnished to do so, subject to
|
47
|
+
the following conditions:
|
48
|
+
|
49
|
+
The above copyright notice and this permission notice shall be
|
50
|
+
included in all copies or substantial portions of the Software.
|
51
|
+
|
52
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
53
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
54
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
55
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
56
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
57
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
58
|
+
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/lib/featherdust.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Author: Michael Tierney
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'nokogiri'
|
5
|
+
require 'net/http'
|
6
|
+
|
7
|
+
class Featherdust
|
8
|
+
VERSION = '0.0.1'
|
9
|
+
|
10
|
+
attr_accessor :username, :num_posts, :raw_posts, :posts, :url
|
11
|
+
def initialize(username, num_posts = 20)
|
12
|
+
@username = username
|
13
|
+
@num_posts = num_posts
|
14
|
+
@raw_posts = Array.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.run(username, number)
|
18
|
+
twitter_list = Featherdust.new(username, number)
|
19
|
+
|
20
|
+
puts twitter_list.display_statuses
|
21
|
+
end
|
22
|
+
|
23
|
+
def url
|
24
|
+
@url ||= Net::HTTP.get "twitter.com", "/statuses/user_timeline/#{@username}.xml?count=#{@num_posts}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_statuses
|
28
|
+
if is_twitter_up? != "true"
|
29
|
+
raise "Twitter is having issues. Please check back later."
|
30
|
+
else
|
31
|
+
# status_list = Nokogiri::XML(Net::HTTP.get("twitter.com", "/statuses/user_timeline/#{@username}.xml?count=#{@num_posts}"))
|
32
|
+
status_list = Nokogiri::XML(Net::HTTP.get("twitter.com", "/statuses/user_timeline/#{@username}.xml?count=#{@num_posts}"))
|
33
|
+
status_list.xpath('/statuses/status').each do |statuses|
|
34
|
+
status_hash = {}
|
35
|
+
statuses.children.each do |status|
|
36
|
+
if status.name == "user"
|
37
|
+
status.children.each do |user|
|
38
|
+
user.name == "id" ? key = "user_id".to_sym : key = user.name.to_sym
|
39
|
+
value = user.inner_text
|
40
|
+
status_hash.store(key,value)
|
41
|
+
end
|
42
|
+
else
|
43
|
+
key = status.name.to_sym
|
44
|
+
value = status.inner_text
|
45
|
+
status_hash.store(key,value)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
@raw_posts << status_hash
|
49
|
+
end
|
50
|
+
end
|
51
|
+
return @raw_posts
|
52
|
+
end
|
53
|
+
|
54
|
+
def display_statuses
|
55
|
+
tweets = get_statuses
|
56
|
+
@posts = "<ul>"
|
57
|
+
tweets.each do |tweet|
|
58
|
+
@posts += "<li><p class=\"twitter_status\">#{tweet[:text]}</p>\n<span><a href=\"http://twitter.com/#{@username}/statuses/#{tweet[:id]}\" title=\"Status update on Twitter\"> on #{tweet[:created_at]}</a>\n</span></li>\n"
|
59
|
+
end
|
60
|
+
@posts += "</ul>"
|
61
|
+
end
|
62
|
+
|
63
|
+
def is_twitter_up?
|
64
|
+
twitter_status = Nokogiri::XML(Net::HTTP.get("twitter.com","/help/test.xml"))
|
65
|
+
twitter_status.xpath("/ok").inner_text
|
66
|
+
end
|
67
|
+
|
68
|
+
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,49 @@
|
|
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.rb'
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'nokogiri'
|
16
|
+
|
17
|
+
class TestFeatherdust < Test::Unit::TestCase
|
18
|
+
|
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
|
24
|
+
end
|
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
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_url_live
|
34
|
+
assert @live_test.url
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_url
|
38
|
+
assert @twitter_account.url
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_get_statuses
|
42
|
+
assert @twitter_account.get_statuses
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_display_statuses
|
46
|
+
assert @twitter_account.display_statuses
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: featherdust
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Tierney
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-17 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: nokogiri
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.2
|
34
|
+
version:
|
35
|
+
description: "Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API. 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). 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."
|
36
|
+
email:
|
37
|
+
- mike@panpainter.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
46
|
+
files:
|
47
|
+
- History.txt
|
48
|
+
- Manifest.txt
|
49
|
+
- README.txt
|
50
|
+
- Rakefile
|
51
|
+
- lib/featherdust.rb
|
52
|
+
- test/cnn.xml
|
53
|
+
- test/test_featherdust.rb
|
54
|
+
has_rdoc: true
|
55
|
+
homepage: http://rubyforge.org/projects/uwruby
|
56
|
+
post_install_message:
|
57
|
+
rdoc_options:
|
58
|
+
- --main
|
59
|
+
- README.txt
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project: uwruby
|
77
|
+
rubygems_version: 1.3.1
|
78
|
+
signing_key:
|
79
|
+
specification_version: 2
|
80
|
+
summary: Featherdust is a simple Twitter gem that grabs and parses data via the Twitter API
|
81
|
+
test_files:
|
82
|
+
- test/test_featherdust.rb
|