t 1.1.1 → 1.2.0
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/README.md +1 -1
- data/lib/t/cli.rb +22 -51
- data/lib/t/collectable.rb +13 -13
- data/lib/t/delete.rb +6 -6
- data/lib/t/list.rb +2 -2
- data/lib/t/printable.rb +18 -18
- data/lib/t/search.rb +33 -33
- data/lib/t/stream.rb +18 -18
- data/lib/t/version.rb +2 -2
- data/spec/cli_spec.rb +883 -1004
- data/spec/delete_spec.rb +51 -43
- data/spec/fixtures/following.json +1 -0
- data/spec/fixtures/not_following.json +1 -0
- data/spec/fixtures/search.json +1 -456
- data/spec/fixtures/statuses.json +1 -1285
- data/spec/helper.rb +5 -0
- data/spec/list_spec.rb +165 -158
- data/spec/search_spec.rb +318 -245
- data/spec/set_spec.rb +14 -14
- data/spec/stream_spec.rb +307 -0
- data/t.gemspec +2 -2
- metadata +12 -6
data/spec/search_spec.rb
CHANGED
@@ -30,92 +30,123 @@ describe T::Search do
|
|
30
30
|
|
31
31
|
describe "#all" do
|
32
32
|
before do
|
33
|
-
|
33
|
+
stub_get("/1.1/search/tweets.json").
|
34
34
|
with(:query => {:q => "twitter", :rpp => "20"}).
|
35
35
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
36
|
+
stub_get("/1.1/search/tweets.json").
|
37
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "16"}).
|
38
|
+
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
39
|
+
stub_get("/1.1/search/tweets.json").
|
40
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "12"}).
|
41
|
+
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
42
|
+
stub_get("/1.1/search/tweets.json").
|
43
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "8"}).
|
44
|
+
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
45
|
+
stub_get("/1.1/search/tweets.json").
|
46
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "4"}).
|
47
|
+
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
36
48
|
end
|
37
49
|
it "should request the correct resource" do
|
38
50
|
@search.all("twitter")
|
39
|
-
|
51
|
+
a_get("/1.1/search/tweets.json").
|
40
52
|
with(:query => {:q => "twitter", :rpp => "20"}).
|
41
53
|
should have_been_made
|
54
|
+
a_get("/1.1/search/tweets.json").
|
55
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "16"}).
|
56
|
+
should have_been_made
|
57
|
+
a_get("/1.1/search/tweets.json").
|
58
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "12"}).
|
59
|
+
should have_been_made
|
60
|
+
a_get("/1.1/search/tweets.json").
|
61
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "8"}).
|
62
|
+
should have_been_made
|
63
|
+
a_get("/1.1/search/tweets.json").
|
64
|
+
with(:query => {:q => "twitter", :max_id => "246666260270702591", :rpp => "4"}).
|
65
|
+
should have_been_made
|
42
66
|
end
|
43
67
|
it "should have the correct output" do
|
44
68
|
@search.all("twitter")
|
45
69
|
$stdout.string.should == <<-eos
|
46
70
|
|
47
|
-
\e[1m\e[33m @
|
48
|
-
|
71
|
+
\e[1m\e[33m @richrad\e[0m
|
72
|
+
Bubble Mailer #freebandnames
|
73
|
+
|
74
|
+
\e[1m\e[33m @dswordsNshields\e[0m
|
75
|
+
Hair of the Frog
|
76
|
+
|
77
|
+
(seriously, think about it)
|
78
|
+
|
79
|
+
#freebandnames
|
80
|
+
|
81
|
+
\e[1m\e[33m @thedunniebobos\e[0m
|
82
|
+
Wussies and pussies #goddylan #freebandnames
|
49
83
|
|
50
|
-
\e[1m\e[33m @
|
51
|
-
|
84
|
+
\e[1m\e[33m @StrongPROGress\e[0m
|
85
|
+
#FreeBandNames Asterisks and Thunderstorms
|
52
86
|
|
53
|
-
\e[1m\e[33m @
|
54
|
-
|
87
|
+
\e[1m\e[33m @richrad\e[0m
|
88
|
+
Bubble Mailer #freebandnames
|
55
89
|
|
56
|
-
\e[1m\e[33m @
|
57
|
-
|
58
|
-
people are so dumb... better
|
90
|
+
\e[1m\e[33m @dswordsNshields\e[0m
|
91
|
+
Hair of the Frog
|
59
92
|
|
60
|
-
|
61
|
-
Twitter is kinda fun... Kinda!
|
93
|
+
(seriously, think about it)
|
62
94
|
|
63
|
-
|
64
|
-
Pondre lo mas importante de Hamlet en Twitter para recordarlo mejor :D
|
95
|
+
#freebandnames
|
65
96
|
|
66
|
-
\e[1m\e[33m @
|
67
|
-
|
97
|
+
\e[1m\e[33m @thedunniebobos\e[0m
|
98
|
+
Wussies and pussies #goddylan #freebandnames
|
68
99
|
|
69
|
-
\e[1m\e[33m @
|
70
|
-
|
71
|
-
pics I like... #NotWorking
|
100
|
+
\e[1m\e[33m @StrongPROGress\e[0m
|
101
|
+
#FreeBandNames Asterisks and Thunderstorms
|
72
102
|
|
73
|
-
\e[1m\e[33m @
|
74
|
-
|
103
|
+
\e[1m\e[33m @richrad\e[0m
|
104
|
+
Bubble Mailer #freebandnames
|
75
105
|
|
76
|
-
\e[1m\e[33m @
|
77
|
-
|
78
|
-
doesn't have a twitter so please disregard any tweets from that user
|
106
|
+
\e[1m\e[33m @dswordsNshields\e[0m
|
107
|
+
Hair of the Frog
|
79
108
|
|
80
|
-
|
81
|
-
Ik refresh twitter op me telefoon terwijl ik tweetdeck voor me open heb staan
|
109
|
+
(seriously, think about it)
|
82
110
|
|
83
|
-
|
84
|
-
@mikeyway and you too RT @NimcyGD: @gerardway Get your ass back to twitter,
|
85
|
-
okay? :3
|
111
|
+
#freebandnames
|
86
112
|
|
87
|
-
\e[1m\e[33m @
|
88
|
-
|
89
|
-
@Ckwarburton @samwarburton_ @chrishaime @rowloboy
|
113
|
+
\e[1m\e[33m @thedunniebobos\e[0m
|
114
|
+
Wussies and pussies #goddylan #freebandnames
|
90
115
|
|
91
|
-
\e[1m\e[33m @
|
92
|
-
|
93
|
-
http://t.co/YAk8OXp7 http://t.co/fmmrVrbG
|
116
|
+
\e[1m\e[33m @StrongPROGress\e[0m
|
117
|
+
#FreeBandNames Asterisks and Thunderstorms
|
94
118
|
|
95
|
-
\e[1m\e[33m @
|
96
|
-
|
119
|
+
\e[1m\e[33m @richrad\e[0m
|
120
|
+
Bubble Mailer #freebandnames
|
97
121
|
|
98
|
-
\e[1m\e[33m @
|
99
|
-
|
100
|
-
http://t.co/k00TnRyR
|
122
|
+
\e[1m\e[33m @dswordsNshields\e[0m
|
123
|
+
Hair of the Frog
|
101
124
|
|
102
|
-
|
103
|
-
smh, @IndianaHustle done turned into a twitter addict..fuck goin on lol ?
|
125
|
+
(seriously, think about it)
|
104
126
|
|
105
|
-
|
106
|
-
RT @Mark_Ingram28: To all Bama fans and followers, please unfollow and pay no
|
107
|
-
attention to any user posing to be Mark Barron. My bro doesn't have a
|
108
|
-
twitter!
|
127
|
+
#freebandnames
|
109
128
|
|
110
|
-
\e[1m\e[33m @
|
111
|
-
|
112
|
-
http://t.co/gQEkQw5G
|
129
|
+
\e[1m\e[33m @thedunniebobos\e[0m
|
130
|
+
Wussies and pussies #goddylan #freebandnames
|
113
131
|
|
114
|
-
\e[1m\e[33m @
|
115
|
-
|
132
|
+
\e[1m\e[33m @StrongPROGress\e[0m
|
133
|
+
#FreeBandNames Asterisks and Thunderstorms
|
116
134
|
|
135
|
+
\e[1m\e[33m @richrad\e[0m
|
136
|
+
Bubble Mailer #freebandnames
|
117
137
|
|
118
|
-
|
138
|
+
\e[1m\e[33m @dswordsNshields\e[0m
|
139
|
+
Hair of the Frog
|
140
|
+
|
141
|
+
(seriously, think about it)
|
142
|
+
|
143
|
+
#freebandnames
|
144
|
+
|
145
|
+
\e[1m\e[33m @thedunniebobos\e[0m
|
146
|
+
Wussies and pussies #goddylan #freebandnames
|
147
|
+
|
148
|
+
\e[1m\e[33m @StrongPROGress\e[0m
|
149
|
+
#FreeBandNames Asterisks and Thunderstorms
|
119
150
|
|
120
151
|
eos
|
121
152
|
end
|
@@ -127,30 +158,46 @@ describe T::Search do
|
|
127
158
|
@search.all("twitter")
|
128
159
|
$stdout.string.should == <<-eos
|
129
160
|
ID,Posted at,Screen name,Text
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
161
|
+
247827742178021376,2012-09-17 22:41:52 +0000,richrad,Bubble Mailer #freebandnames
|
162
|
+
247811706061979648,2012-09-17 21:38:09 +0000,dswordsNshields,"Hair of the Frog
|
163
|
+
|
164
|
+
(seriously, think about it)
|
165
|
+
|
166
|
+
#freebandnames"
|
167
|
+
246825473785606145,2012-09-15 04:19:13 +0000,thedunniebobos,Wussies and pussies #goddylan #freebandnames
|
168
|
+
246666260270702592,2012-09-14 17:46:33 +0000,StrongPROGress,#FreeBandNames Asterisks and Thunderstorms
|
169
|
+
247827742178021376,2012-09-17 22:41:52 +0000,richrad,Bubble Mailer #freebandnames
|
170
|
+
247811706061979648,2012-09-17 21:38:09 +0000,dswordsNshields,"Hair of the Frog
|
171
|
+
|
172
|
+
(seriously, think about it)
|
173
|
+
|
174
|
+
#freebandnames"
|
175
|
+
246825473785606145,2012-09-15 04:19:13 +0000,thedunniebobos,Wussies and pussies #goddylan #freebandnames
|
176
|
+
246666260270702592,2012-09-14 17:46:33 +0000,StrongPROGress,#FreeBandNames Asterisks and Thunderstorms
|
177
|
+
247827742178021376,2012-09-17 22:41:52 +0000,richrad,Bubble Mailer #freebandnames
|
178
|
+
247811706061979648,2012-09-17 21:38:09 +0000,dswordsNshields,"Hair of the Frog
|
179
|
+
|
180
|
+
(seriously, think about it)
|
181
|
+
|
182
|
+
#freebandnames"
|
183
|
+
246825473785606145,2012-09-15 04:19:13 +0000,thedunniebobos,Wussies and pussies #goddylan #freebandnames
|
184
|
+
246666260270702592,2012-09-14 17:46:33 +0000,StrongPROGress,#FreeBandNames Asterisks and Thunderstorms
|
185
|
+
247827742178021376,2012-09-17 22:41:52 +0000,richrad,Bubble Mailer #freebandnames
|
186
|
+
247811706061979648,2012-09-17 21:38:09 +0000,dswordsNshields,"Hair of the Frog
|
187
|
+
|
188
|
+
(seriously, think about it)
|
189
|
+
|
190
|
+
#freebandnames"
|
191
|
+
246825473785606145,2012-09-15 04:19:13 +0000,thedunniebobos,Wussies and pussies #goddylan #freebandnames
|
192
|
+
246666260270702592,2012-09-14 17:46:33 +0000,StrongPROGress,#FreeBandNames Asterisks and Thunderstorms
|
193
|
+
247827742178021376,2012-09-17 22:41:52 +0000,richrad,Bubble Mailer #freebandnames
|
194
|
+
247811706061979648,2012-09-17 21:38:09 +0000,dswordsNshields,"Hair of the Frog
|
195
|
+
|
196
|
+
(seriously, think about it)
|
197
|
+
|
198
|
+
#freebandnames"
|
199
|
+
246825473785606145,2012-09-15 04:19:13 +0000,thedunniebobos,Wussies and pussies #goddylan #freebandnames
|
200
|
+
246666260270702592,2012-09-14 17:46:33 +0000,StrongPROGress,#FreeBandNames Asterisks and Thunderstorms
|
154
201
|
eos
|
155
202
|
end
|
156
203
|
end
|
@@ -162,65 +209,65 @@ ID,Posted at,Screen name,Text
|
|
162
209
|
@search.all("twitter")
|
163
210
|
$stdout.string.should == <<-eos
|
164
211
|
ID Posted at Screen name Text
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
212
|
+
247827742178021376 Sep 17 14:41 @richrad Bubble Mailer #freebandnames
|
213
|
+
247811706061979648 Sep 17 13:38 @dswordsNshields Hair of the Frog (seriou...
|
214
|
+
246825473785606145 Sep 14 20:19 @thedunniebobos Wussies and pussies #godd...
|
215
|
+
246666260270702592 Sep 14 09:46 @StrongPROGress #FreeBandNames Asterisks ...
|
216
|
+
247827742178021376 Sep 17 14:41 @richrad Bubble Mailer #freebandnames
|
217
|
+
247811706061979648 Sep 17 13:38 @dswordsNshields Hair of the Frog (seriou...
|
218
|
+
246825473785606145 Sep 14 20:19 @thedunniebobos Wussies and pussies #godd...
|
219
|
+
246666260270702592 Sep 14 09:46 @StrongPROGress #FreeBandNames Asterisks ...
|
220
|
+
247827742178021376 Sep 17 14:41 @richrad Bubble Mailer #freebandnames
|
221
|
+
247811706061979648 Sep 17 13:38 @dswordsNshields Hair of the Frog (seriou...
|
222
|
+
246825473785606145 Sep 14 20:19 @thedunniebobos Wussies and pussies #godd...
|
223
|
+
246666260270702592 Sep 14 09:46 @StrongPROGress #FreeBandNames Asterisks ...
|
224
|
+
247827742178021376 Sep 17 14:41 @richrad Bubble Mailer #freebandnames
|
225
|
+
247811706061979648 Sep 17 13:38 @dswordsNshields Hair of the Frog (seriou...
|
226
|
+
246825473785606145 Sep 14 20:19 @thedunniebobos Wussies and pussies #godd...
|
227
|
+
246666260270702592 Sep 14 09:46 @StrongPROGress #FreeBandNames Asterisks ...
|
228
|
+
247827742178021376 Sep 17 14:41 @richrad Bubble Mailer #freebandnames
|
229
|
+
247811706061979648 Sep 17 13:38 @dswordsNshields Hair of the Frog (seriou...
|
230
|
+
246825473785606145 Sep 14 20:19 @thedunniebobos Wussies and pussies #godd...
|
231
|
+
246666260270702592 Sep 14 09:46 @StrongPROGress #FreeBandNames Asterisks ...
|
185
232
|
eos
|
186
233
|
end
|
187
234
|
end
|
188
235
|
context "--number" do
|
189
236
|
before do
|
190
|
-
|
237
|
+
stub_get("/1.1/search/tweets.json").
|
191
238
|
with(:query => {:q => "twitter", :rpp => "1"}).
|
192
239
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
193
|
-
|
240
|
+
stub_get("/1.1/search/tweets.json").
|
194
241
|
with(:query => {:q => "twitter", :rpp => "200"}).
|
195
242
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
196
|
-
|
197
|
-
with(:query => {:q => "twitter", :rpp => "200", :max_id => "
|
243
|
+
stub_get("/1.1/search/tweets.json").
|
244
|
+
with(:query => {:q => "twitter", :rpp => "200", :max_id => "246666260270702591"}).
|
198
245
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
199
|
-
(
|
200
|
-
|
201
|
-
with(:query => {:q => "twitter", :rpp => count, :max_id => "
|
246
|
+
(1..197).step(4).to_a.each do |count|
|
247
|
+
stub_get("/1.1/search/tweets.json").
|
248
|
+
with(:query => {:q => "twitter", :rpp => count, :max_id => "246666260270702591"}).
|
202
249
|
to_return(:body => fixture("search.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
203
250
|
end
|
204
251
|
end
|
205
252
|
it "should limit the number of results to 1" do
|
206
253
|
@search.options = @search.options.merge("number" => 1)
|
207
254
|
@search.all("twitter")
|
208
|
-
|
255
|
+
a_get("/1.1/search/tweets.json").
|
209
256
|
with(:query => {:q => "twitter", :rpp => "1"}).
|
210
257
|
should have_been_made
|
211
258
|
end
|
212
259
|
it "should limit the number of results to 345" do
|
213
260
|
@search.options = @search.options.merge("number" => 345)
|
214
261
|
@search.all("twitter")
|
215
|
-
|
262
|
+
a_get("/1.1/search/tweets.json").
|
216
263
|
with(:query => {:q => "twitter", :rpp => "200"}).
|
217
264
|
should have_been_made
|
218
|
-
|
219
|
-
with(:query => {:q => "twitter", :rpp => "200", :max_id => "
|
220
|
-
should have_been_made.times(
|
221
|
-
(
|
222
|
-
|
223
|
-
with(:query => {:q => "twitter", :rpp => count, :max_id => "
|
265
|
+
a_get("/1.1/search/tweets.json").
|
266
|
+
with(:query => {:q => "twitter", :rpp => "200", :max_id => "246666260270702591"}).
|
267
|
+
should have_been_made.times(36)
|
268
|
+
(1..197).step(4).to_a.each do |count|
|
269
|
+
a_get("/1.1/search/tweets.json").
|
270
|
+
with(:query => {:q => "twitter", :rpp => count, :max_id => "246666260270702591"}).
|
224
271
|
should have_been_made
|
225
272
|
end
|
226
273
|
end
|
@@ -229,28 +276,31 @@ ID Posted at Screen name Text
|
|
229
276
|
|
230
277
|
describe "#favorites" do
|
231
278
|
before do
|
232
|
-
stub_get("/1/favorites.json").
|
279
|
+
stub_get("/1.1/favorites/list.json").
|
233
280
|
with(:query => {:count => "200"}).
|
234
281
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
235
|
-
stub_get("/1/favorites.json").
|
236
|
-
with(:query => {:count => "200", :max_id => "
|
282
|
+
stub_get("/1.1/favorites/list.json").
|
283
|
+
with(:query => {:count => "200", :max_id => "244099460672679937"}).
|
237
284
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
238
285
|
end
|
239
286
|
it "should request the correct resource" do
|
240
287
|
@search.favorites("twitter")
|
241
|
-
a_get("/1/favorites.json").
|
288
|
+
a_get("/1.1/favorites/list.json").
|
242
289
|
with(:query => {:count => "200"}).
|
243
290
|
should have_been_made
|
244
|
-
a_get("/1/favorites.json").
|
245
|
-
with(:query => {:count => "200", :max_id => "
|
291
|
+
a_get("/1.1/favorites/list.json").
|
292
|
+
with(:query => {:count => "200", :max_id => "244099460672679937"}).
|
246
293
|
should have_been_made
|
247
294
|
end
|
248
295
|
it "should have the correct output" do
|
249
296
|
@search.favorites("twitter")
|
250
297
|
$stdout.string.should == <<-eos
|
251
|
-
\e[1m\e[33m @
|
252
|
-
@
|
253
|
-
|
298
|
+
\e[1m\e[33m @sferik\e[0m
|
299
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
300
|
+
to be missing "1.1" from the URL.
|
301
|
+
|
302
|
+
\e[1m\e[33m @sferik\e[0m
|
303
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
254
304
|
|
255
305
|
eos
|
256
306
|
end
|
@@ -262,7 +312,8 @@ ID Posted at Screen name Text
|
|
262
312
|
@search.favorites("twitter")
|
263
313
|
$stdout.string.should == <<-eos
|
264
314
|
ID,Posted at,Screen name,Text
|
265
|
-
|
315
|
+
244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
|
316
|
+
244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
266
317
|
eos
|
267
318
|
end
|
268
319
|
end
|
@@ -274,47 +325,51 @@ ID,Posted at,Screen name,Text
|
|
274
325
|
@search.favorites("twitter")
|
275
326
|
$stdout.string.should == <<-eos
|
276
327
|
ID Posted at Screen name Text
|
277
|
-
|
328
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
|
329
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
|
278
330
|
eos
|
279
331
|
end
|
280
332
|
end
|
281
333
|
context "Twitter is down" do
|
282
334
|
it "should retry 3 times and then raise an error" do
|
283
|
-
stub_get("/1/favorites.json").
|
335
|
+
stub_get("/1.1/favorites/list.json").
|
284
336
|
with(:query => {:count => "200"}).
|
285
337
|
to_return(:status => 502)
|
286
338
|
lambda do
|
287
339
|
@search.favorites("twitter")
|
288
340
|
end.should raise_error("Twitter is down or being upgraded.")
|
289
|
-
a_get("/1/favorites.json").
|
341
|
+
a_get("/1.1/favorites/list.json").
|
290
342
|
with(:query => {:count => "200"}).
|
291
343
|
should have_been_made.times(3)
|
292
344
|
end
|
293
345
|
end
|
294
346
|
context "with a user passed" do
|
295
347
|
before do
|
296
|
-
stub_get("/1/favorites/
|
297
|
-
with(:query => {:count => "200"}).
|
348
|
+
stub_get("/1.1/favorites/list.json").
|
349
|
+
with(:query => {:count => "200", :screen_name => "sferik"}).
|
298
350
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
299
|
-
stub_get("/1/favorites/
|
300
|
-
with(:query => {:count => "200", :max_id => "
|
351
|
+
stub_get("/1.1/favorites/list.json").
|
352
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
|
301
353
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
302
354
|
end
|
303
355
|
it "should request the correct resource" do
|
304
356
|
@search.favorites("sferik", "twitter")
|
305
|
-
a_get("/1/favorites/
|
306
|
-
with(:query => {:count => "200"}).
|
357
|
+
a_get("/1.1/favorites/list.json").
|
358
|
+
with(:query => {:count => "200", :screen_name => "sferik"}).
|
307
359
|
should have_been_made
|
308
|
-
a_get("/1/favorites/
|
309
|
-
with(:query => {:count => "200", :max_id => "
|
360
|
+
a_get("/1.1/favorites/list.json").
|
361
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
|
310
362
|
should have_been_made
|
311
363
|
end
|
312
364
|
it "should have the correct output" do
|
313
365
|
@search.favorites("sferik", "twitter")
|
314
366
|
$stdout.string.should == <<-eos
|
315
|
-
\e[1m\e[33m @
|
316
|
-
@
|
317
|
-
|
367
|
+
\e[1m\e[33m @sferik\e[0m
|
368
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
369
|
+
to be missing "1.1" from the URL.
|
370
|
+
|
371
|
+
\e[1m\e[33m @sferik\e[0m
|
372
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
318
373
|
|
319
374
|
eos
|
320
375
|
end
|
@@ -323,28 +378,31 @@ ID Posted at Screen name Text
|
|
323
378
|
|
324
379
|
describe "#mentions" do
|
325
380
|
before do
|
326
|
-
stub_get("/1/statuses/
|
381
|
+
stub_get("/1.1/statuses/mentions_timeline.json").
|
327
382
|
with(:query => {:count => "200"}).
|
328
383
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
329
|
-
stub_get("/1/statuses/
|
330
|
-
with(:query => {:count => "200", :max_id => "
|
384
|
+
stub_get("/1.1/statuses/mentions_timeline.json").
|
385
|
+
with(:query => {:count => "200", :max_id => "244099460672679937"}).
|
331
386
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
332
387
|
end
|
333
388
|
it "should request the correct resource" do
|
334
389
|
@search.mentions("twitter")
|
335
|
-
a_get("/1/statuses/
|
390
|
+
a_get("/1.1/statuses/mentions_timeline.json").
|
336
391
|
with(:query => {:count => "200"}).
|
337
392
|
should have_been_made
|
338
|
-
a_get("/1/statuses/
|
339
|
-
with(:query => {:count => "200", :max_id => "
|
393
|
+
a_get("/1.1/statuses/mentions_timeline.json").
|
394
|
+
with(:query => {:count => "200", :max_id => "244099460672679937"}).
|
340
395
|
should have_been_made
|
341
396
|
end
|
342
397
|
it "should have the correct output" do
|
343
398
|
@search.mentions("twitter")
|
344
399
|
$stdout.string.should == <<-eos
|
345
|
-
\e[1m\e[33m @
|
346
|
-
@
|
347
|
-
|
400
|
+
\e[1m\e[33m @sferik\e[0m
|
401
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
402
|
+
to be missing "1.1" from the URL.
|
403
|
+
|
404
|
+
\e[1m\e[33m @sferik\e[0m
|
405
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
348
406
|
|
349
407
|
eos
|
350
408
|
end
|
@@ -356,7 +414,8 @@ ID Posted at Screen name Text
|
|
356
414
|
@search.mentions("twitter")
|
357
415
|
$stdout.string.should == <<-eos
|
358
416
|
ID,Posted at,Screen name,Text
|
359
|
-
|
417
|
+
244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
|
418
|
+
244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
360
419
|
eos
|
361
420
|
end
|
362
421
|
end
|
@@ -368,19 +427,20 @@ ID,Posted at,Screen name,Text
|
|
368
427
|
@search.mentions("twitter")
|
369
428
|
$stdout.string.should == <<-eos
|
370
429
|
ID Posted at Screen name Text
|
371
|
-
|
430
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
|
431
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
|
372
432
|
eos
|
373
433
|
end
|
374
434
|
end
|
375
435
|
context "Twitter is down" do
|
376
436
|
it "should retry 3 times and then raise an error" do
|
377
|
-
stub_get("/1/statuses/
|
437
|
+
stub_get("/1.1/statuses/mentions_timeline.json").
|
378
438
|
with(:query => {:count => "200"}).
|
379
439
|
to_return(:status => 502)
|
380
440
|
lambda do
|
381
441
|
@search.mentions("twitter")
|
382
442
|
end.should raise_error("Twitter is down or being upgraded.")
|
383
|
-
a_get("/1/statuses/
|
443
|
+
a_get("/1.1/statuses/mentions_timeline.json").
|
384
444
|
with(:query => {:count => "200"}).
|
385
445
|
should have_been_made.times(3)
|
386
446
|
end
|
@@ -389,28 +449,31 @@ ID Posted at Screen name Text
|
|
389
449
|
|
390
450
|
describe "#list" do
|
391
451
|
before do
|
392
|
-
stub_get("/1/lists/statuses.json").
|
452
|
+
stub_get("/1.1/lists/statuses.json").
|
393
453
|
with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
|
394
454
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
395
|
-
stub_get("/1/lists/statuses.json").
|
396
|
-
with(:query => {:count => "200", :max_id => "
|
455
|
+
stub_get("/1.1/lists/statuses.json").
|
456
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).
|
397
457
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
398
458
|
end
|
399
459
|
it "should request the correct resource" do
|
400
460
|
@search.list("presidents", "twitter")
|
401
|
-
a_get("/1/lists/statuses.json").
|
461
|
+
a_get("/1.1/lists/statuses.json").
|
402
462
|
with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
|
403
463
|
should have_been_made
|
404
|
-
a_get("/1/lists/statuses.json").
|
405
|
-
with(:query => {:count => "200", :max_id => "
|
464
|
+
a_get("/1.1/lists/statuses.json").
|
465
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).
|
406
466
|
should have_been_made
|
407
467
|
end
|
408
468
|
it "should have the correct output" do
|
409
469
|
@search.list("presidents", "twitter")
|
410
470
|
$stdout.string.should == <<-eos
|
411
|
-
\e[1m\e[33m @
|
412
|
-
@
|
413
|
-
|
471
|
+
\e[1m\e[33m @sferik\e[0m
|
472
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
473
|
+
to be missing "1.1" from the URL.
|
474
|
+
|
475
|
+
\e[1m\e[33m @sferik\e[0m
|
476
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
414
477
|
|
415
478
|
eos
|
416
479
|
end
|
@@ -422,7 +485,8 @@ ID Posted at Screen name Text
|
|
422
485
|
@search.list("presidents", "twitter")
|
423
486
|
$stdout.string.should == <<-eos
|
424
487
|
ID,Posted at,Screen name,Text
|
425
|
-
|
488
|
+
244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
|
489
|
+
244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
426
490
|
eos
|
427
491
|
end
|
428
492
|
end
|
@@ -434,47 +498,48 @@ ID,Posted at,Screen name,Text
|
|
434
498
|
@search.list("presidents", "twitter")
|
435
499
|
$stdout.string.should == <<-eos
|
436
500
|
ID Posted at Screen name Text
|
437
|
-
|
501
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
|
502
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
|
438
503
|
eos
|
439
504
|
end
|
440
505
|
end
|
441
506
|
context "with a user passed" do
|
442
507
|
it "should request the correct resource" do
|
443
508
|
@search.list("testcli/presidents", "twitter")
|
444
|
-
a_get("/1/lists/statuses.json").
|
509
|
+
a_get("/1.1/lists/statuses.json").
|
445
510
|
with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
|
446
511
|
should have_been_made
|
447
512
|
end
|
448
513
|
context "--id" do
|
449
514
|
before do
|
450
515
|
@search.options = @search.options.merge("id" => true)
|
451
|
-
stub_get("/1/lists/statuses.json").
|
516
|
+
stub_get("/1.1/lists/statuses.json").
|
452
517
|
with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"}).
|
453
518
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
454
|
-
stub_get("/1/lists/statuses.json").
|
455
|
-
with(:query => {:count => "200", :max_id => "
|
519
|
+
stub_get("/1.1/lists/statuses.json").
|
520
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"}).
|
456
521
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
457
522
|
end
|
458
523
|
it "should request the correct resource" do
|
459
524
|
@search.list("7505382/presidents", "twitter")
|
460
|
-
a_get("/1/lists/statuses.json").
|
525
|
+
a_get("/1.1/lists/statuses.json").
|
461
526
|
with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"}).
|
462
527
|
should have_been_made
|
463
|
-
a_get("/1/lists/statuses.json").
|
464
|
-
with(:query => {:count => "200", :max_id => "
|
528
|
+
a_get("/1.1/lists/statuses.json").
|
529
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"}).
|
465
530
|
should have_been_made
|
466
531
|
end
|
467
532
|
end
|
468
533
|
end
|
469
534
|
context "Twitter is down" do
|
470
535
|
it "should retry 3 times and then raise an error" do
|
471
|
-
stub_get("/1/lists/statuses.json").
|
536
|
+
stub_get("/1.1/lists/statuses.json").
|
472
537
|
with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
|
473
538
|
to_return(:status => 502)
|
474
539
|
lambda do
|
475
540
|
@search.list("presidents", "twitter")
|
476
541
|
end.should raise_error("Twitter is down or being upgraded.")
|
477
|
-
a_get("/1/lists/statuses.json").
|
542
|
+
a_get("/1.1/lists/statuses.json").
|
478
543
|
with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).
|
479
544
|
should have_been_made.times(3)
|
480
545
|
end
|
@@ -483,28 +548,27 @@ ID Posted at Screen name Text
|
|
483
548
|
|
484
549
|
describe "#retweets" do
|
485
550
|
before do
|
486
|
-
stub_get("/1/statuses/
|
487
|
-
with(:query => {:count => "200"}).
|
551
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
552
|
+
with(:query => {:count => "200", :include_rts => "true"}).
|
488
553
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
489
|
-
stub_get("/1/statuses/
|
490
|
-
with(:query => {:count => "200", :max_id => "
|
554
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
555
|
+
with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).
|
491
556
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
492
557
|
end
|
493
558
|
it "should request the correct resource" do
|
494
|
-
@search.retweets("
|
495
|
-
a_get("/1/statuses/
|
496
|
-
with(:query => {:count => "200"}).
|
497
|
-
should have_been_made
|
498
|
-
a_get("/1/statuses/retweeted_by_me.json").
|
499
|
-
with(:query => {:count => "200", :max_id => "194546264212385792"}).
|
559
|
+
@search.retweets("mosaic")
|
560
|
+
a_get("/1.1/statuses/user_timeline.json").
|
561
|
+
with(:query => {:count => "200", :include_rts => "true"}).
|
500
562
|
should have_been_made
|
563
|
+
a_get("/1.1/statuses/user_timeline.json").
|
564
|
+
with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).
|
565
|
+
should have_been_made.times(2)
|
501
566
|
end
|
502
567
|
it "should have the correct output" do
|
503
|
-
@search.retweets("
|
568
|
+
@search.retweets("mosaic")
|
504
569
|
$stdout.string.should == <<-eos
|
505
|
-
\e[1m\e[33m @
|
506
|
-
|
507
|
-
fun. Expect improvements in the weeks to come.
|
570
|
+
\e[1m\e[33m @calebelston\e[0m
|
571
|
+
RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
|
508
572
|
|
509
573
|
eos
|
510
574
|
end
|
@@ -513,10 +577,10 @@ ID Posted at Screen name Text
|
|
513
577
|
@search.options = @search.options.merge("csv" => true)
|
514
578
|
end
|
515
579
|
it "should output in CSV format" do
|
516
|
-
@search.retweets("
|
580
|
+
@search.retweets("mosaic")
|
517
581
|
$stdout.string.should == <<-eos
|
518
582
|
ID,Posted at,Screen name,Text
|
519
|
-
|
583
|
+
244108728834592770,2012-09-07 16:23:50 +0000,calebelston,RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
|
520
584
|
eos
|
521
585
|
end
|
522
586
|
end
|
@@ -525,50 +589,49 @@ ID,Posted at,Screen name,Text
|
|
525
589
|
@search.options = @search.options.merge("long" => true)
|
526
590
|
end
|
527
591
|
it "should output in long format" do
|
528
|
-
@search.retweets("
|
592
|
+
@search.retweets("mosaic")
|
529
593
|
$stdout.string.should == <<-eos
|
530
|
-
ID Posted at Screen name
|
531
|
-
|
594
|
+
ID Posted at Screen name Text
|
595
|
+
244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosaic loo...
|
532
596
|
eos
|
533
597
|
end
|
534
598
|
end
|
535
599
|
context "Twitter is down" do
|
536
600
|
it "should retry 3 times and then raise an error" do
|
537
|
-
stub_get("/1/statuses/
|
538
|
-
with(:query => {:count => "200"}).
|
601
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
602
|
+
with(:query => {:count => "200", :include_rts => "true"}).
|
539
603
|
to_return(:status => 502)
|
540
604
|
lambda do
|
541
|
-
@search.retweets("
|
605
|
+
@search.retweets("mosaic")
|
542
606
|
end.should raise_error("Twitter is down or being upgraded.")
|
543
|
-
a_get("/1/statuses/
|
544
|
-
with(:query => {:count => "200"}).
|
607
|
+
a_get("/1.1/statuses/user_timeline.json").
|
608
|
+
with(:query => {:count => "200", :include_rts => "true"}).
|
545
609
|
should have_been_made.times(3)
|
546
610
|
end
|
547
611
|
end
|
548
612
|
context "with a user passed" do
|
549
613
|
before do
|
550
|
-
stub_get("/1/statuses/
|
551
|
-
with(:query => {:count => "200", :screen_name => "sferik"}).
|
614
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
615
|
+
with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).
|
552
616
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
553
|
-
stub_get("/1/statuses/
|
554
|
-
with(:query => {:count => "200", :
|
617
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
618
|
+
with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).
|
555
619
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
556
620
|
end
|
557
621
|
it "should request the correct resource" do
|
558
|
-
@search.retweets("sferik", "
|
559
|
-
a_get("/1/statuses/
|
560
|
-
with(:query => {:count => "200", :screen_name => "sferik"}).
|
561
|
-
should have_been_made
|
562
|
-
a_get("/1/statuses/retweeted_by_user.json").
|
563
|
-
with(:query => {:count => "200", :max_id => "194546264212385792", :screen_name => "sferik"}).
|
622
|
+
@search.retweets("sferik", "mosaic")
|
623
|
+
a_get("/1.1/statuses/user_timeline.json").
|
624
|
+
with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).
|
564
625
|
should have_been_made
|
626
|
+
a_get("/1.1/statuses/user_timeline.json").
|
627
|
+
with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).
|
628
|
+
should have_been_made.times(2)
|
565
629
|
end
|
566
630
|
it "should have the correct output" do
|
567
|
-
@search.retweets("sferik", "
|
631
|
+
@search.retweets("sferik", "mosaic")
|
568
632
|
$stdout.string.should == <<-eos
|
569
|
-
\e[1m\e[33m @
|
570
|
-
|
571
|
-
fun. Expect improvements in the weeks to come.
|
633
|
+
\e[1m\e[33m @calebelston\e[0m
|
634
|
+
RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
|
572
635
|
|
573
636
|
eos
|
574
637
|
end
|
@@ -577,28 +640,31 @@ ID Posted at Screen name Text
|
|
577
640
|
|
578
641
|
describe "#timeline" do
|
579
642
|
before do
|
580
|
-
stub_get("/1/statuses/home_timeline.json").
|
643
|
+
stub_get("/1.1/statuses/home_timeline.json").
|
581
644
|
with(:query => {:count => "200"}).
|
582
645
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
583
|
-
stub_get("/1/statuses/home_timeline.json").
|
584
|
-
with(:query => {:count => "200", :max_id => "
|
646
|
+
stub_get("/1.1/statuses/home_timeline.json").
|
647
|
+
with(:query => {:count => "200", :max_id => "244099460672679937"}).
|
585
648
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
586
649
|
end
|
587
650
|
it "should request the correct resource" do
|
588
651
|
@search.timeline("twitter")
|
589
|
-
a_get("/1/statuses/home_timeline.json").
|
652
|
+
a_get("/1.1/statuses/home_timeline.json").
|
590
653
|
with(:query => {:count => "200"}).
|
591
654
|
should have_been_made
|
592
|
-
a_get("/1/statuses/home_timeline.json").
|
593
|
-
with(:query => {:count => "200", :max_id => "
|
655
|
+
a_get("/1.1/statuses/home_timeline.json").
|
656
|
+
with(:query => {:count => "200", :max_id => "244099460672679937"}).
|
594
657
|
should have_been_made
|
595
658
|
end
|
596
659
|
it "should have the correct output" do
|
597
660
|
@search.timeline("twitter")
|
598
661
|
$stdout.string.should == <<-eos
|
599
|
-
\e[1m\e[33m @
|
600
|
-
@
|
601
|
-
|
662
|
+
\e[1m\e[33m @sferik\e[0m
|
663
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
664
|
+
to be missing "1.1" from the URL.
|
665
|
+
|
666
|
+
\e[1m\e[33m @sferik\e[0m
|
667
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
602
668
|
|
603
669
|
eos
|
604
670
|
end
|
@@ -610,7 +676,8 @@ ID Posted at Screen name Text
|
|
610
676
|
@search.timeline("twitter")
|
611
677
|
$stdout.string.should == <<-eos
|
612
678
|
ID,Posted at,Screen name,Text
|
613
|
-
|
679
|
+
244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
|
680
|
+
244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
614
681
|
eos
|
615
682
|
end
|
616
683
|
end
|
@@ -622,47 +689,51 @@ ID,Posted at,Screen name,Text
|
|
622
689
|
@search.timeline("twitter")
|
623
690
|
$stdout.string.should == <<-eos
|
624
691
|
ID Posted at Screen name Text
|
625
|
-
|
692
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
|
693
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
|
626
694
|
eos
|
627
695
|
end
|
628
696
|
end
|
629
697
|
context "Twitter is down" do
|
630
698
|
it "should retry 3 times and then raise an error" do
|
631
|
-
stub_get("/1/statuses/home_timeline.json").
|
699
|
+
stub_get("/1.1/statuses/home_timeline.json").
|
632
700
|
with(:query => {:count => "200"}).
|
633
701
|
to_return(:status => 502)
|
634
702
|
lambda do
|
635
703
|
@search.timeline("twitter")
|
636
704
|
end.should raise_error("Twitter is down or being upgraded.")
|
637
|
-
a_get("/1/statuses/home_timeline.json").
|
705
|
+
a_get("/1.1/statuses/home_timeline.json").
|
638
706
|
with(:query => {:count => "200"}).
|
639
707
|
should have_been_made.times(3)
|
640
708
|
end
|
641
709
|
end
|
642
710
|
context "with a user passed" do
|
643
711
|
before do
|
644
|
-
stub_get("/1/statuses/user_timeline.json").
|
712
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
645
713
|
with(:query => {:count => "200", :screen_name => "sferik"}).
|
646
714
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
647
|
-
stub_get("/1/statuses/user_timeline.json").
|
648
|
-
with(:query => {:count => "200", :max_id => "
|
715
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
716
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
|
649
717
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
650
718
|
end
|
651
719
|
it "should request the correct resource" do
|
652
720
|
@search.timeline("sferik", "twitter")
|
653
|
-
a_get("/1/statuses/user_timeline.json").
|
721
|
+
a_get("/1.1/statuses/user_timeline.json").
|
654
722
|
with(:query => {:count => "200", :screen_name => "sferik"}).
|
655
723
|
should have_been_made
|
656
|
-
a_get("/1/statuses/user_timeline.json").
|
657
|
-
with(:query => {:count => "200", :max_id => "
|
724
|
+
a_get("/1.1/statuses/user_timeline.json").
|
725
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).
|
658
726
|
should have_been_made
|
659
727
|
end
|
660
728
|
it "should have the correct output" do
|
661
729
|
@search.timeline("sferik", "twitter")
|
662
730
|
$stdout.string.should == <<-eos
|
663
|
-
\e[1m\e[33m @
|
664
|
-
@
|
665
|
-
|
731
|
+
\e[1m\e[33m @sferik\e[0m
|
732
|
+
@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
|
733
|
+
to be missing "1.1" from the URL.
|
734
|
+
|
735
|
+
\e[1m\e[33m @sferik\e[0m
|
736
|
+
@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
666
737
|
|
667
738
|
eos
|
668
739
|
end
|
@@ -674,27 +745,28 @@ ID Posted at Screen name Text
|
|
674
745
|
@search.timeline("sferik", "twitter")
|
675
746
|
$stdout.string.should == <<-eos
|
676
747
|
ID,Posted at,Screen name,Text
|
677
|
-
|
748
|
+
244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
|
749
|
+
244100411563339777,2012-09-07 15:50:47 +0000,sferik,@episod @twitterapi Did you catch https://t.co/VHsQvZT0 as well?
|
678
750
|
eos
|
679
751
|
end
|
680
752
|
end
|
681
753
|
context "--id" do
|
682
754
|
before do
|
683
755
|
@search.options = @search.options.merge("id" => true)
|
684
|
-
stub_get("/1/statuses/user_timeline.json").
|
756
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
685
757
|
with(:query => {:count => "200", :user_id => "7505382"}).
|
686
758
|
to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
687
|
-
stub_get("/1/statuses/user_timeline.json").
|
688
|
-
with(:query => {:count => "200", :max_id => "
|
759
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
760
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).
|
689
761
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
690
762
|
end
|
691
763
|
it "should request the correct resource" do
|
692
764
|
@search.timeline("7505382", "twitter")
|
693
|
-
a_get("/1/statuses/user_timeline.json").
|
765
|
+
a_get("/1.1/statuses/user_timeline.json").
|
694
766
|
with(:query => {:count => "200", :user_id => "7505382"}).
|
695
767
|
should have_been_made
|
696
|
-
a_get("/1/statuses/user_timeline.json").
|
697
|
-
with(:query => {:count => "200", :max_id => "
|
768
|
+
a_get("/1.1/statuses/user_timeline.json").
|
769
|
+
with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).
|
698
770
|
should have_been_made
|
699
771
|
end
|
700
772
|
end
|
@@ -706,19 +778,20 @@ ID,Posted at,Screen name,Text
|
|
706
778
|
@search.timeline("sferik", "twitter")
|
707
779
|
$stdout.string.should == <<-eos
|
708
780
|
ID Posted at Screen name Text
|
709
|
-
|
781
|
+
244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
|
782
|
+
244100411563339777 Sep 7 07:50 @sferik @episod @twitterapi Did you ca...
|
710
783
|
eos
|
711
784
|
end
|
712
785
|
end
|
713
786
|
context "Twitter is down" do
|
714
787
|
it "should retry 3 times and then raise an error" do
|
715
|
-
stub_get("/1/statuses/user_timeline.json").
|
788
|
+
stub_get("/1.1/statuses/user_timeline.json").
|
716
789
|
with(:query => {:screen_name => "sferik", :count => "200"}).
|
717
790
|
to_return(:status => 502)
|
718
791
|
lambda do
|
719
792
|
@search.timeline("sferik", "twitter")
|
720
793
|
end.should raise_error("Twitter is down or being upgraded.")
|
721
|
-
a_get("/1/statuses/user_timeline.json").
|
794
|
+
a_get("/1.1/statuses/user_timeline.json").
|
722
795
|
with(:query => {:screen_name => "sferik", :count => "200"}).
|
723
796
|
should have_been_made.times(3)
|
724
797
|
end
|
@@ -728,20 +801,20 @@ ID Posted at Screen name Text
|
|
728
801
|
|
729
802
|
describe "#users" do
|
730
803
|
before do
|
731
|
-
stub_get("/1/users/search.json").
|
804
|
+
stub_get("/1.1/users/search.json").
|
732
805
|
with(:query => {:page => "1", :q => "Erik"}).
|
733
806
|
to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
734
|
-
stub_get("/1/users/search.json").
|
807
|
+
stub_get("/1.1/users/search.json").
|
735
808
|
with(:query => {:page => "2", :q => "Erik"}).
|
736
809
|
to_return(:body => fixture("empty_array.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
737
810
|
end
|
738
811
|
it "should request the correct resource" do
|
739
812
|
@search.users("Erik")
|
740
813
|
1.upto(50).each do |page|
|
741
|
-
a_get("/1/users/search.json").
|
814
|
+
a_get("/1.1/users/search.json").
|
742
815
|
with(:query => {:page => "1", :q => "Erik"}).
|
743
816
|
should have_been_made
|
744
|
-
a_get("/1/users/search.json").
|
817
|
+
a_get("/1.1/users/search.json").
|
745
818
|
with(:query => {:page => "2", :q => "Erik"}).
|
746
819
|
should have_been_made
|
747
820
|
end
|
@@ -859,13 +932,13 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
859
932
|
end
|
860
933
|
context "Twitter is down" do
|
861
934
|
it "should retry 3 times and then raise an error" do
|
862
|
-
stub_get("/1/users/search.json").
|
935
|
+
stub_get("/1.1/users/search.json").
|
863
936
|
with(:query => {:page => "2", :q => "Erik", }).
|
864
937
|
to_return(:status => 502)
|
865
938
|
lambda do
|
866
939
|
@search.users("Erik")
|
867
940
|
end.should raise_error("Twitter is down or being upgraded.")
|
868
|
-
a_get("/1/users/search.json").
|
941
|
+
a_get("/1.1/users/search.json").
|
869
942
|
with(:query => {:page => "2", :q => "Erik", }).
|
870
943
|
should have_been_made.times(3)
|
871
944
|
end
|