t 0.9.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,98 +1,128 @@
1
1
  {
2
2
  "users": [
3
3
  {
4
- "geo_enabled": true,
5
- "time_zone": "Pacific Time (US & Canada)",
6
- "description": "Adventures in hunger and foolishness.",
7
- "profile_sidebar_fill_color": "DDEEF6",
8
- "followers_count": 898,
9
- "verified": false,
10
- "notifications": false,
11
- "follow_request_sent": false,
4
+ "id": 7505382,
5
+ "profile_background_image_url": "http://a0.twimg.com/profile_background_images/162641967/we_concept_bg2.png",
6
+ "profile_link_color": "0084B4",
7
+ "following": false,
8
+ "default_profile": false,
9
+ "utc_offset": -28800,
12
10
  "profile_use_background_image": true,
13
- "profile_sidebar_border_color": "C0DEED",
14
- "url": null,
15
- "profile_background_image_url": "http://a3.twimg.com/profile_background_images/162641967/we_concept_bg2.png",
16
- "lang": "en",
17
- "created_at": "Mon Jul 16 12:59:01 +0000 2007",
18
- "profile_background_color": "000000",
19
- "location": "San Francisco",
20
- "listed_count": 29,
21
- "profile_background_tile": false,
22
- "friends_count": 88,
23
- "protected": false,
24
- "profile_image_url": "http://a0.twimg.com/profile_images/323331048/me_normal.jpg",
25
- "statuses_count": 2962,
26
- "profile_text_color": "333333",
27
11
  "name": "Erik Michaels-Ober",
12
+ "notifications": false,
13
+ "contributors_enabled": false,
14
+ "profile_text_color": "333333",
15
+ "geo_enabled": true,
16
+ "id_str": "7505382",
17
+ "protected": false,
18
+ "listed_count": 118,
28
19
  "show_all_inline_media": true,
29
- "following": true,
30
- "favourites_count": 727,
20
+ "friends_count": 212,
21
+ "profile_image_url": "http://a0.twimg.com/profile_images/1759857427/image1326743606_normal.png",
22
+ "profile_sidebar_border_color": "C0DEED",
23
+ "followers_count": 2262,
24
+ "description": "Vagabond.",
25
+ "is_translator": false,
26
+ "url": "https://github.com/sferik",
31
27
  "screen_name": "sferik",
32
- "id": 7505382,
33
- "id_str": "7505382",
34
- "contributors_enabled": false,
35
- "utc_offset": -28800,
36
- "profile_link_color": "0084B4"
28
+ "profile_background_tile": false,
29
+ "profile_image_url_https": "https://si0.twimg.com/profile_images/1759857427/image1326743606_normal.png",
30
+ "profile_sidebar_fill_color": "DDEEF6",
31
+ "created_at": "Mon Jul 16 12:59:01 +0000 2007",
32
+ "statuses_count": 7890,
33
+ "lang": "en",
34
+ "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/162641967/we_concept_bg2.png",
35
+ "verified": false,
36
+ "time_zone": "Pacific Time (US & Canada)",
37
+ "default_profile_image": false,
38
+ "favourites_count": 3755,
39
+ "status": {
40
+ "in_reply_to_user_id_str": "291",
41
+ "retweet_count": 0,
42
+ "in_reply_to_user_id": 291,
43
+ "in_reply_to_status_id": 222012135281143809,
44
+ "retweeted": false,
45
+ "truncated": false,
46
+ "created_at": "Sun Jul 08 18:29:20 +0000 2012",
47
+ "coordinates": null,
48
+ "geo": null,
49
+ "contributors": null,
50
+ "place": null,
51
+ "favorited": false,
52
+ "source": "<a href=\"http://itunes.apple.com/us/app/twitter/id409789998?mt=12\" rel=\"nofollow\">Twitter for Mac</a>",
53
+ "id": 222034648631484416,
54
+ "in_reply_to_status_id_str": "222012135281143809",
55
+ "id_str": "222034648631484416",
56
+ "in_reply_to_screen_name": "goldman",
57
+ "text": "@goldman You're near my home town! Say hi to Woodstock for me."
58
+ },
59
+ "profile_background_color": "000000",
60
+ "follow_request_sent": false,
61
+ "location": "San Francisco"
37
62
  },
38
63
  {
64
+ "id": 14100886,
65
+ "profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png",
66
+ "profile_link_color": "0084B4",
67
+ "following": true,
68
+ "default_profile": true,
69
+ "utc_offset": -21600,
70
+ "profile_use_background_image": true,
71
+ "name": "Wynn Netherland ⚡",
72
+ "notifications": false,
73
+ "contributors_enabled": false,
74
+ "profile_text_color": "333333",
39
75
  "geo_enabled": true,
76
+ "id_str": "14100886",
77
+ "protected": false,
78
+ "listed_count": 358,
79
+ "show_all_inline_media": true,
80
+ "friends_count": 3427,
81
+ "profile_image_url": "http://a0.twimg.com/profile_images/2221455972/wynn-mic-bw_normal.jpg",
82
+ "profile_sidebar_border_color": "C0DEED",
83
+ "followers_count": 5457,
84
+ "description": "Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",
85
+ "is_translator": false,
86
+ "url": "http://wynnnetherland.com",
87
+ "screen_name": "pengwynn",
88
+ "profile_background_tile": false,
89
+ "profile_image_url_https": "https://si0.twimg.com/profile_images/2221455972/wynn-mic-bw_normal.jpg",
90
+ "profile_sidebar_fill_color": "DDEEF6",
91
+ "created_at": "Sat Mar 08 16:34:22 +0000 2008",
92
+ "statuses_count": 6940,
93
+ "lang": "en",
94
+ "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png",
95
+ "verified": false,
40
96
  "time_zone": "Central Time (US & Canada)",
41
- "description": "Christian husband and father. Dev Experience @ HP Cloud Services. Co-host of the @changelogshow. Mashup of design & development.",
42
- "profile_sidebar_fill_color": "dddddd",
43
- "followers_count": 2767,
97
+ "default_profile_image": false,
98
+ "favourites_count": 192,
44
99
  "status": {
45
- "place": null,
46
- "retweet_count": null,
47
- "geo": null,
100
+ "in_reply_to_user_id_str": "321401349",
101
+ "retweet_count": 0,
102
+ "in_reply_to_user_id": 321401349,
103
+ "in_reply_to_status_id": 221694109407121409,
48
104
  "retweeted": false,
49
- "in_reply_to_status_id": 28008649044,
50
- "source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Tweetie for Mac</a>",
51
105
  "truncated": false,
52
- "in_reply_to_status_id_str": "28008649044",
53
- "created_at": "Thu Oct 21 10:33:15 +0000 2010",
54
- "in_reply_to_user_id": 11502142,
55
- "favorited": false,
56
- "in_reply_to_user_id_str": "11502142",
57
- "contributors": null,
106
+ "created_at": "Sat Jul 07 20:33:19 +0000 2012",
58
107
  "coordinates": null,
59
- "in_reply_to_screen_name": "benfawkes",
60
- "id": 28014236998,
61
- "id_str": "28014236998",
62
- "text": "@benfawkes Surely. Just email wynn at the changelog dot com."
108
+ "geo": null,
109
+ "contributors": null,
110
+ "place": null,
111
+ "favorited": false,
112
+ "source": "<a href=\"http://itunes.apple.com/us/app/twitter/id409789998?mt=12\" rel=\"nofollow\">Twitter for Mac</a>",
113
+ "id": 221703464277917696,
114
+ "in_reply_to_status_id_str": "221694109407121409",
115
+ "id_str": "221703464277917696",
116
+ "in_reply_to_screen_name": "akosmasoftware",
117
+ "text": "@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-)"
63
118
  },
64
- "verified": false,
65
- "notifications": false,
119
+ "profile_background_color": "C0DEED",
66
120
  "follow_request_sent": false,
67
- "profile_use_background_image": true,
68
- "profile_sidebar_border_color": "cccccc",
69
- "url": "http://wynnnetherland.com",
70
- "profile_background_image_url": "http://a1.twimg.com/profile_background_images/61741268/twitter-small.png",
71
- "lang": "en",
72
- "created_at": "Sat Mar 08 16:34:22 +0000 2008",
73
- "profile_background_color": "efefef",
74
- "location": "Dallas, TX",
75
- "listed_count": 185,
76
- "profile_background_tile": false,
77
- "friends_count": 1871,
78
- "protected": false,
79
- "profile_image_url": "http://a2.twimg.com/profile_images/485575482/komikazee_normal.png",
80
- "statuses_count": 3913,
81
- "profile_text_color": "666666",
82
- "name": "Wynn Netherland",
83
- "show_all_inline_media": false,
84
- "following": true,
85
- "favourites_count": 32,
86
- "screen_name": "pengwynn",
87
- "id": 14100886,
88
- "id_str": "14100886",
89
- "contributors_enabled": false,
90
- "utc_offset": -21600,
91
- "profile_link_color": "35abe9"
121
+ "location": "Denton, TX"
92
122
  }
93
123
  ],
94
124
  "next_cursor": 0,
95
125
  "previous_cursor": 0,
96
126
  "next_cursor_str": "0",
97
127
  "previous_cursor_str": "0"
98
- }
128
+ }
data/spec/helper.rb CHANGED
@@ -11,7 +11,6 @@ require 't'
11
11
  require 'rspec'
