t 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +1 -0
- data/bin/t +4 -9
- data/lib/t.rb +7 -7
- data/lib/t/cli.rb +148 -135
- data/lib/t/collectable.rb +1 -1
- data/lib/t/delete.rb +3 -3
- data/lib/t/list.rb +7 -4
- data/lib/t/printable.rb +29 -30
- data/lib/t/search.rb +18 -19
- data/lib/t/set.rb +3 -3
- data/lib/t/stream.rb +2 -2
- data/lib/t/utils.rb +4 -4
- data/lib/t/version.rb +6 -21
- data/spec/cli_spec.rb +257 -182
- data/spec/fixtures/geo.json +414 -0
- data/spec/fixtures/geo_no_city.json +344 -0
- data/spec/fixtures/geo_no_state.json +299 -0
- data/spec/helper.rb +1 -1
- data/spec/list_spec.rb +25 -11
- data/spec/search_spec.rb +107 -107
- data/spec/stream_spec.rb +15 -15
- data/t.gemspec +13 -13
- metadata +65 -82
- metadata.gz.sig +0 -0
- data/spec/fixtures/geo.kml +0 -64
- data/spec/fixtures/geo_no_city.kml +0 -24
- data/spec/fixtures/geo_no_state.kml +0 -16
@@ -0,0 +1,299 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "United States",
|
7
|
+
"short_name" : "US",
|
8
|
+
"types" : [ "country", "political" ]
|
9
|
+
}
|
10
|
+
],
|
11
|
+
"formatted_address" : "USA",
|
12
|
+
"geometry" : {
|
13
|
+
"location" : {
|
14
|
+
"lat" : 37.759658,
|
15
|
+
"lng" : -122.410229
|
16
|
+
},
|
17
|
+
"location_type" : "ROOFTOP",
|
18
|
+
"viewport" : {
|
19
|
+
"northeast" : {
|
20
|
+
"lat" : 37.7610069802915,
|
21
|
+
"lng" : -122.4088800197085
|
22
|
+
},
|
23
|
+
"southwest" : {
|
24
|
+
"lat" : 37.75830901970851,
|
25
|
+
"lng" : -122.4115779802915
|
26
|
+
}
|
27
|
+
}
|
28
|
+
},
|
29
|
+
"types" : [ "street_address" ]
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"address_components" : [
|
33
|
+
{
|
34
|
+
"long_name" : "United States",
|
35
|
+
"short_name" : "US",
|
36
|
+
"types" : [ "country", "political" ]
|
37
|
+
}
|
38
|
+
],
|
39
|
+
"formatted_address" : "USA",
|
40
|
+
"geometry" : {
|
41
|
+
"bounds" : {
|
42
|
+
"northeast" : {
|
43
|
+
"lat" : 37.7719876,
|
44
|
+
"lng" : -122.4027825
|
45
|
+
},
|
46
|
+
"southwest" : {
|
47
|
+
"lat" : 37.7478217,
|
48
|
+
"lng" : -122.4309111
|
49
|
+
}
|
50
|
+
},
|
51
|
+
"location" : {
|
52
|
+
"lat" : 37.7598648,
|
53
|
+
"lng" : -122.4147977
|
54
|
+
},
|
55
|
+
"location_type" : "APPROXIMATE",
|
56
|
+
"viewport" : {
|
57
|
+
"northeast" : {
|
58
|
+
"lat" : 37.7719876,
|
59
|
+
"lng" : -122.4027825
|
60
|
+
},
|
61
|
+
"southwest" : {
|
62
|
+
"lat" : 37.7478217,
|
63
|
+
"lng" : -122.4309111
|
64
|
+
}
|
65
|
+
}
|
66
|
+
},
|
67
|
+
"types" : [ "neighborhood", "political" ]
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"address_components" : [
|
71
|
+
{
|
72
|
+
"long_name" : "United States",
|
73
|
+
"short_name" : "US",
|
74
|
+
"types" : [ "country", "political" ]
|
75
|
+
}
|
76
|
+
],
|
77
|
+
"formatted_address" : "USA",
|
78
|
+
"geometry" : {
|
79
|
+
"bounds" : {
|
80
|
+
"northeast" : {
|
81
|
+
"lat" : 37.76578300000001,
|
82
|
+
"lng" : -122.402855
|
83
|
+
},
|
84
|
+
"southwest" : {
|
85
|
+
"lat" : 37.731608,
|
86
|
+
"lng" : -122.427269
|
87
|
+
}
|
88
|
+
},
|
89
|
+
"location" : {
|
90
|
+
"lat" : 37.7485824,
|
91
|
+
"lng" : -122.4184108
|
92
|
+
},
|
93
|
+
"location_type" : "APPROXIMATE",
|
94
|
+
"viewport" : {
|
95
|
+
"northeast" : {
|
96
|
+
"lat" : 37.76578300000001,
|
97
|
+
"lng" : -122.402855
|
98
|
+
},
|
99
|
+
"southwest" : {
|
100
|
+
"lat" : 37.731608,
|
101
|
+
"lng" : -122.427269
|
102
|
+
}
|
103
|
+
}
|
104
|
+
},
|
105
|
+
"types" : [ "postal_code" ]
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"address_components" : [
|
109
|
+
{
|
110
|
+
"long_name" : "United States",
|
111
|
+
"short_name" : "US",
|
112
|
+
"types" : [ "country", "political" ]
|
113
|
+
}
|
114
|
+
],
|
115
|
+
"formatted_address" : "USA",
|
116
|
+
"geometry" : {
|
117
|
+
"bounds" : {
|
118
|
+
"northeast" : {
|
119
|
+
"lat" : 37.9297707,
|
120
|
+
"lng" : -122.3279148
|
121
|
+
},
|
122
|
+
"southwest" : {
|
123
|
+
"lat" : 37.6933354,
|
124
|
+
"lng" : -123.1077733
|
125
|
+
}
|
126
|
+
},
|
127
|
+
"location" : {
|
128
|
+
"lat" : 37.7749295,
|
129
|
+
"lng" : -122.4194155
|
130
|
+
},
|
131
|
+
"location_type" : "APPROXIMATE",
|
132
|
+
"viewport" : {
|
133
|
+
"northeast" : {
|
134
|
+
"lat" : 37.812,
|
135
|
+
"lng" : -122.3482
|
136
|
+
},
|
137
|
+
"southwest" : {
|
138
|
+
"lat" : 37.70339999999999,
|
139
|
+
"lng" : -122.527
|
140
|
+
}
|
141
|
+
}
|
142
|
+
},
|
143
|
+
"types" : [ "locality", "political" ]
|
144
|
+
},
|
145
|
+
{
|
146
|
+
"address_components" : [
|
147
|
+
{
|
148
|
+
"long_name" : "United States",
|
149
|
+
"short_name" : "US",
|
150
|
+
"types" : [ "country", "political" ]
|
151
|
+
}
|
152
|
+
],
|
153
|
+
"formatted_address" : "USA",
|
154
|
+
"geometry" : {
|
155
|
+
"bounds" : {
|
156
|
+
"northeast" : {
|
157
|
+
"lat" : 37.9297707,
|
158
|
+
"lng" : -122.3279148
|
159
|
+
},
|
160
|
+
"southwest" : {
|
161
|
+
"lat" : 37.6933354,
|
162
|
+
"lng" : -123.1077733
|
163
|
+
}
|
164
|
+
},
|
165
|
+
"location" : {
|
166
|
+
"lat" : 37.7749073,
|
167
|
+
"lng" : -122.4193878
|
168
|
+
},
|
169
|
+
"location_type" : "APPROXIMATE",
|
170
|
+
"viewport" : {
|
171
|
+
"northeast" : {
|
172
|
+
"lat" : 37.833827,
|
173
|
+
"lng" : -122.3551997
|
174
|
+
},
|
175
|
+
"southwest" : {
|
176
|
+
"lat" : 37.708086,
|
177
|
+
"lng" : -122.5300999
|
178
|
+
}
|
179
|
+
}
|
180
|
+
},
|
181
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
182
|
+
},
|
183
|
+
{
|
184
|
+
"address_components" : [
|
185
|
+
{
|
186
|
+
"long_name" : "United States",
|
187
|
+
"short_name" : "US",
|
188
|
+
"types" : [ "country", "political" ]
|
189
|
+
}
|
190
|
+
],
|
191
|
+
"formatted_address" : "United States",
|
192
|
+
"geometry" : {
|
193
|
+
"bounds" : {
|
194
|
+
"northeast" : {
|
195
|
+
"lat" : 38.320945,
|
196
|
+
"lng" : -121.469275
|
197
|
+
},
|
198
|
+
"southwest" : {
|
199
|
+
"lat" : 37.1073458,
|
200
|
+
"lng" : -123.024066
|
201
|
+
}
|
202
|
+
},
|
203
|
+
"location" : {
|
204
|
+
"lat" : 37.8043507,
|
205
|
+
"lng" : -121.8107079
|
206
|
+
},
|
207
|
+
"location_type" : "APPROXIMATE",
|
208
|
+
"viewport" : {
|
209
|
+
"northeast" : {
|
210
|
+
"lat" : 38.320945,
|
211
|
+
"lng" : -121.469275
|
212
|
+
},
|
213
|
+
"southwest" : {
|
214
|
+
"lat" : 37.1073458,
|
215
|
+
"lng" : -123.024066
|
216
|
+
}
|
217
|
+
}
|
218
|
+
},
|
219
|
+
"types" : [ "political" ]
|
220
|
+
},
|
221
|
+
{
|
222
|
+
"address_components" : [
|
223
|
+
{
|
224
|
+
"long_name" : "United States",
|
225
|
+
"short_name" : "US",
|
226
|
+
"types" : [ "country", "political" ]
|
227
|
+
}
|
228
|
+
],
|
229
|
+
"formatted_address" : "USA",
|
230
|
+
"geometry" : {
|
231
|
+
"bounds" : {
|
232
|
+
"northeast" : {
|
233
|
+
"lat" : 42.0095169,
|
234
|
+
"lng" : -114.131211
|
235
|
+
},
|
236
|
+
"southwest" : {
|
237
|
+
"lat" : 32.5342321,
|
238
|
+
"lng" : -124.4096195
|
239
|
+
}
|
240
|
+
},
|
241
|
+
"location" : {
|
242
|
+
"lat" : 36.778261,
|
243
|
+
"lng" : -119.4179324
|
244
|
+
},
|
245
|
+
"location_type" : "APPROXIMATE",
|
246
|
+
"viewport" : {
|
247
|
+
"northeast" : {
|
248
|
+
"lat" : 42.0095169,
|
249
|
+
"lng" : -114.131211
|
250
|
+
},
|
251
|
+
"southwest" : {
|
252
|
+
"lat" : 32.5342321,
|
253
|
+
"lng" : -124.4096195
|
254
|
+
}
|
255
|
+
}
|
256
|
+
},
|
257
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"address_components" : [
|
261
|
+
{
|
262
|
+
"long_name" : "United States",
|
263
|
+
"short_name" : "US",
|
264
|
+
"types" : [ "country", "political" ]
|
265
|
+
}
|
266
|
+
],
|
267
|
+
"formatted_address" : "United States",
|
268
|
+
"geometry" : {
|
269
|
+
"bounds" : {
|
270
|
+
"northeast" : {
|
271
|
+
"lat" : 90,
|
272
|
+
"lng" : 180
|
273
|
+
},
|
274
|
+
"southwest" : {
|
275
|
+
"lat" : -90,
|
276
|
+
"lng" : -180
|
277
|
+
}
|
278
|
+
},
|
279
|
+
"location" : {
|
280
|
+
"lat" : 37.09024,
|
281
|
+
"lng" : -95.712891
|
282
|
+
},
|
283
|
+
"location_type" : "APPROXIMATE",
|
284
|
+
"viewport" : {
|
285
|
+
"northeast" : {
|
286
|
+
"lat" : 49.38,
|
287
|
+
"lng" : -66.94
|
288
|
+
},
|
289
|
+
"southwest" : {
|
290
|
+
"lat" : 25.82,
|
291
|
+
"lng" : -124.39
|
292
|
+
}
|
293
|
+
}
|
294
|
+
},
|
295
|
+
"types" : [ "country", "political" ]
|
296
|
+
}
|
297
|
+
],
|
298
|
+
"status" : "OK"
|
299
|
+
}
|
data/spec/helper.rb
CHANGED
data/spec/list_spec.rb
CHANGED
@@ -328,11 +328,11 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
|
|
328
328
|
describe '#timeline' do
|
329
329
|
before do
|
330
330
|
@list.options = @list.options.merge('color' => 'always')
|
331
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
|
331
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
332
332
|
end
|
333
333
|
it 'requests the correct resource' do
|
334
334
|
@list.timeline('presidents')
|
335
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents'})).to have_been_made
|
335
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
336
336
|
end
|
337
337
|
it 'has the correct output' do
|
338
338
|
@list.timeline('presidents')
|
@@ -697,6 +697,20 @@ ID,Posted at,Screen name,Text
|
|
697
697
|
eos
|
698
698
|
end
|
699
699
|
end
|
700
|
+
context '--decode-uris' do
|
701
|
+
before do
|
702
|
+
@list.options = @list.options.merge('decode_uris' => true)
|
703
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
704
|
+
end
|
705
|
+
it 'requests the correct resource' do
|
706
|
+
@list.timeline('presidents')
|
707
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents', :include_entities => 'true'})).to have_been_made
|
708
|
+
end
|
709
|
+
it 'decodes URLs' do
|
710
|
+
@list.timeline('presidents')
|
711
|
+
expect($stdout.string).to include 'https://twitter.com/sferik/status/243988000076337152'
|
712
|
+
end
|
713
|
+
end
|
700
714
|
context '--long' do
|
701
715
|
before do
|
702
716
|
@list.options = @list.options.merge('long' => true)
|
@@ -761,35 +775,35 @@ ID Posted at Screen name Text
|
|
761
775
|
end
|
762
776
|
context '--number' do
|
763
777
|
before do
|
764
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
|
765
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '200', :slug => 'presidents'}).to_return(:body => fixture('200_statuses.json'))
|
766
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :max_id => '265500541700956160', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
|
778
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
779
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '200', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('200_statuses.json'))
|
780
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :max_id => '265500541700956160', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
767
781
|
end
|
768
782
|
it 'limits the number of results to 1' do
|
769
783
|
@list.options = @list.options.merge('number' => 1)
|
770
784
|
@list.timeline('presidents')
|
771
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :slug => 'presidents'})).to have_been_made
|
785
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
772
786
|
end
|
773
787
|
it 'limits the number of results to 201' do
|
774
788
|
@list.options = @list.options.merge('number' => 201)
|
775
789
|
@list.timeline('presidents')
|
776
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '200', :slug => 'presidents'})).to have_been_made
|
777
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :max_id => '265500541700956160', :slug => 'presidents'})).to have_been_made
|
790
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '200', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
791
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '1', :max_id => '265500541700956160', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
778
792
|
end
|
779
793
|
end
|
780
794
|
context 'with a user passed' do
|
781
795
|
it 'requests the correct resource' do
|
782
796
|
@list.timeline('testcli/presidents')
|
783
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents'})).to have_been_made
|
797
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_screen_name => 'testcli', :count => '20', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
784
798
|
end
|
785
799
|
context '--id' do
|
786
800
|
before do
|
787
801
|
@list.options = @list.options.merge('id' => true)
|
788
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_id => '7505382', :count => '20', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
|
802
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:owner_id => '7505382', :count => '20', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
789
803
|
end
|
790
804
|
it 'requests the correct resource' do
|
791
805
|
@list.timeline('7505382/presidents')
|
792
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_id => '7505382', :count => '20', :slug => 'presidents'})).to have_been_made
|
806
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:owner_id => '7505382', :count => '20', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
793
807
|
end
|
794
808
|
end
|
795
809
|
end
|
data/spec/search_spec.rb
CHANGED
@@ -31,11 +31,11 @@ describe T::Search do
|
|
31
31
|
|
32
32
|
describe '#all' do
|
33
33
|
before do
|
34
|
-
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100'}).to_return(:body => fixture('search.json'))
|
34
|
+
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => 'false'}).to_return(:body => fixture('search.json'))
|
35
35
|
end
|
36
36
|
it 'requests the correct resource' do
|
37
37
|
@search.all('twitter')
|
38
|
-
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100'})).to have_been_made
|
38
|
+
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => 'false'})).to have_been_made
|
39
39
|
end
|
40
40
|
it 'has the correct output' do
|
41
41
|
@search.all('twitter')
|
@@ -180,19 +180,19 @@ ID Posted at Screen name Text
|
|
180
180
|
end
|
181
181
|
context '--number' do
|
182
182
|
before do
|
183
|
-
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '1'}).to_return(:body => fixture('search2.json'))
|
184
|
-
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100'}).to_return(:body => fixture('search.json'))
|
183
|
+
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '1', :include_entities => 'false'}).to_return(:body => fixture('search2.json'))
|
184
|
+
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => 'false'}).to_return(:body => fixture('search.json'))
|
185
185
|
stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => '1', :max_id => '415600158693675007'}).to_return(:body => fixture('search2.json'))
|
186
186
|
end
|
187
187
|
it 'limits the number of results to 1' do
|
188
188
|
@search.options = @search.options.merge('number' => 1)
|
189
189
|
@search.all('twitter')
|
190
|
-
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100'})).to have_been_made
|
190
|
+
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => 'false'})).to have_been_made
|
191
191
|
end
|
192
192
|
it 'limits the number of results to 201' do
|
193
193
|
@search.options = @search.options.merge('number' => 201)
|
194
194
|
@search.all('twitter')
|
195
|
-
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100'})).to have_been_made
|
195
|
+
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => 'false'})).to have_been_made
|
196
196
|
expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '100', :include_entities => '1', :max_id => '415600158693675007'})).to have_been_made
|
197
197
|
end
|
198
198
|
end
|
@@ -200,13 +200,13 @@ ID Posted at Screen name Text
|
|
200
200
|
|
201
201
|
describe '#favorites' do
|
202
202
|
before do
|
203
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200'}).to_return(:body => fixture('statuses.json'))
|
204
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
203
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
204
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
205
205
|
end
|
206
206
|
it 'requests the correct resource' do
|
207
207
|
@search.favorites('twitter')
|
208
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200'})).to have_been_made
|
209
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937'})).to have_been_made
|
208
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
|
209
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'false'})).to have_been_made
|
210
210
|
end
|
211
211
|
it 'has the correct output' do
|
212
212
|
@search.favorites('twitter')
|
@@ -236,13 +236,13 @@ ID,Posted at,Screen name,Text
|
|
236
236
|
context '--decode-uris' do
|
237
237
|
before(:each) do
|
238
238
|
@search.options = @search.options.merge('decode_uris' => true)
|
239
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities =>
|
240
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities =>
|
239
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
240
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'true', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
241
241
|
end
|
242
242
|
it 'requests the correct resource' do
|
243
243
|
@search.favorites('twitter')
|
244
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities =>
|
245
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities =>
|
244
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'true'})).to have_been_made
|
245
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'true', :max_id => '244099460672679937'})).to have_been_made
|
246
246
|
end
|
247
247
|
it 'decodes URLs' do
|
248
248
|
@search.favorites('twitter')
|
@@ -264,22 +264,22 @@ ID Posted at Screen name Text
|
|
264
264
|
end
|
265
265
|
context 'Twitter is down' do
|
266
266
|
it 'retries 3 times and then raise an error' do
|
267
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200'}).to_return(:status => 502)
|
267
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:status => 502)
|
268
268
|
expect do
|
269
269
|
@search.favorites('twitter')
|
270
270
|
end.to raise_error(Twitter::Error::BadGateway)
|
271
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200'})).to have_been_made.times(3)
|
271
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made.times(3)
|
272
272
|
end
|
273
273
|
end
|
274
274
|
context 'with a user passed' do
|
275
275
|
before do
|
276
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
|
277
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'}).to_return(:body => fixture('empty_array.json'))
|
276
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
277
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
278
278
|
end
|
279
279
|
it 'requests the correct resource' do
|
280
280
|
@search.favorites('sferik', 'twitter')
|
281
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik'})).to have_been_made
|
282
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'})).to have_been_made
|
281
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
|
282
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
|
283
283
|
end
|
284
284
|
it 'has the correct output' do
|
285
285
|
@search.favorites('sferik', 'twitter')
|
@@ -296,13 +296,13 @@ ID Posted at Screen name Text
|
|
296
296
|
context '--id' do
|
297
297
|
before do
|
298
298
|
@search.options = @search.options.merge('id' => true)
|
299
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
|
300
|
-
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'}).to_return(:body => fixture('empty_array.json'))
|
299
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
300
|
+
stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
301
301
|
end
|
302
302
|
it 'requests the correct resource' do
|
303
303
|
@search.favorites('7505382', 'twitter')
|
304
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :user_id => '7505382'})).to have_been_made
|
305
|
-
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'})).to have_been_made
|
304
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
|
305
|
+
expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
|
306
306
|
end
|
307
307
|
it 'has the correct output' do
|
308
308
|
@search.favorites('7505382', 'twitter')
|
@@ -322,13 +322,13 @@ ID Posted at Screen name Text
|
|
322
322
|
|
323
323
|
describe '#mentions' do
|
324
324
|
before do
|
325
|
-
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'}).to_return(:body => fixture('statuses.json'))
|
326
|
-
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
325
|
+
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
326
|
+
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
327
327
|
end
|
328
328
|
it 'requests the correct resource' do
|
329
329
|
@search.mentions('twitter')
|
330
|
-
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'})).to have_been_made
|
331
|
-
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'})).to have_been_made
|
330
|
+
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
|
331
|
+
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'false'})).to have_been_made
|
332
332
|
end
|
333
333
|
it 'has the correct output' do
|
334
334
|
@search.mentions('twitter')
|
@@ -358,13 +358,13 @@ ID,Posted at,Screen name,Text
|
|
358
358
|
context '--decode-uris' do
|
359
359
|
before(:each) do
|
360
360
|
@search.options = @search.options.merge('decode_uris' => true)
|
361
|
-
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities =>
|
362
|
-
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities =>
|
361
|
+
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
362
|
+
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'true', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
363
363
|
end
|
364
364
|
it 'requests the correct resource' do
|
365
365
|
@search.mentions('twitter')
|
366
|
-
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities =>
|
367
|
-
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities =>
|
366
|
+
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'true'})).to have_been_made
|
367
|
+
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'true', :max_id => '244099460672679937'})).to have_been_made
|
368
368
|
end
|
369
369
|
it 'decodes URLs' do
|
370
370
|
@search.mentions('twitter')
|
@@ -386,24 +386,24 @@ ID Posted at Screen name Text
|
|
386
386
|
end
|
387
387
|
context 'Twitter is down' do
|
388
388
|
it 'retries 3 times and then raise an error' do
|
389
|
-
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'}).to_return(:status => 502)
|
389
|
+
stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:status => 502)
|
390
390
|
expect do
|
391
391
|
@search.mentions('twitter')
|
392
392
|
end.to raise_error(Twitter::Error::BadGateway)
|
393
|
-
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'})).to have_been_made.times(3)
|
393
|
+
expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made.times(3)
|
394
394
|
end
|
395
395
|
end
|
396
396
|
end
|
397
397
|
|
398
398
|
describe '#list' do
|
399
399
|
before do
|
400
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
|
401
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:body => fixture('empty_array.json'))
|
400
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
401
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
402
402
|
end
|
403
403
|
it 'requests the correct resource' do
|
404
404
|
@search.list('presidents', 'twitter')
|
405
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
|
406
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
|
405
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
406
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
407
407
|
end
|
408
408
|
it 'has the correct output' do
|
409
409
|
@search.list('presidents', 'twitter')
|
@@ -433,13 +433,13 @@ ID,Posted at,Screen name,Text
|
|
433
433
|
context '--decode-uris' do
|
434
434
|
before(:each) do
|
435
435
|
@search.options = @search.options.merge('decode_uris' => true)
|
436
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :
|
437
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :
|
436
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
437
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
|
438
438
|
end
|
439
439
|
it 'requests the correct resource' do
|
440
440
|
@search.list('presidents', 'twitter')
|
441
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :
|
442
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :
|
441
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'true'})).to have_been_made
|
442
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'true'})).to have_been_made
|
443
443
|
end
|
444
444
|
it 'decodes URLs' do
|
445
445
|
@search.list('presidents', 'twitter')
|
@@ -462,41 +462,41 @@ ID Posted at Screen name Text
|
|
462
462
|
context 'with a user passed' do
|
463
463
|
it 'requests the correct resource' do
|
464
464
|
@search.list('testcli/presidents', 'twitter')
|
465
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
|
465
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
466
466
|
end
|
467
467
|
context '--id' do
|
468
468
|
before do
|
469
469
|
@search.options = @search.options.merge('id' => true)
|
470
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_id => '7505382', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
|
471
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_id => '7505382', :slug => 'presidents'}).to_return(:body => fixture('empty_array.json'))
|
470
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_id => '7505382', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
471
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_id => '7505382', :slug => 'presidents', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
472
472
|
end
|
473
473
|
it 'requests the correct resource' do
|
474
474
|
@search.list('7505382/presidents', 'twitter')
|
475
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_id => '7505382', :slug => 'presidents'})).to have_been_made
|
476
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_id => '7505382', :slug => 'presidents'})).to have_been_made
|
475
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_id => '7505382', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
476
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_id => '7505382', :slug => 'presidents', :include_entities => 'false'})).to have_been_made
|
477
477
|
end
|
478
478
|
end
|
479
479
|
end
|
480
480
|
context 'Twitter is down' do
|
481
481
|
it 'retries 3 times and then raise an error' do
|
482
|
-
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:status => 502)
|
482
|
+
stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'}).to_return(:status => 502)
|
483
483
|
expect do
|
484
484
|
@search.list('presidents', 'twitter')
|
485
485
|
end.to raise_error(Twitter::Error::BadGateway)
|
486
|
-
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made.times(3)
|
486
|
+
expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents', :include_entities => 'false'})).to have_been_made.times(3)
|
487
487
|
end
|
488
488
|
end
|
489
489
|
end
|
490
490
|
|
491
491
|
describe '#retweets' do
|
492
492
|
before do
|
493
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'}).to_return(:body => fixture('statuses.json'))
|
494
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
|
493
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
494
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
495
495
|
end
|
496
496
|
it 'requests the correct resource' do
|
497
497
|
@search.retweets('mosaic')
|
498
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made
|
499
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983'})).to have_been_made.times(2)
|
498
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'})).to have_been_made
|
499
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'false'})).to have_been_made.times(2)
|
500
500
|
end
|
501
501
|
it 'has the correct output' do
|
502
502
|
@search.retweets('mosaic')
|
@@ -521,13 +521,13 @@ ID,Posted at,Screen name,Text
|
|
521
521
|
context '--decode-uris' do
|
522
522
|
before(:each) do
|
523
523
|
@search.options = @search.options.merge('decode_uris' => true)
|
524
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :
|
525
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :
|
524
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
525
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
|
526
526
|
end
|
527
527
|
it 'requests the correct resource' do
|
528
528
|
@search.retweets('mosaic')
|
529
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :
|
530
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :
|
529
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'true'})).to have_been_made
|
530
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983', :include_entities => 'true'})).to have_been_made.times(2)
|
531
531
|
end
|
532
532
|
it 'decodes URLs' do
|
533
533
|
@search.retweets('mosaic')
|
@@ -548,22 +548,22 @@ ID Posted at Screen name Text
|
|
548
548
|
end
|
549
549
|
context 'Twitter is down' do
|
550
550
|
it 'retries 3 times and then raise an error' do
|
551
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'}).to_return(:status => 502)
|
551
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'}).to_return(:status => 502)
|
552
552
|
expect do
|
553
553
|
@search.retweets('mosaic')
|
554
554
|
end.to raise_error(Twitter::Error::BadGateway)
|
555
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made.times(3)
|
555
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :include_entities => 'false'})).to have_been_made.times(3)
|
556
556
|
end
|
557
557
|
end
|
558
558
|
context 'with a user passed' do
|
559
559
|
before do
|
560
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
|
561
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
|
560
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
561
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
562
562
|
end
|
563
563
|
it 'requests the correct resource' do
|
564
564
|
@search.retweets('sferik', 'mosaic')
|
565
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik'})).to have_been_made
|
566
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983'})).to have_been_made.times(2)
|
565
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
|
566
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983', :include_entities => 'false'})).to have_been_made.times(2)
|
567
567
|
end
|
568
568
|
it 'has the correct output' do
|
569
569
|
@search.retweets('sferik', 'mosaic')
|
@@ -576,13 +576,13 @@ ID Posted at Screen name Text
|
|
576
576
|
context '--id' do
|
577
577
|
before do
|
578
578
|
@search.options = @search.options.merge('id' => true)
|
579
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
|
580
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
|
579
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
580
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
581
581
|
end
|
582
582
|
it 'requests the correct resource' do
|
583
583
|
@search.retweets('7505382', 'mosaic')
|
584
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382'})).to have_been_made
|
585
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983'})).to have_been_made.times(2)
|
584
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
|
585
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983', :include_entities => 'false'})).to have_been_made.times(2)
|
586
586
|
end
|
587
587
|
it 'has the correct output' do
|
588
588
|
@search.retweets('7505382', 'mosaic')
|
@@ -598,13 +598,13 @@ ID Posted at Screen name Text
|
|
598
598
|
|
599
599
|
describe '#timeline' do
|
600
600
|
before do
|
601
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'}).to_return(:body => fixture('statuses.json'))
|
602
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
601
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
602
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
603
603
|
end
|
604
604
|
it 'requests the correct resource' do
|
605
605
|
@search.timeline('twitter')
|
606
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'})).to have_been_made
|
607
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'})).to have_been_made
|
606
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made
|
607
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'false'})).to have_been_made
|
608
608
|
end
|
609
609
|
it 'has the correct output' do
|
610
610
|
@search.timeline('twitter')
|
@@ -634,13 +634,13 @@ ID,Posted at,Screen name,Text
|
|
634
634
|
context '--decode-uris' do
|
635
635
|
before(:each) do
|
636
636
|
@search.options = @search.options.merge('decode_uris' => true)
|
637
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities =>
|
638
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities =>
|
637
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'true'}).to_return(:body => fixture('statuses.json'))
|
638
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'true'}).to_return(:body => fixture('empty_array.json'))
|
639
639
|
end
|
640
640
|
it 'requests the correct resource' do
|
641
641
|
@search.timeline('twitter')
|
642
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities =>
|
643
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities =>
|
642
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'true'})).to have_been_made
|
643
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 'true'})).to have_been_made
|
644
644
|
end
|
645
645
|
it 'decodes URLs' do
|
646
646
|
@search.timeline('twitter')
|
@@ -650,25 +650,25 @@ ID,Posted at,Screen name,Text
|
|
650
650
|
context '--exclude=replies' do
|
651
651
|
before do
|
652
652
|
@search.options = @search.options.merge('exclude' => 'replies')
|
653
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true'}).to_return(:body => fixture('statuses.json'))
|
654
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
653
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
654
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
655
655
|
end
|
656
656
|
it 'excludes replies' do
|
657
657
|
@search.timeline
|
658
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true'})).to have_been_made
|
659
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :max_id => '244099460672679937'})).to have_been_made
|
658
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :include_entities => 'false'})).to have_been_made
|
659
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :max_id => '244099460672679937', :include_entities => 'false'})).to have_been_made
|
660
660
|
end
|
661
661
|
end
|
662
662
|
context '--exclude=retweets' do
|
663
663
|
before do
|
664
664
|
@search.options = @search.options.merge('exclude' => 'retweets')
|
665
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false'}).to_return(:body => fixture('statuses.json'))
|
666
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
|
665
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
666
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :max_id => '244099460672679937', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
667
667
|
end
|
668
668
|
it 'excludes retweets' do
|
669
669
|
@search.timeline
|
670
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false'})).to have_been_made
|
671
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :max_id => '244099460672679937'})).to have_been_made
|
670
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :include_entities => 'false'})).to have_been_made
|
671
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :max_id => '244099460672679937', :include_entities => 'false'})).to have_been_made
|
672
672
|
end
|
673
673
|
end
|
674
674
|
context '--long' do
|
@@ -687,43 +687,43 @@ ID Posted at Screen name Text
|
|
687
687
|
context '--max-id' do
|
688
688
|
before do
|
689
689
|
@search.options = @search.options.merge('max_id' => 244_104_558_433_951_744)
|
690
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
|
690
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
691
691
|
end
|
692
692
|
it 'requests the correct resource' do
|
693
693
|
@search.timeline('twitter')
|
694
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244104558433951744'})).to have_been_made
|
694
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
|
695
695
|
end
|
696
696
|
end
|
697
697
|
context '--since-id' do
|
698
698
|
before do
|
699
699
|
@search.options = @search.options.merge('since_id' => 244_104_558_433_951_744)
|
700
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
|
701
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :since_id => '244104558433951744'}).to_return(:body => fixture('empty_array.json'))
|
700
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
701
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
702
702
|
end
|
703
703
|
it 'requests the correct resource' do
|
704
704
|
@search.timeline('twitter')
|
705
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :since_id => '244104558433951744'})).to have_been_made
|
706
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :since_id => '244104558433951744'})).to have_been_made
|
705
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
|
706
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
|
707
707
|
end
|
708
708
|
end
|
709
709
|
context 'Twitter is down' do
|
710
710
|
it 'retries 3 times and then raise an error' do
|
711
|
-
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'}).to_return(:status => 502)
|
711
|
+
stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'}).to_return(:status => 502)
|
712
712
|
expect do
|
713
713
|
@search.timeline('twitter')
|
714
714
|
end.to raise_error(Twitter::Error::BadGateway)
|
715
|
-
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'})).to have_been_made.times(3)
|
715
|
+
expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 'false'})).to have_been_made.times(3)
|
716
716
|
end
|
717
717
|
end
|
718
718
|
context 'with a user passed' do
|
719
719
|
before do
|
720
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
|
721
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'}).to_return(:body => fixture('empty_array.json'))
|
720
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
721
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
722
722
|
end
|
723
723
|
it 'requests the correct resource' do
|
724
724
|
@search.timeline('sferik', 'twitter')
|
725
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik'})).to have_been_made
|
726
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'})).to have_been_made
|
725
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
|
726
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik', :include_entities => 'false'})).to have_been_made
|
727
727
|
end
|
728
728
|
it 'has the correct output' do
|
729
729
|
@search.timeline('sferik', 'twitter')
|
@@ -753,13 +753,13 @@ ID,Posted at,Screen name,Text
|
|
753
753
|
context '--id' do
|
754
754
|
before do
|
755
755
|
@search.options = @search.options.merge('id' => true)
|
756
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
|
757
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'}).to_return(:body => fixture('empty_array.json'))
|
756
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
757
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
758
758
|
end
|
759
759
|
it 'requests the correct resource' do
|
760
760
|
@search.timeline('7505382', 'twitter')
|
761
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :user_id => '7505382'})).to have_been_made
|
762
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'})).to have_been_made
|
761
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
|
762
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382', :include_entities => 'false'})).to have_been_made
|
763
763
|
end
|
764
764
|
end
|
765
765
|
context '--long' do
|
@@ -778,32 +778,32 @@ ID Posted at Screen name Text
|
|
778
778
|
context '--max-id' do
|
779
779
|
before do
|
780
780
|
@search.options = @search.options.merge('max_id' => 244_104_558_433_951_744)
|
781
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
|
781
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
782
782
|
end
|
783
783
|
it 'requests the correct resource' do
|
784
784
|
@search.timeline('sferik', 'twitter')
|
785
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244104558433951744'})).to have_been_made
|
785
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
|
786
786
|
end
|
787
787
|
end
|
788
788
|
context '--since-id' do
|
789
789
|
before do
|
790
790
|
@search.options = @search.options.merge('since_id' => 244_104_558_433_951_744)
|
791
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
|
792
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244099460672679937', :since_id => '244104558433951744'}).to_return(:body => fixture('empty_array.json'))
|
791
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('statuses.json'))
|
792
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244099460672679937', :since_id => '244104558433951744', :include_entities => 'false'}).to_return(:body => fixture('empty_array.json'))
|
793
793
|
end
|
794
794
|
it 'requests the correct resource' do
|
795
795
|
@search.timeline('sferik', 'twitter')
|
796
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :since_id => '244104558433951744'})).to have_been_made
|
797
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244099460672679937', :since_id => '244104558433951744'})).to have_been_made
|
796
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
|
797
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244099460672679937', :since_id => '244104558433951744', :include_entities => 'false'})).to have_been_made
|
798
798
|
end
|
799
799
|
end
|
800
800
|
context 'Twitter is down' do
|
801
801
|
it 'retries 3 times and then raise an error' do
|
802
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik', :count => '200'}).to_return(:status => 502)
|
802
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik', :count => '200', :include_entities => 'false'}).to_return(:status => 502)
|
803
803
|
expect do
|
804
804
|
@search.timeline('sferik', 'twitter')
|
805
805
|
end.to raise_error(Twitter::Error::BadGateway)
|
806
|
-
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik', :count => '200'})).to have_been_made.times(3)
|
806
|
+
expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik', :count => '200', :include_entities => 'false'})).to have_been_made.times(3)
|
807
807
|
end
|
808
808
|
end
|
809
809
|
end
|