twitter 4.4.1 → 4.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/lib/twitter/api/friends_and_followers.rb +8 -8
- data/lib/twitter/api/lists.rb +7 -7
- data/lib/twitter/api/undocumented.rb +2 -2
- data/lib/twitter/api/users.rb +3 -3
- data/lib/twitter/api/utils.rb +3 -3
- data/lib/twitter/core_ext/kernel.rb +0 -4
- data/lib/twitter/direct_message.rb +1 -0
- data/lib/twitter/version.rb +1 -1
- data/spec/fixtures/followers_list2.json +1 -0
- data/spec/fixtures/friends_list2.json +1 -0
- data/spec/fixtures/memberships2.json +1 -0
- data/spec/fixtures/subscriptions.json +1 -1
- data/spec/fixtures/subscriptions2.json +1 -0
- data/spec/fixtures/users_list2.json +1 -0
- data/spec/twitter/api/friends_and_followers_spec.rb +168 -26
- data/spec/twitter/api/lists_spec.rb +287 -122
- data/spec/twitter/api/search_spec.rb +4 -4
- data/spec/twitter/api/suggested_users_spec.rb +0 -35
- data/spec/twitter/api/undocumented_spec.rb +39 -0
- data/spec/twitter/api/users_spec.rb +57 -46
- data/twitter.gemspec +1 -7
- metadata +13 -99
@@ -25,11 +25,11 @@ describe Twitter::API::Lists do
|
|
25
25
|
describe "#list_timeline" do
|
26
26
|
context "with a screen name passed" do
|
27
27
|
before do
|
28
|
-
stub_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name =>
|
28
|
+
stub_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
29
29
|
end
|
30
30
|
it "requests the correct resource" do
|
31
31
|
@client.list_timeline("sferik", "presidents")
|
32
|
-
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name =>
|
32
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
33
33
|
end
|
34
34
|
it "returns the timeline for members of the specified list" do
|
35
35
|
tweets = @client.list_timeline("sferik", "presidents")
|
@@ -41,11 +41,11 @@ describe Twitter::API::Lists do
|
|
41
41
|
context "without a screen name passed" do
|
42
42
|
before do
|
43
43
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
44
|
-
stub_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name =>
|
44
|
+
stub_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
45
45
|
end
|
46
46
|
it "requests the correct resource" do
|
47
47
|
@client.list_timeline("presidents")
|
48
|
-
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name =>
|
48
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -53,11 +53,11 @@ describe Twitter::API::Lists do
|
|
53
53
|
describe "#list_remove_member" do
|
54
54
|
context "with a screen name passed" do
|
55
55
|
before do
|
56
|
-
stub_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name =>
|
56
|
+
stub_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
57
57
|
end
|
58
58
|
it "requests the correct resource" do
|
59
59
|
@client.list_remove_member("sferik", "presidents", 813286)
|
60
|
-
expect(a_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name =>
|
60
|
+
expect(a_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
61
61
|
end
|
62
62
|
it "returns the list" do
|
63
63
|
list = @client.list_remove_member("sferik", "presidents", 813286)
|
@@ -68,11 +68,11 @@ describe Twitter::API::Lists do
|
|
68
68
|
context "without a screen name passed" do
|
69
69
|
before do
|
70
70
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
71
|
-
stub_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name =>
|
71
|
+
stub_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
72
72
|
end
|
73
73
|
it "requests the correct resource" do
|
74
74
|
@client.list_remove_member("presidents", 813286)
|
75
|
-
expect(a_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name =>
|
75
|
+
expect(a_post("/1.1/lists/members/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -80,28 +80,67 @@ describe Twitter::API::Lists do
|
|
80
80
|
describe "#memberships" do
|
81
81
|
context "with a screen name passed" do
|
82
82
|
before do
|
83
|
-
stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name =>
|
83
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"}).to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
84
84
|
end
|
85
85
|
it "requests the correct resource" do
|
86
|
-
@client.memberships("
|
87
|
-
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name =>
|
86
|
+
@client.memberships("sferik")
|
87
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
88
88
|
end
|
89
89
|
it "returns the lists the specified user has been added to" do
|
90
|
-
memberships = @client.memberships("
|
90
|
+
memberships = @client.memberships("sferik")
|
91
91
|
expect(memberships).to be_a Twitter::Cursor
|
92
92
|
expect(memberships.lists).to be_an Array
|
93
93
|
expect(memberships.lists.first).to be_a Twitter::List
|
94
94
|
expect(memberships.lists.first.name).to eq "developer"
|
95
95
|
end
|
96
|
+
context "with all" do
|
97
|
+
before do
|
98
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("memberships2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
99
|
+
end
|
100
|
+
it "requests the correct resource" do
|
101
|
+
@client.memberships("sferik").all
|
102
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
103
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
context "with a user ID passed" do
|
108
|
+
before do
|
109
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"}).to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
110
|
+
end
|
111
|
+
it "requests the correct resource" do
|
112
|
+
@client.memberships(7505382)
|
113
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
114
|
+
end
|
115
|
+
context "with all" do
|
116
|
+
before do
|
117
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"}).to_return(:body => fixture("memberships2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
118
|
+
end
|
119
|
+
it "requests the correct resource" do
|
120
|
+
@client.memberships(7505382).all
|
121
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
122
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"})).to have_been_made
|
123
|
+
end
|
124
|
+
end
|
96
125
|
end
|
97
126
|
context "without a screen name passed" do
|
98
127
|
before do
|
99
128
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
100
|
-
stub_get("/1.1/lists/memberships.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
129
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"}).to_return(:body => fixture("memberships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
101
130
|
end
|
102
131
|
it "requests the correct resource" do
|
103
132
|
@client.memberships
|
104
|
-
expect(a_get("/1.1/lists/memberships.json").with(:query => {:cursor => "-1"})).to have_been_made
|
133
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
134
|
+
end
|
135
|
+
context "with all" do
|
136
|
+
before do
|
137
|
+
stub_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("memberships2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
138
|
+
end
|
139
|
+
it "requests the correct resource" do
|
140
|
+
@client.memberships.all
|
141
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
142
|
+
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
143
|
+
end
|
105
144
|
end
|
106
145
|
end
|
107
146
|
end
|
@@ -109,11 +148,11 @@ describe Twitter::API::Lists do
|
|
109
148
|
describe "#list_subscribers" do
|
110
149
|
context "with a screen name passed" do
|
111
150
|
before do
|
112
|
-
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name =>
|
151
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
113
152
|
end
|
114
153
|
it "requests the correct resource" do
|
115
154
|
@client.list_subscribers("sferik", "presidents")
|
116
|
-
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name =>
|
155
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
117
156
|
end
|
118
157
|
it "returns the subscribers of the specified list" do
|
119
158
|
list_subscribers = @client.list_subscribers("sferik", "presidents")
|
@@ -122,15 +161,54 @@ describe Twitter::API::Lists do
|
|
122
161
|
expect(list_subscribers.users.first).to be_a Twitter::User
|
123
162
|
expect(list_subscribers.users.first.id).to eq 7505382
|
124
163
|
end
|
164
|
+
context "with all" do
|
165
|
+
before do
|
166
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
167
|
+
end
|
168
|
+
it "requests the correct resource" do
|
169
|
+
@client.list_subscribers("sferik", "presidents").all
|
170
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
171
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
context "with a user ID passed" do
|
176
|
+
before do
|
177
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
178
|
+
end
|
179
|
+
it "requests the correct resource" do
|
180
|
+
@client.list_subscribers(7505382, "presidents")
|
181
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
182
|
+
end
|
183
|
+
context "with all" do
|
184
|
+
before do
|
185
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
186
|
+
end
|
187
|
+
it "requests the correct resource" do
|
188
|
+
@client.list_subscribers(7505382, "presidents").all
|
189
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
190
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
191
|
+
end
|
192
|
+
end
|
125
193
|
end
|
126
194
|
context "without a screen name passed" do
|
127
195
|
before do
|
128
196
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
129
|
-
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name =>
|
197
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
130
198
|
end
|
131
199
|
it "requests the correct resource" do
|
132
200
|
@client.list_subscribers("presidents")
|
133
|
-
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name =>
|
201
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
202
|
+
end
|
203
|
+
context "with all" do
|
204
|
+
before do
|
205
|
+
stub_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
206
|
+
end
|
207
|
+
it "requests the correct resource" do
|
208
|
+
@client.list_subscribers("presidents").all
|
209
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
210
|
+
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
211
|
+
end
|
134
212
|
end
|
135
213
|
end
|
136
214
|
end
|
@@ -138,11 +216,11 @@ describe Twitter::API::Lists do
|
|
138
216
|
describe "#list_subscribe" do
|
139
217
|
context "with a screen name passed" do
|
140
218
|
before do
|
141
|
-
stub_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name =>
|
219
|
+
stub_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
142
220
|
end
|
143
221
|
it "requests the correct resource" do
|
144
222
|
@client.list_subscribe("sferik", "presidents")
|
145
|
-
expect(a_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name =>
|
223
|
+
expect(a_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
146
224
|
end
|
147
225
|
it "returns the specified list" do
|
148
226
|
list = @client.list_subscribe("sferik", "presidents")
|
@@ -153,11 +231,11 @@ describe Twitter::API::Lists do
|
|
153
231
|
context "without a screen name passed" do
|
154
232
|
before do
|
155
233
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
156
|
-
stub_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name =>
|
234
|
+
stub_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
157
235
|
end
|
158
236
|
it "requests the correct resource" do
|
159
237
|
@client.list_subscribe("presidents")
|
160
|
-
expect(a_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name =>
|
238
|
+
expect(a_post("/1.1/lists/subscribers/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
161
239
|
end
|
162
240
|
end
|
163
241
|
end
|
@@ -165,13 +243,13 @@ describe Twitter::API::Lists do
|
|
165
243
|
describe "#list_subscriber?" do
|
166
244
|
context "with a screen name passed" do
|
167
245
|
before do
|
168
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
169
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
170
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
246
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
247
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "18755393"}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
248
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "12345678"}).to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
|
171
249
|
end
|
172
250
|
it "requests the correct resource" do
|
173
251
|
@client.list_subscriber?("sferik", "presidents", 813286)
|
174
|
-
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
252
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
175
253
|
end
|
176
254
|
it "returns true if the specified user subscribes to the specified list" do
|
177
255
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 813286)
|
@@ -188,49 +266,49 @@ describe Twitter::API::Lists do
|
|
188
266
|
end
|
189
267
|
context "with a owner ID passed" do
|
190
268
|
before do
|
191
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id =>
|
269
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
192
270
|
end
|
193
271
|
it "requests the correct resource" do
|
194
272
|
@client.list_subscriber?(12345678, "presidents", 813286)
|
195
|
-
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id =>
|
273
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
196
274
|
end
|
197
275
|
end
|
198
276
|
context "with a list ID passed" do
|
199
277
|
before do
|
200
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
278
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "12345678", :user_id => "813286"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
201
279
|
end
|
202
280
|
it "requests the correct resource" do
|
203
|
-
@client.list_subscriber?(
|
204
|
-
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
281
|
+
@client.list_subscriber?("sferik", 12345678, 813286)
|
282
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "12345678", :user_id => "813286"})).to have_been_made
|
205
283
|
end
|
206
284
|
end
|
207
285
|
context "with a list object passed" do
|
208
286
|
before do
|
209
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id =>
|
287
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => "7505382", :list_id => "12345678", :user_id => "813286"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
210
288
|
end
|
211
289
|
it "requests the correct resource" do
|
212
|
-
list = Twitter::List.new(:id => 12345678, :user => {:id => 7505382, :screen_name =>
|
290
|
+
list = Twitter::List.new(:id => 12345678, :user => {:id => 7505382, :screen_name => "sferik"})
|
213
291
|
@client.list_subscriber?(list, 813286)
|
214
|
-
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id =>
|
292
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_id => "7505382", :list_id => "12345678", :user_id => "813286"})).to have_been_made
|
215
293
|
end
|
216
294
|
end
|
217
295
|
context "with a screen name passed for user_to_check" do
|
218
296
|
before do
|
219
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
297
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :screen_name => "erebor"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
220
298
|
end
|
221
299
|
it "requests the correct resource" do
|
222
|
-
@client.list_subscriber?("sferik", "presidents",
|
223
|
-
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
300
|
+
@client.list_subscriber?("sferik", "presidents", "erebor")
|
301
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :screen_name => "erebor"})).to have_been_made
|
224
302
|
end
|
225
303
|
end
|
226
304
|
context "without a screen name passed" do
|
227
305
|
before do
|
228
306
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
229
|
-
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
307
|
+
stub_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
230
308
|
end
|
231
309
|
it "requests the correct resource" do
|
232
310
|
@client.list_subscriber?("presidents", 813286)
|
233
|
-
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name =>
|
311
|
+
expect(a_get("/1.1/lists/subscribers/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
234
312
|
end
|
235
313
|
end
|
236
314
|
end
|
@@ -238,11 +316,11 @@ describe Twitter::API::Lists do
|
|
238
316
|
describe "#list_unsubscribe" do
|
239
317
|
context "with a screen name passed" do
|
240
318
|
before do
|
241
|
-
stub_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name =>
|
319
|
+
stub_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
242
320
|
end
|
243
321
|
it "requests the correct resource" do
|
244
322
|
@client.list_unsubscribe("sferik", "presidents")
|
245
|
-
expect(a_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name =>
|
323
|
+
expect(a_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
246
324
|
end
|
247
325
|
it "returns the specified list" do
|
248
326
|
list = @client.list_unsubscribe("sferik", "presidents")
|
@@ -253,11 +331,11 @@ describe Twitter::API::Lists do
|
|
253
331
|
context "without a screen name passed" do
|
254
332
|
before do
|
255
333
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
256
|
-
stub_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name =>
|
334
|
+
stub_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
257
335
|
end
|
258
336
|
it "requests the correct resource" do
|
259
337
|
@client.list_unsubscribe("presidents")
|
260
|
-
expect(a_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name =>
|
338
|
+
expect(a_post("/1.1/lists/subscribers/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
261
339
|
end
|
262
340
|
end
|
263
341
|
end
|
@@ -265,11 +343,11 @@ describe Twitter::API::Lists do
|
|
265
343
|
describe "#list_add_members" do
|
266
344
|
context "with a screen name passed" do
|
267
345
|
before do
|
268
|
-
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name =>
|
346
|
+
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
269
347
|
end
|
270
348
|
it "requests the correct resource" do
|
271
349
|
@client.list_add_members("sferik", "presidents", [813286, 18755393])
|
272
|
-
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name =>
|
350
|
+
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"})).to have_been_made
|
273
351
|
end
|
274
352
|
it "returns the list" do
|
275
353
|
list = @client.list_add_members("sferik", "presidents", [813286, 18755393])
|
@@ -279,21 +357,21 @@ describe Twitter::API::Lists do
|
|
279
357
|
end
|
280
358
|
context "with a combination of member IDs and member screen names to add" do
|
281
359
|
before do
|
282
|
-
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name =>
|
360
|
+
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
283
361
|
end
|
284
362
|
it "requests the correct resource" do
|
285
|
-
@client.list_add_members(
|
286
|
-
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name =>
|
363
|
+
@client.list_add_members("sferik", "presidents", [813286, "pengwynn", 18755393, "erebor"])
|
364
|
+
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"})).to have_been_made
|
287
365
|
end
|
288
366
|
end
|
289
367
|
context "without a screen name passed" do
|
290
368
|
before do
|
291
369
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
292
|
-
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name =>
|
370
|
+
stub_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
293
371
|
end
|
294
372
|
it "requests the correct resource" do
|
295
373
|
@client.list_add_members("presidents", [813286, 18755393])
|
296
|
-
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name =>
|
374
|
+
expect(a_post("/1.1/lists/members/create_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"})).to have_been_made
|
297
375
|
end
|
298
376
|
end
|
299
377
|
end
|
@@ -301,13 +379,13 @@ describe Twitter::API::Lists do
|
|
301
379
|
describe "#list_member?" do
|
302
380
|
context "with a screen name passed" do
|
303
381
|
before do
|
304
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
305
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
306
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
382
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
383
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "65493023"}).to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"})
|
384
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "12345678"}).to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"})
|
307
385
|
end
|
308
386
|
it "requests the correct resource" do
|
309
387
|
@client.list_member?("sferik", "presidents", 813286)
|
310
|
-
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
388
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
311
389
|
end
|
312
390
|
it "returns true if user is a list member" do
|
313
391
|
list_member = @client.list_member?("sferik", "presidents", 813286)
|
@@ -324,49 +402,49 @@ describe Twitter::API::Lists do
|
|
324
402
|
end
|
325
403
|
context "with an owner ID passed" do
|
326
404
|
before do
|
327
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id =>
|
405
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
328
406
|
end
|
329
407
|
it "requests the correct resource" do
|
330
408
|
@client.list_member?(12345678, "presidents", 813286)
|
331
|
-
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id =>
|
409
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
332
410
|
end
|
333
411
|
end
|
334
412
|
context "with a list ID passed" do
|
335
413
|
before do
|
336
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
414
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "12345678", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
337
415
|
end
|
338
416
|
it "requests the correct resource" do
|
339
|
-
@client.list_member?(
|
340
|
-
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
417
|
+
@client.list_member?("sferik", 12345678, 813286)
|
418
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "12345678", :user_id => "813286"})).to have_been_made
|
341
419
|
end
|
342
420
|
end
|
343
421
|
context "with a list object passed" do
|
344
422
|
before do
|
345
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id =>
|
423
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :list_id => "12345678", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
346
424
|
end
|
347
425
|
it "requests the correct resource" do
|
348
|
-
list = Twitter::List.new(:id => 12345678, :user => {:id => 7505382, :screen_name =>
|
426
|
+
list = Twitter::List.new(:id => 12345678, :user => {:id => 7505382, :screen_name => "sferik"})
|
349
427
|
@client.list_member?(list, 813286)
|
350
|
-
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id =>
|
428
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_id => "7505382", :list_id => "12345678", :user_id => "813286"})).to have_been_made
|
351
429
|
end
|
352
430
|
end
|
353
431
|
context "with a screen name passed for user_to_check" do
|
354
432
|
before do
|
355
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
433
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :screen_name => "erebor"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"})
|
356
434
|
end
|
357
435
|
it "requests the correct resource" do
|
358
|
-
@client.list_member?("sferik", "presidents",
|
359
|
-
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
436
|
+
@client.list_member?("sferik", "presidents", "erebor")
|
437
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :screen_name => "erebor"})).to have_been_made
|
360
438
|
end
|
361
439
|
end
|
362
440
|
context "without a screen name passed" do
|
363
441
|
before do
|
364
442
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
365
|
-
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
443
|
+
stub_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"})
|
366
444
|
end
|
367
445
|
it "requests the correct resource" do
|
368
446
|
@client.list_member?("presidents", 813286)
|
369
|
-
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name =>
|
447
|
+
expect(a_get("/1.1/lists/members/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
370
448
|
end
|
371
449
|
end
|
372
450
|
end
|
@@ -374,11 +452,11 @@ describe Twitter::API::Lists do
|
|
374
452
|
describe "#list_members" do
|
375
453
|
context "with a screen name passed" do
|
376
454
|
before do
|
377
|
-
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name =>
|
455
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
378
456
|
end
|
379
457
|
it "requests the correct resource" do
|
380
458
|
@client.list_members("sferik", "presidents")
|
381
|
-
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name =>
|
459
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
382
460
|
end
|
383
461
|
it "returns the members of the specified list" do
|
384
462
|
list_members = @client.list_members("sferik", "presidents")
|
@@ -387,15 +465,54 @@ describe Twitter::API::Lists do
|
|
387
465
|
expect(list_members.users.first).to be_a Twitter::User
|
388
466
|
expect(list_members.users.first.id).to eq 7505382
|
389
467
|
end
|
468
|
+
context "with all" do
|
469
|
+
before do
|
470
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
471
|
+
end
|
472
|
+
it "requests the correct resource" do
|
473
|
+
@client.list_members("sferik", "presidents").all
|
474
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
475
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
476
|
+
end
|
477
|
+
end
|
478
|
+
end
|
479
|
+
context "with a user ID passed" do
|
480
|
+
before do
|
481
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
482
|
+
end
|
483
|
+
it "requests the correct resource" do
|
484
|
+
@client.list_members(7505382, "presidents")
|
485
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
486
|
+
end
|
487
|
+
context "with all" do
|
488
|
+
before do
|
489
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
490
|
+
end
|
491
|
+
it "requests the correct resource" do
|
492
|
+
@client.list_members(7505382, "presidents").all
|
493
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
494
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
495
|
+
end
|
496
|
+
end
|
390
497
|
end
|
391
498
|
context "without a screen name passed" do
|
392
499
|
before do
|
393
500
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
394
|
-
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name =>
|
501
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"}).to_return(:body => fixture("users_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
395
502
|
end
|
396
503
|
it "requests the correct resource" do
|
397
504
|
@client.list_members("presidents")
|
398
|
-
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name =>
|
505
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
506
|
+
end
|
507
|
+
context "with all" do
|
508
|
+
before do
|
509
|
+
stub_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"}).to_return(:body => fixture("users_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
510
|
+
end
|
511
|
+
it "requests the correct resource" do
|
512
|
+
@client.list_members("presidents").all
|
513
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
514
|
+
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
515
|
+
end
|
399
516
|
end
|
400
517
|
end
|
401
518
|
end
|
@@ -403,11 +520,11 @@ describe Twitter::API::Lists do
|
|
403
520
|
describe "#list_add_member" do
|
404
521
|
context "with a screen name passed" do
|
405
522
|
before do
|
406
|
-
stub_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name =>
|
523
|
+
stub_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
407
524
|
end
|
408
525
|
it "requests the correct resource" do
|
409
526
|
@client.list_add_member("sferik", "presidents", 813286)
|
410
|
-
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name =>
|
527
|
+
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
411
528
|
end
|
412
529
|
it "returns the list" do
|
413
530
|
list = @client.list_add_member("sferik", "presidents", 813286)
|
@@ -418,11 +535,11 @@ describe Twitter::API::Lists do
|
|
418
535
|
context "without a screen name passed" do
|
419
536
|
before do
|
420
537
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
421
|
-
stub_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name =>
|
538
|
+
stub_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
422
539
|
end
|
423
540
|
it "requests the correct resource" do
|
424
541
|
@client.list_add_member("presidents", 813286)
|
425
|
-
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name =>
|
542
|
+
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
426
543
|
end
|
427
544
|
end
|
428
545
|
end
|
@@ -430,11 +547,11 @@ describe Twitter::API::Lists do
|
|
430
547
|
describe "#list_destroy" do
|
431
548
|
context "with a screen name passed" do
|
432
549
|
before do
|
433
|
-
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name =>
|
550
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
434
551
|
end
|
435
552
|
it "requests the correct resource" do
|
436
553
|
@client.list_destroy("sferik", "presidents")
|
437
|
-
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name =>
|
554
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
438
555
|
end
|
439
556
|
it "returns the deleted list" do
|
440
557
|
list = @client.list_destroy("sferik", "presidents")
|
@@ -445,30 +562,30 @@ describe Twitter::API::Lists do
|
|
445
562
|
context "without a screen name passed" do
|
446
563
|
before do
|
447
564
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
448
|
-
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name =>
|
565
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
449
566
|
end
|
450
567
|
it "requests the correct resource" do
|
451
568
|
@client.list_destroy("presidents")
|
452
|
-
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name =>
|
569
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
453
570
|
end
|
454
571
|
end
|
455
572
|
context "with a list ID passed" do
|
456
573
|
before do
|
457
|
-
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name =>
|
574
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
458
575
|
end
|
459
576
|
it "requests the correct resource" do
|
460
577
|
@client.list_destroy("sferik", 12345678)
|
461
|
-
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name =>
|
578
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678"})).to have_been_made
|
462
579
|
end
|
463
580
|
end
|
464
581
|
context "with a list object passed" do
|
465
582
|
before do
|
466
|
-
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_id =>
|
583
|
+
stub_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "12345678"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
467
584
|
end
|
468
585
|
it "requests the correct resource" do
|
469
|
-
list = Twitter::List.new(:id =>
|
586
|
+
list = Twitter::List.new(:id => "12345678", :user => {:id => 7505382, :screen_name => "sferik"})
|
470
587
|
@client.list_destroy(list)
|
471
|
-
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id =>
|
588
|
+
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "12345678"})).to have_been_made
|
472
589
|
end
|
473
590
|
end
|
474
591
|
end
|
@@ -476,11 +593,11 @@ describe Twitter::API::Lists do
|
|
476
593
|
describe "#list_update" do
|
477
594
|
context "with a screen name passed" do
|
478
595
|
before do
|
479
|
-
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name =>
|
596
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
480
597
|
end
|
481
598
|
it "requests the correct resource" do
|
482
599
|
@client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
|
483
|
-
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name =>
|
600
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"})).to have_been_made
|
484
601
|
end
|
485
602
|
it "returns the updated list" do
|
486
603
|
list = @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
|
@@ -491,30 +608,30 @@ describe Twitter::API::Lists do
|
|
491
608
|
context "without a screen name passed" do
|
492
609
|
before do
|
493
610
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
494
|
-
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name =>
|
611
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
495
612
|
end
|
496
613
|
it "requests the correct resource" do
|
497
614
|
@client.list_update("presidents", :description => "Presidents of the United States of America")
|
498
|
-
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name =>
|
615
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :description => "Presidents of the United States of America"})).to have_been_made
|
499
616
|
end
|
500
617
|
end
|
501
618
|
context "with a list ID passed" do
|
502
619
|
before do
|
503
|
-
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name =>
|
620
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
504
621
|
end
|
505
622
|
it "requests the correct resource" do
|
506
623
|
@client.list_update("sferik", 12345678, :description => "Presidents of the United States of America")
|
507
|
-
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name =>
|
624
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678", :description => "Presidents of the United States of America"})).to have_been_made
|
508
625
|
end
|
509
626
|
end
|
510
627
|
context "with a list object passed" do
|
511
628
|
before do
|
512
|
-
stub_post("/1.1/lists/update.json").with(:body => {:owner_id =>
|
629
|
+
stub_post("/1.1/lists/update.json").with(:body => {:owner_id => "7505382", :list_id => "12345678", :description => "Presidents of the United States of America"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
513
630
|
end
|
514
631
|
it "requests the correct resource" do
|
515
|
-
list = Twitter::List.new(:id =>
|
632
|
+
list = Twitter::List.new(:id => "12345678", :user => {:id => 7505382, :screen_name => "sferik"})
|
516
633
|
@client.list_update(list, :description => "Presidents of the United States of America")
|
517
|
-
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_id =>
|
634
|
+
expect(a_post("/1.1/lists/update.json").with(:body => {:owner_id => "7505382", :list_id => "12345678", :description => "Presidents of the United States of America"})).to have_been_made
|
518
635
|
end
|
519
636
|
end
|
520
637
|
end
|
@@ -537,11 +654,11 @@ describe Twitter::API::Lists do
|
|
537
654
|
describe "#list" do
|
538
655
|
context "with a screen name passed" do
|
539
656
|
before do
|
540
|
-
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name =>
|
657
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
541
658
|
end
|
542
659
|
it "requests the correct resource" do
|
543
660
|
@client.list("sferik", "presidents")
|
544
|
-
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name =>
|
661
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
545
662
|
end
|
546
663
|
it "returns the updated list" do
|
547
664
|
list = @client.list("sferik", "presidents")
|
@@ -551,50 +668,50 @@ describe Twitter::API::Lists do
|
|
551
668
|
end
|
552
669
|
context "with a user ID passed" do
|
553
670
|
before do
|
554
|
-
stub_get("/1.1/lists/show.json").with(:query => {:owner_id =>
|
671
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
555
672
|
end
|
556
673
|
it "requests the correct resource" do
|
557
|
-
@client.list(12345678,
|
558
|
-
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id =>
|
674
|
+
@client.list(12345678, "presidents")
|
675
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents"})).to have_been_made
|
559
676
|
end
|
560
677
|
end
|
561
678
|
context "with a user object passed" do
|
562
679
|
before do
|
563
|
-
stub_get("/1.1/lists/show.json").with(:query => {:owner_id =>
|
680
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
564
681
|
end
|
565
682
|
it "requests the correct resource" do
|
566
|
-
user = Twitter::User.new(:id =>
|
567
|
-
@client.list(user,
|
568
|
-
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id =>
|
683
|
+
user = Twitter::User.new(:id => "12345678")
|
684
|
+
@client.list(user, "presidents")
|
685
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id => "12345678", :slug => "presidents"})).to have_been_made
|
569
686
|
end
|
570
687
|
end
|
571
688
|
context "without a screen name passed" do
|
572
689
|
before do
|
573
690
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
574
|
-
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name =>
|
691
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
575
692
|
end
|
576
693
|
it "requests the correct resource" do
|
577
694
|
@client.list("presidents")
|
578
|
-
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name =>
|
695
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
579
696
|
end
|
580
697
|
end
|
581
698
|
context "with a list ID passed" do
|
582
699
|
before do
|
583
|
-
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name =>
|
700
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "12345678"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
584
701
|
end
|
585
702
|
it "requests the correct resource" do
|
586
703
|
@client.list("sferik", 12345678)
|
587
|
-
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name =>
|
704
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "12345678"})).to have_been_made
|
588
705
|
end
|
589
706
|
end
|
590
707
|
context "with a list object passed" do
|
591
708
|
before do
|
592
|
-
stub_get("/1.1/lists/show.json").with(:query => {:owner_id =>
|
709
|
+
stub_get("/1.1/lists/show.json").with(:query => {:owner_id => "7505382", :list_id => "12345678"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
593
710
|
end
|
594
711
|
it "requests the correct resource" do
|
595
|
-
list = Twitter::List.new(:id =>
|
712
|
+
list = Twitter::List.new(:id => "12345678", :user => {:id => 7505382, :screen_name => "sferik"})
|
596
713
|
@client.list(list)
|
597
|
-
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id =>
|
714
|
+
expect(a_get("/1.1/lists/show.json").with(:query => {:owner_id => "7505382", :list_id => "12345678"})).to have_been_made
|
598
715
|
end
|
599
716
|
end
|
600
717
|
end
|
@@ -602,28 +719,67 @@ describe Twitter::API::Lists do
|
|
602
719
|
describe "#subscriptions" do
|
603
720
|
context "with a screen name passed" do
|
604
721
|
before do
|
605
|
-
stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name =>
|
722
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"}).to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
606
723
|
end
|
607
724
|
it "requests the correct resource" do
|
608
|
-
@client.subscriptions("
|
609
|
-
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name =>
|
725
|
+
@client.subscriptions("sferik")
|
726
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
610
727
|
end
|
611
728
|
it "returns the lists the specified user follows" do
|
612
|
-
subscriptions = @client.subscriptions("
|
729
|
+
subscriptions = @client.subscriptions("sferik")
|
613
730
|
expect(subscriptions).to be_a Twitter::Cursor
|
614
731
|
expect(subscriptions.lists).to be_an Array
|
615
732
|
expect(subscriptions.lists.first).to be_a Twitter::List
|
616
733
|
expect(subscriptions.lists.first.name).to eq "Rubyists"
|
617
734
|
end
|
735
|
+
context "with all" do
|
736
|
+
before do
|
737
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("subscriptions2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
738
|
+
end
|
739
|
+
it "requests the correct resource" do
|
740
|
+
@client.subscriptions("sferik").all
|
741
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
742
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
743
|
+
end
|
744
|
+
end
|
745
|
+
end
|
746
|
+
context "with a user ID passed" do
|
747
|
+
before do
|
748
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"}).to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
749
|
+
end
|
750
|
+
it "requests the correct resource" do
|
751
|
+
@client.subscriptions(7505382)
|
752
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
753
|
+
end
|
754
|
+
context "with all" do
|
755
|
+
before do
|
756
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"}).to_return(:body => fixture("subscriptions2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
757
|
+
end
|
758
|
+
it "requests the correct resource" do
|
759
|
+
@client.subscriptions(7505382).all
|
760
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
761
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"})).to have_been_made
|
762
|
+
end
|
763
|
+
end
|
618
764
|
end
|
619
765
|
context "without a screen name passed" do
|
620
766
|
before do
|
621
767
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
622
|
-
stub_get("/1.1/lists/subscriptions.json").with(:query => {:cursor => "-1"}).to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
768
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"}).to_return(:body => fixture("subscriptions.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
623
769
|
end
|
624
770
|
it "requests the correct resource" do
|
625
771
|
@client.subscriptions
|
626
|
-
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:cursor => "-1"})).to have_been_made
|
772
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
773
|
+
end
|
774
|
+
context "with all" do
|
775
|
+
before do
|
776
|
+
stub_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"}).to_return(:body => fixture("subscriptions2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
777
|
+
end
|
778
|
+
it "requests the correct resource" do
|
779
|
+
@client.subscriptions.all
|
780
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
781
|
+
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
782
|
+
end
|
627
783
|
end
|
628
784
|
end
|
629
785
|
end
|
@@ -631,11 +787,11 @@ describe Twitter::API::Lists do
|
|
631
787
|
describe "#list_remove_members" do
|
632
788
|
context "with a screen name passed" do
|
633
789
|
before do
|
634
|
-
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name =>
|
790
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
635
791
|
end
|
636
792
|
it "requests the correct resource" do
|
637
793
|
@client.list_remove_members("sferik", "presidents", [813286, 18755393])
|
638
|
-
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name =>
|
794
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"})).to have_been_made
|
639
795
|
end
|
640
796
|
it "returns the list" do
|
641
797
|
list = @client.list_remove_members("sferik", "presidents", [813286, 18755393])
|
@@ -643,23 +799,32 @@ describe Twitter::API::Lists do
|
|
643
799
|
expect(list.name).to eq "presidents"
|
644
800
|
end
|
645
801
|
end
|
802
|
+
context "with a user ID passed" do
|
803
|
+
before do
|
804
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_id => "7505382", :slug => "presidents", :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
805
|
+
end
|
806
|
+
it "requests the correct resource" do
|
807
|
+
@client.list_remove_members(7505382, "presidents", [813286, 18755393])
|
808
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_id => "7505382", :slug => "presidents", :user_id => "813286,18755393"})).to have_been_made
|
809
|
+
end
|
810
|
+
end
|
646
811
|
context "with a combination of member IDs and member screen names to add" do
|
647
812
|
before do
|
648
|
-
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name =>
|
813
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
649
814
|
end
|
650
815
|
it "requests the correct resource" do
|
651
|
-
@client.list_remove_members(
|
652
|
-
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name =>
|
816
|
+
@client.list_remove_members("sferik", "presidents", [813286, "pengwynn", 18755393, "erebor"])
|
817
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"})).to have_been_made
|
653
818
|
end
|
654
819
|
end
|
655
820
|
context "without a screen name passed" do
|
656
821
|
before do
|
657
822
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
658
|
-
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name =>
|
823
|
+
stub_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
659
824
|
end
|
660
825
|
it "requests the correct resource" do
|
661
826
|
@client.list_remove_members("presidents", [813286, 18755393])
|
662
|
-
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name =>
|
827
|
+
expect(a_post("/1.1/lists/members/destroy_all.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286,18755393"})).to have_been_made
|
663
828
|
end
|
664
829
|
end
|
665
830
|
end
|