12
12
  require 'timecop'
13
13
  require 'webmock/rspec'
14
- T.env = 'test'
15
14
 
16
15
  def a_delete(path, endpoint=Twitter.endpoint)
17
16
  a_request(:delete, endpoint + path)
data/spec/list_spec.rb CHANGED
@@ -13,9 +13,8 @@ describe T::List do
13
13
  Timecop.return
14
14
  end
15
15
 
16
- before do
17
- rcfile = RCFile.instance
18
- rcfile.path = fixture_path + "/.trc"
16
+ before :each do
17
+ T::RCFile.instance.path = fixture_path + "/.trc"
19
18
  @list = T::List.new
20
19
  @old_stderr = $stderr
21
20
  $stderr = StringIO.new
@@ -23,7 +22,8 @@ describe T::List do
23
22
  $stdout = StringIO.new
24
23
  end
25
24
 
26
- after do
25
+ after :each do
26
+ T::RCFile.instance.reset
27
27
  $stderr = @old_stderr
28
28
  $stdout = @old_stdout
29
29
  end
@@ -47,7 +47,7 @@ describe T::List do
47
47
  end
48
48
  it "should have the correct output" do
49
49
  @list.add("presidents", "BarackObama")
50
- $stdout.string.should =~ /@testcli added 1 member to the list "presidents"\./
50
+ $stdout.string.split("\n").first.should == "@testcli added 1 member to the list \"presidents\"."
51
51
  end
