twitter-multi 0.9.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/History +290 -0
  2. data/License +20 -0
  3. data/Notes +33 -0
  4. data/README.rdoc +19 -0
  5. data/Rakefile +40 -0
  6. data/VERSION.yml +5 -0
  7. data/examples/connect.rb +30 -0
  8. data/examples/friendship_existence.rb +13 -0
  9. data/examples/helpers/config_store.rb +38 -0
  10. data/examples/httpauth.rb +11 -0
  11. data/examples/ids.rb +13 -0
  12. data/examples/lists.rb +11 -0
  13. data/examples/oauth.rb +27 -0
  14. data/examples/search.rb +15 -0
  15. data/examples/timeline.rb +19 -0
  16. data/examples/tumblr.rb +9 -0
  17. data/examples/unauthorized.rb +16 -0
  18. data/examples/update.rb +11 -0
  19. data/examples/user.rb +5 -0
  20. data/lib/twitter/base.rb +390 -0
  21. data/lib/twitter/geo.rb +25 -0
  22. data/lib/twitter/httpauth.rb +53 -0
  23. data/lib/twitter/local_trends.rb +30 -0
  24. data/lib/twitter/oauth.rb +64 -0
  25. data/lib/twitter/request.rb +71 -0
  26. data/lib/twitter/search.rb +163 -0
  27. data/lib/twitter/trends.rb +55 -0
  28. data/lib/twitter.rb +156 -0
  29. data/test/fixtures/blocking.json +1632 -0
  30. data/test/fixtures/firehose.json +1 -0
  31. data/test/fixtures/follower_ids.json +1 -0
  32. data/test/fixtures/followers.json +1 -0
  33. data/test/fixtures/friend_ids.json +1 -0
  34. data/test/fixtures/friends_timeline.json +1 -0
  35. data/test/fixtures/friendship.json +1 -0
  36. data/test/fixtures/friendship_exists.json +1 -0
  37. data/test/fixtures/geo_place.json +1 -0
  38. data/test/fixtures/geo_reverse_geocode.json +1 -0
  39. data/test/fixtures/geo_reverse_geocode_granularity.json +1 -0
  40. data/test/fixtures/geo_reverse_geocode_limit.json +1 -0
  41. data/test/fixtures/geo_search.json +1 -0
  42. data/test/fixtures/geo_search_ip_address.json +1 -0
  43. data/test/fixtures/geo_search_query.json +1 -0
  44. data/test/fixtures/home_timeline.json +1 -0
  45. data/test/fixtures/ids.json +1 -0
  46. data/test/fixtures/list.json +1 -0
  47. data/test/fixtures/list_statuses.json +1 -0
  48. data/test/fixtures/list_statuses_1_1.json +1 -0
  49. data/test/fixtures/list_statuses_2_1.json +1 -0
  50. data/test/fixtures/list_subscriptions.json +1 -0
  51. data/test/fixtures/list_users.json +1 -0
  52. data/test/fixtures/lists.json +1 -0
  53. data/test/fixtures/memberships.json +1 -0
  54. data/test/fixtures/mentions.json +1 -0
  55. data/test/fixtures/not_found.json +1 -0
  56. data/test/fixtures/people_search.json +39 -0
  57. data/test/fixtures/rate_limit_exceeded.json +1 -0
  58. data/test/fixtures/report_spam.json +41 -0
  59. data/test/fixtures/retweet.json +1 -0
  60. data/test/fixtures/retweeted_by_me.json +1 -0
  61. data/test/fixtures/retweeted_to_me.json +1 -0
  62. data/test/fixtures/retweeters_of_tweet.json +166 -0
  63. data/test/fixtures/retweets.json +1 -0
  64. data/test/fixtures/retweets_of_me.json +1 -0
  65. data/test/fixtures/sample-image.png +0 -0
  66. data/test/fixtures/saved_search.json +7 -0
  67. data/test/fixtures/saved_searches.json +16 -0
  68. data/test/fixtures/search.json +1 -0
  69. data/test/fixtures/search_from_jnunemaker.json +1 -0
  70. data/test/fixtures/status.json +1 -0
  71. data/test/fixtures/status_show.json +1 -0
  72. data/test/fixtures/trends_available.json +253 -0
  73. data/test/fixtures/trends_current.json +1 -0
  74. data/test/fixtures/trends_current_exclude.json +1 -0
  75. data/test/fixtures/trends_daily.json +1925 -0
  76. data/test/fixtures/trends_daily_date.json +1 -0
  77. data/test/fixtures/trends_daily_exclude.json +1 -0
  78. data/test/fixtures/trends_location.json +57 -0
  79. data/test/fixtures/trends_weekly.json +1 -0
  80. data/test/fixtures/trends_weekly_date.json +1 -0
  81. data/test/fixtures/trends_weekly_exclude.json +1 -0
  82. data/test/fixtures/unauthorized.json +1 -0
  83. data/test/fixtures/update_profile_background_image.json +1 -0
  84. data/test/fixtures/update_profile_image.json +1 -0
  85. data/test/fixtures/user.json +1 -0
  86. data/test/fixtures/user_timeline.json +710 -0
  87. data/test/fixtures/users.json +1 -0
  88. data/test/test_helper.rb +47 -0
  89. data/test/twitter/base_test.rb +426 -0
  90. data/test/twitter/geo_test.rb +79 -0
  91. data/test/twitter/httpauth_test.rb +86 -0
  92. data/test/twitter/oauth_test.rb +108 -0
  93. data/test/twitter/request_test.rb +217 -0
  94. data/test/twitter/search_test.rb +208 -0
  95. data/test/twitter/trends_test.rb +112 -0
  96. data/test/twitter_test.rb +106 -0
  97. metadata +329 -0
