t 0.9.4 → 0.9.5
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/lib/t/authorizable.rb +2 -0
- data/lib/t/cli.rb +75 -44
- data/lib/t/collectable.rb +30 -0
- data/lib/t/delete.rb +7 -7
- data/lib/t/list.rb +4 -2
- data/lib/t/printable.rb +2 -3
- data/lib/t/search.rb +5 -4
- data/lib/t/set.rb +4 -4
- data/lib/t/stream.rb +1 -2
- data/lib/t/version.rb +1 -1
- data/spec/cli_spec.rb +260 -134
- data/spec/delete_spec.rb +11 -19
- data/spec/list_spec.rb +30 -14
- data/spec/search_spec.rb +22 -6
- data/spec/set_spec.rb +8 -8
- metadata +2 -2
data/spec/delete_spec.rb
CHANGED
@@ -22,13 +22,13 @@ describe T::Delete do
|
|
22
22
|
before do
|
23
23
|
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
24
24
|
stub_delete("/1/blocks/destroy.json").
|
25
|
-
with(:query => {:screen_name => "sferik"
|
25
|
+
with(:query => {:screen_name => "sferik"}).
|
26
26
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
27
27
|
end
|
28
28
|
it "should request the correct resource" do
|
29
29
|
@delete.block("sferik")
|
30
30
|
a_delete("/1/blocks/destroy.json").
|
31
|
-
with(:query => {:screen_name => "sferik"
|
31
|
+
with(:query => {:screen_name => "sferik"}).
|
32
32
|
should have_been_made
|
33
33
|
end
|
34
34
|
it "should have the correct output" do
|
@@ -39,13 +39,13 @@ describe T::Delete do
|
|
39
39
|
before do
|
40
40
|
@delete.options = @delete.options.merge("id" => true)
|
41
41
|
stub_delete("/1/blocks/destroy.json").
|
42
|
-
with(:query => {:user_id => "7505382"
|
42
|
+
with(:query => {:user_id => "7505382"}).
|
43
43
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
44
44
|
end
|
45
45
|
it "should request the correct resource" do
|
46
46
|
@delete.block("7505382")
|
47
47
|
a_delete("/1/blocks/destroy.json").
|
48
|
-
with(:query => {:user_id => "7505382"
|
48
|
+
with(:query => {:user_id => "7505382"}).
|
49
49
|
should have_been_made
|
50
50
|
end
|
51
51
|
end
|
@@ -55,10 +55,8 @@ describe T::Delete do
|
|
55
55
|
before do
|
56
56
|
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
57
57
|
stub_get("/1/direct_messages/show/1773478249.json").
|
58
|
-
with(:query => {:include_entities => "false"}).
|
59
58
|
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
60
59
|
stub_delete("/1/direct_messages/destroy/1773478249.json").
|
61
|
-
with(:query => {:include_entities => "false"}).
|
62
60
|
to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
63
61
|
end
|
64
62
|
it "should request the correct resource" do
|
@@ -66,10 +64,8 @@ describe T::Delete do
|
|
66
64
|
$stdin.should_receive(:gets).and_return("yes")
|
67
65
|
@delete.dm("1773478249")
|
68
66
|
a_get("/1/direct_messages/show/1773478249.json").
|
69
|
-
with(:query => {:include_entities => "false"}).
|
70
67
|
should have_been_made
|
71
68
|
a_delete("/1/direct_messages/destroy/1773478249.json").
|
72
|
-
with(:query => {:include_entities => "false"}).
|
73
69
|
should have_been_made
|
74
70
|
end
|
75
71
|
context "yes" do
|
@@ -95,7 +91,6 @@ describe T::Delete do
|
|
95
91
|
it "should request the correct resource" do
|
96
92
|
@delete.dm("1773478249")
|
97
93
|
a_delete("/1/direct_messages/destroy/1773478249.json").
|
98
|
-
with(:query => {:include_entities => "false"}).
|
99
94
|
should have_been_made
|
100
95
|
end
|
101
96
|
it "should have the correct output" do
|
@@ -109,10 +104,9 @@ describe T::Delete do
|
|
109
104
|
before do
|
110
105
|
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
111
106
|
stub_get("/1/statuses/show/28439861609.json").
|
112
|
-
with(:query => {:
|
107
|
+
with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
|
113
108
|
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
114
109
|
stub_delete("/1/favorites/destroy/28439861609.json").
|
115
|
-
with(:query => {:include_entities => "false"}).
|
116
110
|
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
117
111
|
end
|
118
112
|
it "should request the correct resource" do
|
@@ -120,10 +114,9 @@ describe T::Delete do
|
|
120
114
|
$stdin.should_receive(:gets).and_return("yes")
|
121
115
|
@delete.favorite("28439861609")
|
122
116
|
a_get("/1/statuses/show/28439861609.json").
|
123
|
-
with(:query => {:
|
117
|
+
with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
|
124
118
|
should have_been_made
|
125
119
|
a_delete("/1/favorites/destroy/28439861609.json").
|
126
|
-
with(:query => {:include_entities => "false"}).
|
127
120
|
should have_been_made
|
128
121
|
end
|
129
122
|
context "yes" do
|
@@ -149,7 +142,6 @@ describe T::Delete do
|
|
149
142
|
it "should request the correct resource" do
|
150
143
|
@delete.favorite("28439861609")
|
151
144
|
a_delete("/1/favorites/destroy/28439861609.json").
|
152
|
-
with(:query => {:include_entities => "false"}).
|
153
145
|
should have_been_made
|
154
146
|
end
|
155
147
|
it "should have the correct output" do
|
@@ -241,10 +233,10 @@ describe T::Delete do
|
|
241
233
|
before do
|
242
234
|
@delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
|
243
235
|
stub_get("/1/statuses/show/26755176471724032.json").
|
244
|
-
with(:query => {:
|
236
|
+
with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
|
245
237
|
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
246
238
|
stub_delete("/1/statuses/destroy/26755176471724032.json").
|
247
|
-
with(:query => {:
|
239
|
+
with(:query => {:trim_user => "true"}).
|
248
240
|
to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
249
241
|
end
|
250
242
|
it "should request the correct resource" do
|
@@ -252,10 +244,10 @@ describe T::Delete do
|
|
252
244
|
$stdin.should_receive(:gets).and_return("yes")
|
253
245
|
@delete.status("26755176471724032")
|
254
246
|
a_get("/1/statuses/show/26755176471724032.json").
|
255
|
-
with(:query => {:
|
247
|
+
with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
|
256
248
|
should have_been_made
|
257
249
|
a_delete("/1/statuses/destroy/26755176471724032.json").
|
258
|
-
with(:query => {:
|
250
|
+
with(:query => {:trim_user => "true"}).
|
259
251
|
should have_been_made
|
260
252
|
end
|
261
253
|
context "yes" do
|
@@ -281,7 +273,7 @@ describe T::Delete do
|
|
281
273
|
it "should request the correct resource" do
|
282
274
|
@delete.status("26755176471724032")
|
283
275
|
a_delete("/1/statuses/destroy/26755176471724032.json").
|
284
|
-
with(:query => {:
|
276
|
+
with(:query => {:trim_user => "true"}).
|
285
277
|
should have_been_made
|
286
278
|
end
|
287
279
|
it "should have the correct output" do
|
data/spec/list_spec.rb
CHANGED
@@ -158,13 +158,13 @@ ID,Description,Slug,Screen name,Created at,Members,Subscribers,Following,Mode,UR
|
|
158
158
|
describe "#members" do
|
159
159
|
before do
|
160
160
|
stub_get("/1/lists/members.json").
|
161
|
-
with(:query => {:cursor => "-1", :
|
161
|
+
with(:query => {:cursor => "-1", :owner_screen_name => "testcli", :skip_status => "true", :slug => "presidents"}).
|
162
162
|
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
163
163
|
end
|
164
164
|
it "should request the correct resource" do
|
165
165
|
@list.members("presidents")
|
166
166
|
a_get("/1/lists/members.json").
|
167
|
-
with(:query => {:cursor => "-1", :
|
167
|
+
with(:query => {:cursor => "-1", :owner_screen_name => "testcli", :skip_status => "true", :slug => "presidents"}).
|
168
168
|
should have_been_made
|
169
169
|
end
|
170
170
|
it "should have the correct output" do
|
@@ -273,20 +273,20 @@ ID Since Tweets Favorites Listed Following Followers Scre...
|
|
273
273
|
it "should request the correct resource" do
|
274
274
|
@list.members("testcli/presidents")
|
275
275
|
a_get("/1/lists/members.json").
|
276
|
-
with(:query => {:cursor => "-1", :
|
276
|
+
with(:query => {:cursor => "-1", :owner_screen_name => "testcli", :skip_status => "true", :slug => "presidents"}).
|
277
277
|
should have_been_made
|
278
278
|
end
|
279
279
|
context "--id" do
|
280
280
|
before do
|
281
281
|
@list.options = @list.options.merge("id" => true)
|
282
282
|
stub_get("/1/lists/members.json").
|
283
|
-
with(:query => {:cursor => "-1", :
|
283
|
+
with(:query => {:cursor => "-1", :owner_id => "7505382", :skip_status => "true", :slug => "presidents"}).
|
284
284
|
to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
285
285
|
end
|
286
286
|
it "should request the correct resource" do
|
287
287
|
@list.members("7505382/presidents")
|
288
288
|
a_get("/1/lists/members.json").
|
289
|
-
with(:query => {:cursor => "-1", :
|
289
|
+
with(:query => {:cursor => "-1", :owner_id => "7505382", :skip_status => "true", :slug => "presidents"}).
|
290
290
|
should have_been_made
|
291
291
|
end
|
292
292
|
end
|
@@ -351,13 +351,13 @@ ID Since Tweets Favorites Listed Following Followers Scre...
|
|
351
351
|
describe "#timeline" do
|
352
352
|
before do
|
353
353
|
stub_get("/1/lists/statuses.json").
|
354
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents"
|
354
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents"}).
|
355
355
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
356
356
|
end
|
357
357
|
it "should request the correct resource" do
|
358
358
|
@list.timeline("presidents")
|
359
359
|
a_get("/1/lists/statuses.json").
|
360
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents"
|
360
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents"}).
|
361
361
|
should have_been_made
|
362
362
|
end
|
363
363
|
it "should have the correct output" do
|
@@ -452,15 +452,31 @@ ID Posted at Screen name Text
|
|
452
452
|
end
|
453
453
|
context "--number" do
|
454
454
|
before do
|
455
|
-
@list.options = @list.options.merge("number" => 1)
|
456
455
|
stub_get("/1/lists/statuses.json").
|
457
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "1", :slug => "presidents"
|
456
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "1", :slug => "presidents"}).
|
457
|
+
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
458
|
+
stub_get("/1/lists/statuses.json").
|
459
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "200", :slug => "presidents"}).
|
458
460
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
461
|
+
stub_get("/1/lists/statuses.json").
|
462
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "145", :max_id => "194546264212385792", :slug => "presidents"}).
|
463
|
+
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
459
464
|
end
|
460
|
-
it "should limit the number of results" do
|
465
|
+
it "should limit the number of results to 1" do
|
466
|
+
@list.options = @list.options.merge("number" => 1)
|
461
467
|
@list.timeline("presidents")
|
462
468
|
a_get("/1/lists/statuses.json").
|
463
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "1", :slug => "presidents"
|
469
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "1", :slug => "presidents"}).
|
470
|
+
should have_been_made
|
471
|
+
end
|
472
|
+
it "should limit the number of results to 345" do
|
473
|
+
@list.options = @list.options.merge("number" => 345)
|
474
|
+
@list.timeline("presidents")
|
475
|
+
a_get("/1/lists/statuses.json").
|
476
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "200", :slug => "presidents"}).
|
477
|
+
should have_been_made
|
478
|
+
a_get("/1/lists/statuses.json").
|
479
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "145", :max_id => "194546264212385792", :slug => "presidents"}).
|
464
480
|
should have_been_made
|
465
481
|
end
|
466
482
|
end
|
@@ -468,20 +484,20 @@ ID Posted at Screen name Text
|
|
468
484
|
it "should request the correct resource" do
|
469
485
|
@list.timeline("testcli/presidents")
|
470
486
|
a_get("/1/lists/statuses.json").
|
471
|
-
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents"
|
487
|
+
with(:query => {:owner_screen_name => "testcli", :per_page => "20", :slug => "presidents"}).
|
472
488
|
should have_been_made
|
473
489
|
end
|
474
490
|
context "--id" do
|
475
491
|
before do
|
476
492
|
@list.options = @list.options.merge("id" => true)
|
477
493
|
stub_get("/1/lists/statuses.json").
|
478
|
-
with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents"
|
494
|
+
with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents"}).
|
479
495
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
480
496
|
end
|
481
497
|
it "should request the correct resource" do
|
482
498
|
@list.timeline("7505382/presidents")
|
483
499
|
a_get("/1/lists/statuses.json").
|
484
|
-
with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents"
|
500
|
+
with(:query => {:owner_id => "7505382", :per_page => "20", :slug => "presidents"}).
|
485
501
|
should have_been_made
|
486
502
|
end
|
487
503
|
end
|
data/spec/search_spec.rb
CHANGED
@@ -23,13 +23,13 @@ describe T::Search do
|
|
23
23
|
describe "#all" do
|
24
24
|
before do
|
25
25
|
stub_request(:get, "https://search.twitter.com/search.json").
|
26
|
-
with(:query => {:q => "twitter", :
|
26
|
+
with(:query => {:q => "twitter", :rpp => "20"}).
|
27
27
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
28
28
|
end
|
29
29
|
it "should request the correct resource" do
|
30
30
|
@search.all("twitter")
|
31
31
|
a_request(:get, "https://search.twitter.com/search.json").
|
32
|
-
with(:query => {:q => "twitter", :
|
32
|
+
with(:query => {:q => "twitter", :rpp => "20"}).
|
33
33
|
should have_been_made
|
34
34
|
end
|
35
35
|
it "should have the correct output" do
|
@@ -95,15 +95,31 @@ ID Posted at Screen name Text
|
|
95
95
|
end
|
96
96
|
context "--number" do
|
97
97
|
before do
|
98
|
-
@search.options = @search.options.merge("number" => 1)
|
99
98
|
stub_request(:get, "https://search.twitter.com/search.json").
|
100
|
-
with(:query => {:q => "twitter", :
|
99
|
+
with(:query => {:q => "twitter", :rpp => "1"}).
|
100
|
+
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
101
|
+
stub_request(:get, "https://search.twitter.com/search.json").
|
102
|
+
with(:query => {:q => "twitter", :rpp => "200"}).
|
101
103
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
104
|
+
stub_request(:get, "https://search.twitter.com/search.json").
|
105
|
+
with(:query => {:q => "twitter", :rpp => "145", :max_id => "194521261307727871"}).
|
106
|
+
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
107
|
+
end
|
108
|
+
it "should limit the number of results to 1" do
|
109
|
+
@search.options = @search.options.merge("number" => 1)
|
110
|
+
@search.all("twitter")
|
111
|
+
a_request(:get, "https://search.twitter.com/search.json").
|
112
|
+
with(:query => {:q => "twitter", :rpp => "1"}).
|
113
|
+
should have_been_made
|
102
114
|
end
|
103
|
-
it "should limit the number of results" do
|
115
|
+
it "should limit the number of results to 345" do
|
116
|
+
@search.options = @search.options.merge("number" => 345)
|
104
117
|
@search.all("twitter")
|
105
118
|
a_request(:get, "https://search.twitter.com/search.json").
|
106
|
-
with(:query => {:q => "twitter", :
|
119
|
+
with(:query => {:q => "twitter", :rpp => "200"}).
|
120
|
+
should have_been_made
|
121
|
+
a_request(:get, "https://search.twitter.com/search.json").
|
122
|
+
with(:query => {:q => "twitter", :rpp => "145", :max_id => "194521261307727871"}).
|
107
123
|
should have_been_made
|
108
124
|
end
|
109
125
|
end
|
data/spec/set_spec.rb
CHANGED
@@ -32,13 +32,13 @@ describe T::Set do
|
|
32
32
|
before do
|
33
33
|
@t.options = @t.options.merge("profile" => fixture_path + "/.trc")
|
34
34
|
stub_post("/1/account/update_profile.json").
|
35
|
-
with(:body => {:description => "A mind forever voyaging through strange seas of thought, alone."
|
35
|
+
with(:body => {:description => "A mind forever voyaging through strange seas of thought, alone."}).
|
36
36
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
37
37
|
end
|
38
38
|
it "should request the correct resource" do
|
39
39
|
@t.set("bio", "A mind forever voyaging through strange seas of thought, alone.")
|
40
40
|
a_post("/1/account/update_profile.json").
|
41
|
-
with(:body => {:description => "A mind forever voyaging through strange seas of thought, alone."
|
41
|
+
with(:body => {:description => "A mind forever voyaging through strange seas of thought, alone."}).
|
42
42
|
should have_been_made
|
43
43
|
end
|
44
44
|
it "should have the correct output" do
|
@@ -70,13 +70,13 @@ describe T::Set do
|
|
70
70
|
before do
|
71
71
|
@t.options = @t.options.merge("profile" => fixture_path + "/.trc")
|
72
72
|
stub_post("/1/account/update_profile.json").
|
73
|
-
with(:body => {:location => "San Francisco"
|
73
|
+
with(:body => {:location => "San Francisco"}).
|
74
74
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
75
75
|
end
|
76
76
|
it "should request the correct resource" do
|
77
77
|
@t.set("location", "San Francisco")
|
78
78
|
a_post("/1/account/update_profile.json").
|
79
|
-
with(:body => {:location => "San Francisco"
|
79
|
+
with(:body => {:location => "San Francisco"}).
|
80
80
|
should have_been_made
|
81
81
|
end
|
82
82
|
it "should have the correct output" do
|
@@ -89,13 +89,13 @@ describe T::Set do
|
|
89
89
|
before do
|
90
90
|
@t.options = @t.options.merge("profile" => fixture_path + "/.trc")
|
91
91
|
stub_post("/1/account/update_profile.json").
|
92
|
-
with(:body => {:name => "Erik Michaels-Ober"
|
92
|
+
with(:body => {:name => "Erik Michaels-Ober"}).
|
93
93
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
94
94
|
end
|
95
95
|
it "should request the correct resource" do
|
96
96
|
@t.set("name", "Erik Michaels-Ober")
|
97
97
|
a_post("/1/account/update_profile.json").
|
98
|
-
with(:body => {:name => "Erik Michaels-Ober"
|
98
|
+
with(:body => {:name => "Erik Michaels-Ober"}).
|
99
99
|
should have_been_made
|
100
100
|
end
|
101
101
|
it "should have the correct output" do
|
@@ -108,13 +108,13 @@ describe T::Set do
|
|
108
108
|
before do
|
109
109
|
@t.options = @t.options.merge("profile" => fixture_path + "/.trc")
|
110
110
|
stub_post("/1/account/update_profile.json").
|
111
|
-
with(:body => {:url => "https://github.com/sferik"
|
111
|
+
with(:body => {:url => "https://github.com/sferik"}).
|
112
112
|
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
113
113
|
end
|
114
114
|
it "should request the correct resource" do
|
115
115
|
@t.set("url", "https://github.com/sferik")
|
116
116
|
a_post("/1/account/update_profile.json").
|
117
|
-
with(:body => {:url => "https://github.com/sferik"
|
117
|
+
with(:body => {:url => "https://github.com/sferik"}).
|
118
118
|
should have_been_made
|
119
119
|
end
|
120
120
|
it "should have the correct output" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|