52
52
  context "--id" do
53
53
  before do
@@ -177,7 +177,7 @@ ID,Description,Slug,Screen name,Created at,Members,Subscribers,Following,Mode,UR
177
177
  end
178
178
  it "should have the correct output" do
179
179
  @list.members("presidents")
180
- $stdout.string.rstrip.should == "pengwynn sferik"
180
+ $stdout.string.chomp.should == "pengwynn sferik"
181
181
  end
182
182
  context "--csv" do
183
183
  before do
@@ -186,86 +186,95 @@ ID,Description,Slug,Screen name,Created at,Members,Subscribers,Following,Mode,UR
186
186
  it "should output in CSV format" do
187
187
  @list.members("presidents")
188
188
  $stdout.string.should == <<-eos
189
- ID,Since,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
190
- 14100886,2008-03-08 16:34:22 +0000,3913,32,185,1871,2767,pengwynn,Wynn Netherland
191
- 7505382,2007-07-16 12:59:01 +0000,2962,727,29,88,898,sferik,Erik Michaels-Ober
189
+ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name
190
+ 14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland
191
+ 7505382,2007-07-16 12:59:01 +0000,2012-07-08 18:29:20 +0000,7890,3755,118,212,2262,sferik,Erik Michaels-Ober
192
192
  eos
193
193
  end
194
194
  end
195
- context "--favorites" do
195
+ context "--long" do
196
196
  before do
197
- @list.options = @list.options.merge("favorites" => true)
197
+ @list.options = @list.options.merge("long" => true)
198
198
  end
199
- it "should sort by number of favorites" do
199
+ it "should output in long format" do
200
200
  @list.members("presidents")
201
- $stdout.string.rstrip.should == "pengwynn sferik"
201
+ $stdout.string.should == <<-eos
202
+ ID Since Last tweeted at Tweets Favorites Listed Following...
203
+ 14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
204
+ 7505382 Jul 16 2007 Jul 8 10:29 7890 3755 118 212...
205
+ eos
202
206
  end
203
207
  end
204
- context "--followers" do
208
+ context "--reverse" do
205
209
  before do
206
- @list.options = @list.options.merge("followers" => true)
210
+ @list.options = @list.options.merge("reverse" => true)
207
211
  end
208
- it "should sort by number of followers" do
212
+ it "should reverse the order of the sort" do
209
213
  @list.members("presidents")