@@ -0,0 +1,106 @@
1
+ require 'test_helper'
2
+
3
+ class TwitterTest < Test::Unit::TestCase
4
+ should "have firehose method for public timeline" do
5
+ stub_get('http://api.twitter.com:80/1/statuses/public_timeline.json', 'firehose.json')
6
+ hose = Twitter.firehose
7
+ hose.size.should == 20
8
+ first = hose.first
9
+ first.text.should == '#torrents Ultimativer Flirt Guide - In 10 Minuten jede Frau erobern: Ultimativer Flirt Guide - In 10 Mi.. http://tinyurl.com/d3okh4'
10
+ first.user.name.should == 'P2P Torrents'
11
+ end
12
+
13
+ should "have user method for unauthenticated calls to get a user's information" do
14
+ stub_get('http://api.twitter.com:80/1/users/show/jnunemaker.json', 'user.json')
15
+ user = Twitter.user('jnunemaker')
16
+ user.name.should == 'John Nunemaker'
17
+ user.description.should == 'Loves his wife, ruby, notre dame football and iu basketball'
18
+ end
19
+
20
+ should "have status method for unauthenticated calls to get a status" do
21
+ stub_get('http://api.twitter.com:80/1/statuses/show/1533815199.json', 'status_show.json')
22
+ status = Twitter.status(1533815199)
23
+ status.id.should == 1533815199
24
+ status.text.should == 'Eating some oatmeal and butterscotch cookies with a cold glass of milk for breakfast. Tasty!'
25
+ end
26
+
27
+ should "raise NotFound for unauthenticated calls to get a deleted or nonexistent status" do
28
+ stub_get('http://api.twitter.com:80/1/statuses/show/1.json', 'not_found.json', 404)
29
+ lambda {
30
+ Twitter.status(1)
31
+ }.should raise_error(Twitter::NotFound)
32
+ end
33
+
34
+ should "have a timeline method for unauthenticated calls to get a user's timeline" do
35
+ stub_get('http://api.twitter.com:80/1/statuses/user_timeline/jnunemaker.json', 'user_timeline.json')
36
+ statuses = Twitter.timeline('jnunemaker')
37
+ statuses.first.id.should == 1445986256
38
+ statuses.first.user.screen_name.should == 'jnunemaker'
39
+ end
40
+
41
+ should "raise Unauthorized for unauthenticated calls to get a protected user's timeline" do
42
+ stub_get('http://api.twitter.com:80/1/statuses/user_timeline/protected.json', 'unauthorized.json', 401)
43
+ lambda {
44
+ Twitter.timeline('protected')
45
+ }.should raise_error(Twitter::Unauthorized)
46
+ end
47
+
48
+ should "have friend_ids method" do
49
+ stub_get('http://api.twitter.com:80/1/friends/ids/jnunemaker.json', 'friend_ids.json')
50
+ ids = Twitter.friend_ids('jnunemaker')
51
+ ids.size.should == 161
52
+ end
53
+
54
+ should "raise Unauthorized for unauthenticated calls to get a protected user's friend_ids" do
55
+ stub_get('http://api.twitter.com:80/1/friends/ids/protected.json', 'unauthorized.json', 401)
56
+ lambda {
57
+ Twitter.friend_ids('protected')
58
+ }.should raise_error(Twitter::Unauthorized)
59
+ end
60
+
61
+ should "have follower_ids method" do
62
+ stub_get('http://api.twitter.com:80/1/followers/ids/jnunemaker.json', 'follower_ids.json')
63
+ ids = Twitter.follower_ids('jnunemaker')
64
+ ids.size.should == 1252
65
+ end
66
+
67
+ should "raise Unauthorized for unauthenticated calls to get a protected user's follower_ids" do
68
+ stub_get('http://api.twitter.com:80/1/followers/ids/protected.json', 'unauthorized.json', 401)
69
+ lambda {
70
+ Twitter.follower_ids('protected')
71
+ }.should raise_error(Twitter::Unauthorized)
72
+ end
73
+
74
+ context "when using lists" do
75
+
76
+ should "be able to view list timeline" do
77
+ stub_get('http://api.twitter.com:80/1/pengwynn/lists/rubyists/statuses.json', 'list_statuses.json')
78
+ tweets = Twitter.list_timeline('pengwynn', 'rubyists')
79
+ tweets.size.should == 20
80
+ tweets.first.id.should == 5272535583
81
+ tweets.first.user.name.should == 'John Nunemaker'
82
+ end
83
+
84
+ should "be able to limit number of tweets in list timeline" do
85
+ stub_get('http://api.twitter.com:80/1/pengwynn/lists/rubyists/statuses.json?per_page=1', 'list_statuses_1_1.json')
86
+ tweets = Twitter.list_timeline('pengwynn', 'rubyists', :per_page => 1)
87
+ tweets.size.should == 1
88
+ tweets.first.id.should == 5272535583
89
+ tweets.first.user.name.should == 'John Nunemaker'
90
+ end
91
+
92
+ should "be able to paginate through the timeline" do
93
+ stub_get('http://api.twitter.com:80/1/pengwynn/lists/rubyists/statuses.json?page=1&per_page=1', 'list_statuses_1_1.json')
94
+ stub_get('http://api.twitter.com:80/1/pengwynn/lists/rubyists/statuses.json?page=2&per_page=1', 'list_statuses_2_1.json')
95
+ tweets = Twitter.list_timeline('pengwynn', 'rubyists', { :page => 1, :per_page => 1 })
96
+ tweets.size.should == 1
97
+ tweets.first.id.should == 5272535583
98
+ tweets.first.user.name.should == 'John Nunemaker'
99
+ tweets = Twitter.list_timeline('pengwynn', 'rubyists', { :page => 2, :per_page => 1 })
100
+ tweets.size.should == 1
101
+ tweets.first.id.should == 5264324712
102
+ tweets.first.user.name.should == 'John Nunemaker'
103
+ end
104
+
105
+ end
106
+ end
metadata ADDED
@@ -0,0 +1,329 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: twitter-multi
3
+ version: !ruby/object:Gem::Version
4
+ hash: 37
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 9
9
+ - 8
10
+ - 1
11
+ version: 0.9.8.1
12
+ platform: ruby
13
+ authors:
14
+ - John Nunemaker
15
+ - Wynn Netherland
16
+ - Michael Rykov
17
+ autorequire:
18
+ bindir: bin
19
+ cert_chain: []
20
+
21
+ date: 2010-07-26 00:00:00 -07:00
22
+ default_executable:
23
+ dependencies:
24
+ - !ruby/object:Gem::Dependency
25
+ name: oauth
26
+ prerelease: false
27
+ requirement: &id001 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ hash: 13
33
+ segments:
34
+ - 0
35
+ - 4
36
+ - 1
37
+ version: 0.4.1
38
+ type: :runtime
39
+ version_requirements: *id001
40
+ - !ruby/object:Gem::Dependency
41
+ name: hashie
42
+ prerelease: false
43
+ requirement: &id002 !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ hash: 23
49
+ segments:
50
+ - 0
51
+ - 2
52
+ - 0
53
+ version: 0.2.0
54
+ type: :runtime
55
+ version_requirements: *id002
56
+ - !ruby/object:Gem::Dependency
57
+ name: httparty
58
+ prerelease: false
59
+ requirement: &id003 !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ~>
63
+ - !ruby/object:Gem::Version
64
+ hash: 11
65
+ segments:
66
+ - 0
67
+ - 5
68
+ - 0
69
+ version: 0.5.0
70
+ type: :runtime
71
+ version_requirements: *id003
72
+ - !ruby/object:Gem::Dependency
73
+ name: multi_json
74
+ prerelease: false
75
+ requirement: &id004 !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ hash: 23
81
+ segments:
82
+ - 0
83
+ - 0
84
+ - 4
85
+ version: 0.0.4
86
+ type: :runtime
87
+ version_requirements: *id004
88
+ - !ruby/object:Gem::Dependency
89
+ name: shoulda
90
+ prerelease: false
91
+ requirement: &id005 !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ hash: 39
97
+ segments:
98
+ - 2
99
+ - 10
100
+ - 0
101
+ version: 2.10.0
102
+ type: :development
103
+ version_requirements: *id005
104
+ - !ruby/object:Gem::Dependency
105
+ name: jnunemaker-matchy
106
+ prerelease: false
107
+ requirement: &id006 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ~>
111
+ - !ruby/object:Gem::Version
112
+ hash: 15
113
+ segments:
114
+ - 0
115
+ - 4
116
+ - 0
117
+ version: 0.4.0
118
+ type: :development
119
+ version_requirements: *id006
120
+ - !ruby/object:Gem::Dependency
121
+ name: mocha
122
+ prerelease: false
123
+ requirement: &id007 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ~>
127
+ - !ruby/object:Gem::Version
128
+ hash: 59
129
+ segments:
130
+ - 0
131
+ - 9
132
+ - 0
133
+ version: 0.9.0
134
+ type: :development
135
+ version_requirements: *id007
136
+ - !ruby/object:Gem::Dependency
137
+ name: fakeweb
138
+ prerelease: false
139
+ requirement: &id008 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ~>
143
+ - !ruby/object:Gem::Version
144
+ hash: 31
145
+ segments:
146
+ - 1
147
+ - 2
148
+ - 0
149
+ version: 1.2.0
150
+ type: :development
151
+ version_requirements: *id008
152
+ - !ruby/object:Gem::Dependency
153
+ name: redgreen
154
+ prerelease: false
155
+ requirement: &id009 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ~>
159
+ - !ruby/object:Gem::Version
160
+ hash: 27
161
+ segments:
162
+ - 1
163
+ - 2
164
+ - 2
165
+ version: 1.2.2
166
+ type: :development
167
+ version_requirements: *id009
168
+ description:
169
+ email: nunemaker@gmail.com
170
+ executables: []
171
+
172
+ extensions: []
173
+
174
+ extra_rdoc_files:
175
+ - README.rdoc
176
+ files:
177
+ - History
178
+ - License
179
+ - Notes
180
+ - README.rdoc
181
+ - Rakefile
182
+ - VERSION.yml
183
+ - examples/connect.rb
184
+ - examples/friendship_existence.rb
185
+ - examples/helpers/config_store.rb
186
+ - examples/httpauth.rb
187
+ - examples/ids.rb
188
+ - examples/lists.rb
189
+ - examples/oauth.rb
190
+ - examples/search.rb
191
+ - examples/timeline.rb
192
+ - examples/tumblr.rb
193
+ - examples/unauthorized.rb
194
+ - examples/update.rb
195
+ - examples/user.rb
196
+ - lib/twitter.rb
197
+ - lib/twitter/base.rb
198
+ - lib/twitter/geo.rb
199
+ - lib/twitter/httpauth.rb
200
+ - lib/twitter/local_trends.rb
201
+ - lib/twitter/oauth.rb
202
+ - lib/twitter/request.rb
203
+ - lib/twitter/search.rb
204
+ - lib/twitter/trends.rb
205
+ - test/fixtures/blocking.json
206
+ - test/fixtures/firehose.json
207
+ - test/fixtures/follower_ids.json
208
+ - test/fixtures/followers.json
209
+ - test/fixtures/friend_ids.json
210
+ - test/fixtures/friends_timeline.json
211
+ - test/fixtures/friendship.json
212
+ - test/fixtures/friendship_exists.json
213
+ - test/fixtures/geo_place.json
214
+ - test/fixtures/geo_reverse_geocode.json
215
+ - test/fixtures/geo_reverse_geocode_granularity.json
216
+ - test/fixtures/geo_reverse_geocode_limit.json
217
+ - test/fixtures/geo_search.json
218
+ - test/fixtures/geo_search_ip_address.json
219
+ - test/fixtures/geo_search_query.json
220
+ - test/fixtures/home_timeline.json
221
+ - test/fixtures/ids.json
222
+ - test/fixtures/list.json
223
+ - test/fixtures/list_statuses.json
224
+ - test/fixtures/list_statuses_1_1.json
225
+ - test/fixtures/list_statuses_2_1.json
226
+ - test/fixtures/list_subscriptions.json
227
+ - test/fixtures/list_users.json
228
+ - test/fixtures/lists.json
229
+ - test/fixtures/memberships.json
230
+ - test/fixtures/mentions.json
231
+ - test/fixtures/not_found.json
232
+ - test/fixtures/people_search.json
233
+ - test/fixtures/rate_limit_exceeded.json
234
+ - test/fixtures/report_spam.json
235
+ - test/fixtures/retweet.json
236
+ - test/fixtures/retweeted_by_me.json
237
+ - test/fixtures/retweeted_to_me.json
238
+ - test/fixtures/retweeters_of_tweet.json
239
+ - test/fixtures/retweets.json
240
+ - test/fixtures/retweets_of_me.json
241
+ - test/fixtures/sample-image.png
242
+ - test/fixtures/saved_search.json
243
+ - test/fixtures/saved_searches.json
244
+ - test/fixtures/search.json
245
+ - test/fixtures/search_from_jnunemaker.json
246
+ - test/fixtures/status.json
247
+ - test/fixtures/status_show.json
248
+ - test/fixtures/trends_available.json
249
+ - test/fixtures/trends_current.json
250
+ - test/fixtures/trends_current_exclude.json
251
+ - test/fixtures/trends_daily.json
252
+ - test/fixtures/trends_daily_date.json
253
+ - test/fixtures/trends_daily_exclude.json
254
+ - test/fixtures/trends_location.json
255
+ - test/fixtures/trends_weekly.json
256
+ - test/fixtures/trends_weekly_date.json
257
+ - test/fixtures/trends_weekly_exclude.json
258
+ - test/fixtures/unauthorized.json
259
+ - test/fixtures/update_profile_background_image.json
260
+ - test/fixtures/update_profile_image.json
261
+ - test/fixtures/user.json
262
+ - test/fixtures/user_timeline.json
263
+ - test/fixtures/users.json
264
+ - test/test_helper.rb
265
+ - test/twitter/base_test.rb
266
+ - test/twitter/geo_test.rb
267
+ - test/twitter/httpauth_test.rb
268
+ - test/twitter/oauth_test.rb
269
+ - test/twitter/request_test.rb
270
+ - test/twitter/search_test.rb
271
+ - test/twitter/trends_test.rb
272
+ - test/twitter_test.rb
273
+ has_rdoc: true
274
+ homepage: http://github.com/jnunemaker/twitter
275
+ licenses: []
276
+
277
+ post_install_message:
278
+ rdoc_options:
279
+ - --charset=UTF-8
280
+ require_paths:
281
+ - lib
282
+ required_ruby_version: !ruby/object:Gem::Requirement
283
+ none: false
284
+ requirements:
285
+ - - ">="
286
+ - !ruby/object:Gem::Version
287
+ hash: 3
288
+ segments:
289
+ - 0
290
+ version: "0"
291
+ required_rubygems_version: !ruby/object:Gem::Requirement
292
+ none: false
293
+ requirements:
294
+ - - ">="
295
+ - !ruby/object:Gem::Version
296
+ hash: 3
297
+ segments:
298
+ - 0
299
+ version: "0"
300
+ requirements: []
301
+
302
+ rubyforge_project:
303
+ rubygems_version: 1.3.7
304
+ signing_key:
305
+ specification_version: 3
306
+ summary: wrapper for the twitter api using multi_json
307
+ test_files:
308
+ - test/test_helper.rb
309
+ - test/twitter/base_test.rb
310
+ - test/twitter/geo_test.rb
311
+ - test/twitter/httpauth_test.rb
312
+ - test/twitter/oauth_test.rb
313
+ - test/twitter/request_test.rb
314
+ - test/twitter/search_test.rb
315
+ - test/twitter/trends_test.rb
316
+ - test/twitter_test.rb
317
+ - examples/connect.rb
318
+ - examples/friendship_existence.rb
319
+ - examples/helpers/config_store.rb
320
+ - examples/httpauth.rb
321
+ - examples/ids.rb
322
+ - examples/lists.rb
323
+ - examples/oauth.rb
324
+ - examples/search.rb
325
+ - examples/timeline.rb
326
+ - examples/tumblr.rb
327
+ - examples/unauthorized.rb
328
+ - examples/update.rb
329
+ - examples/user.rb