210
- $stdout.string.rstrip.should == "sferik pengwynn"
214
+ $stdout.string.chomp.should == "sferik pengwynn"
211
215
  end
212
216
  end
213
- context "--friends" do
217
+ context "--sort=favorites" do
214
218
  before do
215
- @list.options = @list.options.merge("friends" => true)
219
+ @list.options = @list.options.merge("sort" => "favorites")
216
220
  end
217
- it "should sort by number of friends" do
221
+ it "should sort by number of favorites" do
218
222
  @list.members("presidents")
219
- $stdout.string.rstrip.should == "sferik pengwynn"
223
+ $stdout.string.chomp.should == "pengwynn sferik"
220
224
  end
221
225
  end
222
- context "--listed" do
226
+ context "--sort=followers" do
223
227
  before do
224
- @list.options = @list.options.merge("listed" => true)
228
+ @list.options = @list.options.merge("sort" => "followers")
225
229
  end
226
- it "should sort by number of list memberships" do
230
+ it "should sort by number of followers" do
227
231
  @list.members("presidents")
228
- $stdout.string.rstrip.should == "sferik pengwynn"
232
+ $stdout.string.chomp.should == "sferik pengwynn"
229
233
  end
230
234
  end
231
- context "--long" do
235
+ context "--sort=friends" do
232
236
  before do
233
- @list.options = @list.options.merge("long" => true)
237
+ @list.options = @list.options.merge("sort" => "friends")
234
238
  end
235
- it "should output in long format" do
239
+ it "should sort by number of friends" do
236
240
  @list.members("presidents")
237
- $stdout.string.should == <<-eos
238
- ID Since Tweets Favorites Listed Following Followers Scre...
239
- 14100886 Mar 8 2008 3913 32 185 1871 2767 @pen...
240
- 7505382 Jul 16 2007 2962 727 29 88 898 @sfe...
241
- eos
241
+ $stdout.string.chomp.should == "sferik pengwynn"
242
242
  end
243
243
  end
244
- context "--posted" do
244
+ context "--sort=listed" do
245
245
  before do
246
- @list.options = @list.options.merge("posted" => true)
246
+ @list.options = @list.options.merge("sort" => "listed")
247
247
  end
248
- it "should sort by the time wshen Twitter account was created" do
248
+ it "should sort by number of list memberships" do
249
249
  @list.members("presidents")
250
- $stdout.string.rstrip.should == "sferik pengwynn"
250
+ $stdout.string.chomp.should == "sferik pengwynn"
251
251
  end
252
252
  end
253
- context "--reverse" do
253
+ context "--sort=since" do
254
254
  before do
255
- @list.options = @list.options.merge("reverse" => true)
255
+ @list.options = @list.options.merge("sort" => "since")
256
256
  end
257
- it "should reverse the order of the sort" do
257
+ it "should sort by the time wshen Twitter account was created" do
258
258
  @list.members("presidents")
259
- $stdout.string.rstrip.should == "sferik pengwynn"
259
+ $stdout.string.chomp.should == "sferik pengwynn"
260
260
  end
261
261
  end
262
- context "--tweets" do
262
+ context "--sort=tweets" do
263
263
  before do
264
- @list.options = @list.options.merge("tweets" => true)
264
+ @list.options = @list.options.merge("sort" => "tweets")
265
265
  end
266
266
  it "should sort by number of Tweets" do
267
267
  @list.members("presidents")
268
- $stdout.string.rstrip.should == "sferik pengwynn"
268
+ $stdout.string.chomp.should == "pengwynn sferik"
269
+ end
270
+ end
271
+ context "--sort=tweeted" do
272
+ before do
273
+ @list.options = @list.options.merge("sort" => "tweeted")
274
+ end
275
+ it "should sort by the time of the last Tweet" do
276
+ @list.members("presidents")
277
+ $stdout.string.chomp.should == "pengwynn sferik"
269
278
  end
270
279
  end
271
280
  context "--unsorted" do
@@ -274,7 +283,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
274
283
  end
275
284
  it "should not be sorted" do
276
285
  @list.members("presidents")
277
- $stdout.string.rstrip.should == "sferik pengwynn"
286
+ $stdout.string.chomp.should == "sferik pengwynn"
278
287
  end
279
288
  end
280
289
  context "with a user passed" do
@@ -323,7 +332,7 @@ ID Since Tweets Favorites Listed Following Followers Scre...
323
332
  with(:body => {:screen_name => "BarackObama", :slug => "presidents", :owner_screen_name => "sferik"}).
324
333
  to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
325
334
  @list.remove("presidents", "BarackObama")
326
- $stdout.string.should =~ /@testcli removed 1 member from the list "presidents"\./
335
+ $stdout.string.split("\n").first.should == "@testcli removed 1 member from the list \"presidents\"."
327
336
  end
328
337
  context "--id" do
329
338
  before do
@@ -370,9 +379,76 @@ ID Since Tweets Favorites Listed Following Followers Scre...
370
379
  end
371
380
  it "should have the correct output" do
372
381
  @list.timeline("presidents")
373
- $stdout.string.should =~ /@natevillegas/
374
- $stdout.string.should =~ /RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history\. Tomorrow is a /
375
- $stdout.string.should =~ /mystery\. Today is a gift\. That's why it's called the present\./
382
+ $stdout.string.should == <<-eos
383
+ \e[1m\e[33m @ryanbigg\e[0m
384
+ Things that have made my life better, in order of greatness: GitHub, Travis
385
+ CI, the element Oxygen.
386
+
387
+ \e[1m\e[33m @sfbike\e[0m
388
+ Bike to Work Counts in: 73% of morning Market traffic was bikes! 1,031 bikers
389
+ counted in 1 hour--that's 17 per minute. Way to roll, SF!
390
+
391
+ \e[1m\e[33m @levie\e[0m
392
+ I know you're as rare as leprechauns, but if you're an amazing designer then
393
+ Box wants to hire you. Email recruiting@box.com
394
+
395
+ \e[1m\e[33m @natevillegas\e[0m
396
+ RT @gelobautista #riordan RT @WilI_Smith: Yesterday is history. Tomorrow is a
397
+ mystery. Today is a gift. That's why it's called the present.
398
+
399
+ \e[1m\e[33m @TD\e[0m
400
+ @kelseysilver how long will you be in town?
401
+
402
+ \e[1m\e[33m @rusashka\e[0m
403
+ @maciej hahaha :) @gpena together we're going to cover all core 28 languages!
404
+
405
+ \e[1m\e[33m @fat\e[0m
406
+ @stevej @xc i'm going to picket when i get back.
407
+
408
+ \e[1m\e[33m @wil\e[0m
409
+ @0x9900 @paulnivin http://t.co/bwVdtAPe
410
+
411
+ \e[1m\e[33m @wangtian\e[0m
412
+ @tianhonghe @xiangxin72 oh, you can even order specific items?
413
+
414
+ \e[1m\e[33m @shinypb\e[0m
415
+ @kpk Pfft, I think you're forgetting mechanical television, which depended on
416
+ a clever German. http://t.co/JvLNQCDm @skilldrick @hoverbird
417
+
418
+ \e[1m\e[33m @0x9900\e[0m
419
+ @wil @paulnivin if you want to take you seriously don't say daemontools!
420
+
421
+ \e[1m\e[33m @kpk\e[0m
422
+ @shinypb @skilldrick @hoverbird invented it
423
+
424
+ \e[1m\e[33m @skilldrick\e[0m
425
+ @shinypb Well played :) @hoverbird
426
+
427
+ \e[1m\e[33m @sam\e[0m
428
+ Can someone project the date that I'll get a 27\" retina display?
429
+
430
+ \e[1m\e[33m @shinypb\e[0m
431
+ @skilldrick @hoverbird Wow, I didn't even know they *had* TV in Britain.
432
+
433
+ \e[1m\e[33m @bartt\e[0m
434
+ @noahlt @gaarf Yup, now owning @twitter -> FB from FE to daemons. Lot’s of
435
+ fun. Expect improvements in the weeks to come.
436
+
437
+ \e[1m\e[33m @skilldrick\e[0m
438
+ @hoverbird @shinypb You guys must be soooo old, I don't remember the words to
439
+ the duck tales intro at all.
440
+
441
+ \e[1m\e[33m @sean\e[0m
442
+ @mep Thanks for coming by. Was great to have you.
443
+
444
+ \e[1m\e[33m @hoverbird\e[0m
445
+ @shinypb @trammell it's all suck a \"duck blur\" sometimes.
446
+
447
+ \e[1m\e[33m @kelseysilver\e[0m
448
+ San Francisco here I come! (@ Newark Liberty International Airport (EWR) w/
449
+ 92 others) http://t.co/eoLANJZw
450
+
451
+ eos
376
452
  end
377
453
  context "--csv" do
378
454
  before do