twitter 4.8.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +36 -0
- data/CONTRIBUTING.md +13 -15
- data/LICENSE.md +1 -1
- data/README.md +401 -261
- data/Rakefile +6 -0
- data/lib/twitter/arguments.rb +14 -0
- data/lib/twitter/base.rb +109 -89
- data/lib/twitter/client.rb +38 -115
- data/lib/twitter/configuration.rb +5 -2
- data/lib/twitter/core_ext/kernel.rb +5 -1
- data/lib/twitter/creatable.rb +7 -4
- data/lib/twitter/cursor.rb +57 -45
- data/lib/twitter/direct_message.rb +2 -11
- data/lib/twitter/entity/uri.rb +14 -0
- data/lib/twitter/enumerable.rb +15 -0
- data/lib/twitter/error/already_favorited.rb +1 -1
- data/lib/twitter/error/already_posted.rb +10 -0
- data/lib/twitter/error/already_retweeted.rb +1 -1
- data/lib/twitter/error/bad_gateway.rb +2 -3
- data/lib/twitter/error/bad_request.rb +2 -2
- data/lib/twitter/error/forbidden.rb +2 -2
- data/lib/twitter/error/gateway_timeout.rb +2 -3
- data/lib/twitter/error/internal_server_error.rb +2 -3
- data/lib/twitter/error/not_acceptable.rb +2 -2
- data/lib/twitter/error/not_found.rb +2 -2
- data/lib/twitter/error/service_unavailable.rb +2 -3
- data/lib/twitter/error/too_many_requests.rb +2 -2
- data/lib/twitter/error/unauthorized.rb +2 -2
- data/lib/twitter/error/unprocessable_entity.rb +2 -2
- data/lib/twitter/error.rb +65 -14
- data/lib/twitter/factory.rb +13 -12
- data/lib/twitter/geo.rb +2 -7
- data/lib/twitter/geo_factory.rb +11 -7
- data/lib/twitter/geo_results.rb +40 -0
- data/lib/twitter/identity.rb +4 -34
- data/lib/twitter/list.rb +21 -4
- data/lib/twitter/media/photo.rb +6 -4
- data/lib/twitter/media_factory.rb +11 -7
- data/lib/twitter/null_object.rb +25 -0
- data/lib/twitter/oembed.rb +3 -2
- data/lib/twitter/place.rb +15 -15
- data/lib/twitter/profile_banner.rb +3 -2
- data/lib/twitter/rate_limit.rb +4 -17
- data/lib/twitter/relationship.rb +2 -19
- data/lib/twitter/rest/api/direct_messages.rb +138 -0
- data/lib/twitter/rest/api/favorites.rb +115 -0
- data/lib/twitter/rest/api/friends_and_followers.rb +287 -0
- data/lib/twitter/rest/api/help.rb +58 -0
- data/lib/twitter/rest/api/lists.rb +498 -0
- data/lib/twitter/rest/api/oauth.rb +62 -0
- data/lib/twitter/rest/api/places_and_geo.rb +86 -0
- data/lib/twitter/rest/api/saved_searches.rb +93 -0
- data/lib/twitter/rest/api/search.rb +37 -0
- data/lib/twitter/rest/api/spam_reporting.rb +29 -0
- data/lib/twitter/rest/api/suggested_users.rb +51 -0
- data/lib/twitter/rest/api/timelines.rb +202 -0
- data/lib/twitter/rest/api/trends.rb +58 -0
- data/lib/twitter/rest/api/tweets.rb +291 -0
- data/lib/twitter/rest/api/undocumented.rb +52 -0
- data/lib/twitter/rest/api/users.rb +383 -0
- data/lib/twitter/rest/api/utils.rb +246 -0
- data/lib/twitter/rest/client.rb +175 -0
- data/lib/twitter/rest/request/multipart_with_file.rb +36 -0
- data/lib/twitter/rest/response/parse_error_json.rb +15 -0
- data/lib/twitter/rest/response/parse_json.rb +31 -0
- data/lib/twitter/{response → rest/response}/raise_error.rb +8 -11
- data/lib/twitter/search_results.rb +37 -21
- data/lib/twitter/settings.rb +1 -6
- data/lib/twitter/size.rb +2 -15
- data/lib/twitter/streaming/client.rb +89 -0
- data/lib/twitter/streaming/connection.rb +22 -0
- data/lib/twitter/streaming/event.rb +35 -0
- data/lib/twitter/streaming/friend_list.rb +13 -0
- data/lib/twitter/streaming/message_parser.rb +18 -0
- data/lib/twitter/streaming/response.rb +34 -0
- data/lib/twitter/suggestion.rb +5 -8
- data/lib/twitter/token.rb +11 -1
- data/lib/twitter/trend.rb +4 -8
- data/lib/twitter/trend_results.rb +65 -0
- data/lib/twitter/tweet.rb +43 -92
- data/lib/twitter/user.rb +72 -47
- data/lib/twitter/version.rb +4 -4
- data/lib/twitter.rb +4 -39
- data/spec/fixtures/already_posted.json +1 -0
- data/spec/fixtures/ids_list.json +1 -1
- data/spec/fixtures/ids_list2.json +1 -1
- data/spec/fixtures/request_token.txt +6 -0
- data/spec/fixtures/search.json +1 -1
- data/spec/fixtures/search_malformed.json +1 -1
- data/spec/fixtures/track_streaming.json +3 -0
- data/spec/fixtures/track_streaming_user.json +5 -0
- data/spec/helper.rb +8 -13
- data/spec/twitter/base_spec.rb +13 -103
- data/spec/twitter/basic_user_spec.rb +3 -3
- data/spec/twitter/configuration_spec.rb +1 -1
- data/spec/twitter/cursor_spec.rb +17 -35
- data/spec/twitter/direct_message_spec.rb +44 -11
- data/spec/twitter/entity/uri_spec.rb +75 -0
- data/spec/twitter/error_spec.rb +59 -11
- data/spec/twitter/geo/point_spec.rb +6 -6
- data/spec/twitter/geo/polygon_spec.rb +5 -5
- data/spec/twitter/geo_factory_spec.rb +4 -4
- data/spec/twitter/geo_results_spec.rb +35 -0
- data/spec/twitter/geo_spec.rb +6 -6
- data/spec/twitter/identifiable_spec.rb +5 -26
- data/spec/twitter/list_spec.rb +54 -11
- data/spec/twitter/media/photo_spec.rb +122 -6
- data/spec/twitter/media_factory_spec.rb +3 -3
- data/spec/twitter/null_object_spec.rb +27 -0
- data/spec/twitter/oembed_spec.rb +69 -45
- data/spec/twitter/place_spec.rb +84 -28
- data/spec/twitter/profile_banner_spec.rb +1 -1
- data/spec/twitter/rate_limit_spec.rb +8 -25
- data/spec/twitter/relationship_spec.rb +26 -12
- data/spec/twitter/{api → rest/api}/direct_messages_spec.rb +28 -15
- data/spec/twitter/{api → rest/api}/favorites_spec.rb +80 -7
- data/spec/twitter/{api → rest/api}/friends_and_followers_spec.rb +121 -152
- data/spec/twitter/{api → rest/api}/geo_spec.rb +9 -23
- data/spec/twitter/{api → rest/api}/help_spec.rb +6 -6
- data/spec/twitter/{api → rest/api}/lists_spec.rb +116 -95
- data/spec/twitter/{api → rest/api}/oauth_spec.rb +21 -10
- data/spec/twitter/{api → rest/api}/saved_searches_spec.rb +13 -13
- data/spec/twitter/{api → rest/api}/search_spec.rb +8 -9
- data/spec/twitter/{api → rest/api}/spam_reporting_spec.rb +3 -3
- data/spec/twitter/{api → rest/api}/suggested_users_spec.rb +5 -5
- data/spec/twitter/{api → rest/api}/timelines_spec.rb +9 -9
- data/spec/twitter/{api → rest/api}/trends_spec.rb +6 -6
- data/spec/twitter/rest/api/tweets_spec.rb +503 -0
- data/spec/twitter/{api → rest/api}/undocumented_spec.rb +19 -45
- data/spec/twitter/{api → rest/api}/users_spec.rb +64 -39
- data/spec/twitter/rest/client_spec.rb +193 -0
- data/spec/twitter/saved_search_spec.rb +14 -3
- data/spec/twitter/search_results_spec.rb +32 -45
- data/spec/twitter/settings_spec.rb +17 -6
- data/spec/twitter/size_spec.rb +5 -15
- data/spec/twitter/source_user_spec.rb +3 -3
- data/spec/twitter/streaming/client_spec.rb +92 -0
- data/spec/twitter/streaming/event_spec.rb +45 -0
- data/spec/twitter/suggestion_spec.rb +5 -15
- data/spec/twitter/target_user_spec.rb +3 -3
- data/spec/twitter/token_spec.rb +16 -0
- data/spec/twitter/trend_results_spec.rb +89 -0
- data/spec/twitter/trend_spec.rb +26 -13
- data/spec/twitter/tweet_spec.rb +137 -124
- data/spec/twitter/user_spec.rb +139 -80
- data/spec/twitter_spec.rb +0 -119
- data/twitter.gemspec +12 -6
- data.tar.gz.sig +0 -0
- metadata +197 -138
- metadata.gz.sig +0 -0
- data/lib/twitter/action/favorite.rb +0 -19
- data/lib/twitter/action/follow.rb +0 -30
- data/lib/twitter/action/list_member_added.rb +0 -39
- data/lib/twitter/action/mention.rb +0 -46
- data/lib/twitter/action/reply.rb +0 -27
- data/lib/twitter/action/retweet.rb +0 -27
- data/lib/twitter/action/tweet.rb +0 -20
- data/lib/twitter/action_factory.rb +0 -22
- data/lib/twitter/api/arguments.rb +0 -13
- data/lib/twitter/api/direct_messages.rb +0 -148
- data/lib/twitter/api/favorites.rb +0 -126
- data/lib/twitter/api/friends_and_followers.rb +0 -334
- data/lib/twitter/api/help.rb +0 -64
- data/lib/twitter/api/lists.rb +0 -618
- data/lib/twitter/api/oauth.rb +0 -44
- data/lib/twitter/api/places_and_geo.rb +0 -121
- data/lib/twitter/api/saved_searches.rb +0 -99
- data/lib/twitter/api/search.rb +0 -37
- data/lib/twitter/api/spam_reporting.rb +0 -30
- data/lib/twitter/api/suggested_users.rb +0 -55
- data/lib/twitter/api/timelines.rb +0 -214
- data/lib/twitter/api/trends.rb +0 -63
- data/lib/twitter/api/tweets.rb +0 -304
- data/lib/twitter/api/undocumented.rb +0 -97
- data/lib/twitter/api/users.rb +0 -439
- data/lib/twitter/api/utils.rb +0 -187
- data/lib/twitter/configurable.rb +0 -96
- data/lib/twitter/default.rb +0 -102
- data/lib/twitter/entity/url.rb +0 -9
- data/lib/twitter/error/client_error.rb +0 -35
- data/lib/twitter/error/decode_error.rb +0 -9
- data/lib/twitter/error/identity_map_key_error.rb +0 -9
- data/lib/twitter/error/server_error.rb +0 -28
- data/lib/twitter/exceptable.rb +0 -36
- data/lib/twitter/identity_map.rb +0 -22
- data/lib/twitter/request/multipart_with_file.rb +0 -34
- data/lib/twitter/response/parse_json.rb +0 -25
- data/spec/fixtures/about_me.json +0 -1
- data/spec/fixtures/activity_summary.json +0 -1
- data/spec/fixtures/bad_gateway.json +0 -1
- data/spec/fixtures/bad_request.json +0 -1
- data/spec/fixtures/by_friends.json +0 -1
- data/spec/fixtures/end_session.json +0 -1
- data/spec/fixtures/forbidden.json +0 -1
- data/spec/fixtures/internal_server_error.json +0 -1
- data/spec/fixtures/not_acceptable.json +0 -1
- data/spec/fixtures/phoenix_search.phoenix +0 -1
- data/spec/fixtures/resolve.json +0 -1
- data/spec/fixtures/service_unavailable.json +0 -1
- data/spec/fixtures/totals.json +0 -1
- data/spec/fixtures/trends.json +0 -1
- data/spec/fixtures/unauthorized.json +0 -1
- data/spec/fixtures/video_facets.json +0 -1
- data/spec/twitter/action/favorite_spec.rb +0 -29
- data/spec/twitter/action/follow_spec.rb +0 -29
- data/spec/twitter/action/list_member_added_spec.rb +0 -41
- data/spec/twitter/action/mention_spec.rb +0 -52
- data/spec/twitter/action/reply_spec.rb +0 -41
- data/spec/twitter/action/retweet_spec.rb +0 -41
- data/spec/twitter/action_factory_spec.rb +0 -35
- data/spec/twitter/action_spec.rb +0 -16
- data/spec/twitter/api/tweets_spec.rb +0 -285
- data/spec/twitter/client_spec.rb +0 -223
- data/spec/twitter/error/client_error_spec.rb +0 -23
- data/spec/twitter/error/server_error_spec.rb +0 -20
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require 'helper'
|
|
2
2
|
|
|
3
|
-
describe Twitter::API::Lists do
|
|
3
|
+
describe Twitter::REST::API::Lists do
|
|
4
4
|
|
|
5
5
|
before do
|
|
6
|
-
@client = Twitter::Client.new
|
|
6
|
+
@client = Twitter::REST::Client.new(:consumer_key => "CK", :consumer_secret => "CS", :access_token => "AT", :access_token_secret => "AS")
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
describe "#lists" do
|
|
@@ -18,7 +18,7 @@ describe Twitter::API::Lists do
|
|
|
18
18
|
lists = @client.lists
|
|
19
19
|
expect(lists).to be_an Array
|
|
20
20
|
expect(lists.first).to be_a Twitter::List
|
|
21
|
-
expect(lists.first.name).to eq
|
|
21
|
+
expect(lists.first.name).to eq("Rubyists")
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -35,7 +35,34 @@ describe Twitter::API::Lists do
|
|
|
35
35
|
tweets = @client.list_timeline("sferik", "presidents")
|
|
36
36
|
expect(tweets).to be_an Array
|
|
37
37
|
expect(tweets.first).to be_a Twitter::Tweet
|
|
38
|
-
expect(tweets.first.text).to eq
|
|
38
|
+
expect(tweets.first.text).to eq("Happy Birthday @imdane. Watch out for those @rally pranksters!")
|
|
39
|
+
end
|
|
40
|
+
context "with a URI object passed" do
|
|
41
|
+
it "requests the correct resource" do
|
|
42
|
+
list = URI.parse("https://twitter.com/sferik/presidents")
|
|
43
|
+
@client.list_timeline(list)
|
|
44
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
context "with a URI string passed" do
|
|
48
|
+
it "requests the correct resource" do
|
|
49
|
+
@client.list_timeline("https://twitter.com/sferik/presidents")
|
|
50
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
context "with URI objects passed" do
|
|
54
|
+
it "requests the correct resource" do
|
|
55
|
+
user = URI.parse("https://twitter.com/sferik")
|
|
56
|
+
list = URI.parse("https://twitter.com/sferik/presidents")
|
|
57
|
+
@client.list_timeline(user, list)
|
|
58
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
context "with URI strings passed" do
|
|
62
|
+
it "requests the correct resource" do
|
|
63
|
+
@client.list_timeline("https://twitter.com/sferik", "https://twitter.com/sferik/presidents")
|
|
64
|
+
expect(a_get("/1.1/lists/statuses.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
|
65
|
+
end
|
|
39
66
|
end
|
|
40
67
|
end
|
|
41
68
|
context "without a screen name passed" do
|
|
@@ -50,19 +77,19 @@ describe Twitter::API::Lists do
|
|
|
50
77
|
end
|
|
51
78
|
end
|
|
52
79
|
|
|
53
|
-
describe "#
|
|
80
|
+
describe "#remove_list_member" do
|
|
54
81
|
context "with a screen name passed" do
|
|
55
82
|
before do
|
|
56
83
|
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
84
|
end
|
|
58
85
|
it "requests the correct resource" do
|
|
59
|
-
@client.
|
|
86
|
+
@client.remove_list_member("sferik", "presidents", 813286)
|
|
60
87
|
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
88
|
end
|
|
62
89
|
it "returns the list" do
|
|
63
|
-
list = @client.
|
|
90
|
+
list = @client.remove_list_member("sferik", "presidents", 813286)
|
|
64
91
|
expect(list).to be_a Twitter::List
|
|
65
|
-
expect(list.name).to eq
|
|
92
|
+
expect(list.name).to eq("presidents")
|
|
66
93
|
end
|
|
67
94
|
end
|
|
68
95
|
context "without a screen name passed" do
|
|
@@ -71,7 +98,7 @@ describe Twitter::API::Lists do
|
|
|
71
98
|
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
99
|
end
|
|
73
100
|
it "requests the correct resource" do
|
|
74
|
-
@client.
|
|
101
|
+
@client.remove_list_member("presidents", 813286)
|
|
75
102
|
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
103
|
end
|
|
77
104
|
end
|
|
@@ -89,16 +116,15 @@ describe Twitter::API::Lists do
|
|
|
89
116
|
it "returns the lists the specified user has been added to" do
|
|
90
117
|
memberships = @client.memberships("sferik")
|
|
91
118
|
expect(memberships).to be_a Twitter::Cursor
|
|
92
|
-
expect(memberships.
|
|
93
|
-
expect(memberships.
|
|
94
|
-
expect(memberships.lists.first.name).to eq "developer"
|
|
119
|
+
expect(memberships.first).to be_a Twitter::List
|
|
120
|
+
expect(memberships.first.name).to eq("developer")
|
|
95
121
|
end
|
|
96
|
-
context "with
|
|
122
|
+
context "with each" do
|
|
97
123
|
before do
|
|
98
124
|
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
125
|
end
|
|
100
126
|
it "requests the correct resource" do
|
|
101
|
-
@client.memberships("sferik").
|
|
127
|
+
@client.memberships("sferik").each{}
|
|
102
128
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
103
129
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
|
104
130
|
end
|
|
@@ -112,12 +138,12 @@ describe Twitter::API::Lists do
|
|
|
112
138
|
@client.memberships(7505382)
|
|
113
139
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
|
114
140
|
end
|
|
115
|
-
context "with
|
|
141
|
+
context "with each" do
|
|
116
142
|
before do
|
|
117
143
|
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
144
|
end
|
|
119
145
|
it "requests the correct resource" do
|
|
120
|
-
@client.memberships(7505382).
|
|
146
|
+
@client.memberships(7505382).each{}
|
|
121
147
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
|
122
148
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"})).to have_been_made
|
|
123
149
|
end
|
|
@@ -132,12 +158,12 @@ describe Twitter::API::Lists do
|
|
|
132
158
|
@client.memberships
|
|
133
159
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
134
160
|
end
|
|
135
|
-
context "with
|
|
161
|
+
context "with each" do
|
|
136
162
|
before do
|
|
137
163
|
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
164
|
end
|
|
139
165
|
it "requests the correct resource" do
|
|
140
|
-
@client.memberships.
|
|
166
|
+
@client.memberships.each{}
|
|
141
167
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
142
168
|
expect(a_get("/1.1/lists/memberships.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
|
143
169
|
end
|
|
@@ -157,16 +183,15 @@ describe Twitter::API::Lists do
|
|
|
157
183
|
it "returns the subscribers of the specified list" do
|
|
158
184
|
list_subscribers = @client.list_subscribers("sferik", "presidents")
|
|
159
185
|
expect(list_subscribers).to be_a Twitter::Cursor
|
|
160
|
-
expect(list_subscribers.
|
|
161
|
-
expect(list_subscribers.
|
|
162
|
-
expect(list_subscribers.users.first.id).to eq 7505382
|
|
186
|
+
expect(list_subscribers.first).to be_a Twitter::User
|
|
187
|
+
expect(list_subscribers.first.id).to eq(7505382)
|
|
163
188
|
end
|
|
164
|
-
context "with
|
|
189
|
+
context "with each" do
|
|
165
190
|
before do
|
|
166
191
|
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
192
|
end
|
|
168
193
|
it "requests the correct resource" do
|
|
169
|
-
@client.list_subscribers("sferik", "presidents").
|
|
194
|
+
@client.list_subscribers("sferik", "presidents").each{}
|
|
170
195
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
171
196
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
|
172
197
|
end
|
|
@@ -180,12 +205,12 @@ describe Twitter::API::Lists do
|
|
|
180
205
|
@client.list_subscribers(7505382, "presidents")
|
|
181
206
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
182
207
|
end
|
|
183
|
-
context "with
|
|
208
|
+
context "with each" do
|
|
184
209
|
before do
|
|
185
210
|
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
211
|
end
|
|
187
212
|
it "requests the correct resource" do
|
|
188
|
-
@client.list_subscribers(7505382, "presidents").
|
|
213
|
+
@client.list_subscribers(7505382, "presidents").each{}
|
|
189
214
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
190
215
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
|
191
216
|
end
|
|
@@ -200,12 +225,12 @@ describe Twitter::API::Lists do
|
|
|
200
225
|
@client.list_subscribers("presidents")
|
|
201
226
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
202
227
|
end
|
|
203
|
-
context "with
|
|
228
|
+
context "with each" do
|
|
204
229
|
before do
|
|
205
230
|
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
231
|
end
|
|
207
232
|
it "requests the correct resource" do
|
|
208
|
-
@client.list_subscribers("presidents").
|
|
233
|
+
@client.list_subscribers("presidents").each{}
|
|
209
234
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
210
235
|
expect(a_get("/1.1/lists/subscribers.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
|
211
236
|
end
|
|
@@ -225,7 +250,7 @@ describe Twitter::API::Lists do
|
|
|
225
250
|
it "returns the specified list" do
|
|
226
251
|
list = @client.list_subscribe("sferik", "presidents")
|
|
227
252
|
expect(list).to be_a Twitter::List
|
|
228
|
-
expect(list.name).to eq
|
|
253
|
+
expect(list.name).to eq("presidents")
|
|
229
254
|
end
|
|
230
255
|
end
|
|
231
256
|
context "without a screen name passed" do
|
|
@@ -253,15 +278,15 @@ describe Twitter::API::Lists do
|
|
|
253
278
|
end
|
|
254
279
|
it "returns true if the specified user subscribes to the specified list" do
|
|
255
280
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 813286)
|
|
256
|
-
expect(list_subscriber).to
|
|
281
|
+
expect(list_subscriber).to be true
|
|
257
282
|
end
|
|
258
283
|
it "returns false if the specified user does not subscribe to the specified list" do
|
|
259
284
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 18755393)
|
|
260
|
-
expect(list_subscriber).to
|
|
285
|
+
expect(list_subscriber).to be false
|
|
261
286
|
end
|
|
262
287
|
it "returns false if user does not exist" do
|
|
263
288
|
list_subscriber = @client.list_subscriber?("sferik", "presidents", 12345678)
|
|
264
|
-
expect(list_subscriber).to
|
|
289
|
+
expect(list_subscriber).to be false
|
|
265
290
|
end
|
|
266
291
|
end
|
|
267
292
|
context "with a owner ID passed" do
|
|
@@ -325,7 +350,7 @@ describe Twitter::API::Lists do
|
|
|
325
350
|
it "returns the specified list" do
|
|
326
351
|
list = @client.list_unsubscribe("sferik", "presidents")
|
|
327
352
|
expect(list).to be_a Twitter::List
|
|
328
|
-
expect(list.name).to eq
|
|
353
|
+
expect(list.name).to eq("presidents")
|
|
329
354
|
end
|
|
330
355
|
end
|
|
331
356
|
context "without a screen name passed" do
|
|
@@ -340,19 +365,19 @@ describe Twitter::API::Lists do
|
|
|
340
365
|
end
|
|
341
366
|
end
|
|
342
367
|
|
|
343
|
-
describe "#
|
|
368
|
+
describe "#add_list_members" do
|
|
344
369
|
context "with a screen name passed" do
|
|
345
370
|
before do
|
|
346
371
|
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"})
|
|
347
372
|
end
|
|
348
373
|
it "requests the correct resource" do
|
|
349
|
-
@client.
|
|
374
|
+
@client.add_list_members("sferik", "presidents", [813286, 18755393])
|
|
350
375
|
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
|
|
351
376
|
end
|
|
352
377
|
it "returns the list" do
|
|
353
|
-
list = @client.
|
|
378
|
+
list = @client.add_list_members("sferik", "presidents", [813286, 18755393])
|
|
354
379
|
expect(list).to be_a Twitter::List
|
|
355
|
-
expect(list.name).to eq
|
|
380
|
+
expect(list.name).to eq("presidents")
|
|
356
381
|
end
|
|
357
382
|
end
|
|
358
383
|
context "with a combination of member IDs and member screen names to add" do
|
|
@@ -360,7 +385,7 @@ describe Twitter::API::Lists do
|
|
|
360
385
|
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"})
|
|
361
386
|
end
|
|
362
387
|
it "requests the correct resource" do
|
|
363
|
-
@client.
|
|
388
|
+
@client.add_list_members("sferik", "presidents", [813286, "pengwynn", 18755393, "erebor"])
|
|
364
389
|
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
|
|
365
390
|
end
|
|
366
391
|
end
|
|
@@ -370,7 +395,7 @@ describe Twitter::API::Lists do
|
|
|
370
395
|
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"})
|
|
371
396
|
end
|
|
372
397
|
it "requests the correct resource" do
|
|
373
|
-
@client.
|
|
398
|
+
@client.add_list_members("presidents", [813286, 18755393])
|
|
374
399
|
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
|
|
375
400
|
end
|
|
376
401
|
end
|
|
@@ -389,15 +414,15 @@ describe Twitter::API::Lists do
|
|
|
389
414
|
end
|
|
390
415
|
it "returns true if user is a list member" do
|
|
391
416
|
list_member = @client.list_member?("sferik", "presidents", 813286)
|
|
392
|
-
expect(list_member).to
|
|
417
|
+
expect(list_member).to be true
|
|
393
418
|
end
|
|
394
419
|
it "returns false if user is not a list member" do
|
|
395
420
|
list_member = @client.list_member?("sferik", "presidents", 65493023)
|
|
396
|
-
expect(list_member).to
|
|
421
|
+
expect(list_member).to be false
|
|
397
422
|
end
|
|
398
423
|
it "returns false if user does not exist" do
|
|
399
424
|
list_member = @client.list_member?("sferik", "presidents", 12345678)
|
|
400
|
-
expect(list_member).to
|
|
425
|
+
expect(list_member).to be false
|
|
401
426
|
end
|
|
402
427
|
end
|
|
403
428
|
context "with an owner ID passed" do
|
|
@@ -461,16 +486,15 @@ describe Twitter::API::Lists do
|
|
|
461
486
|
it "returns the members of the specified list" do
|
|
462
487
|
list_members = @client.list_members("sferik", "presidents")
|
|
463
488
|
expect(list_members).to be_a Twitter::Cursor
|
|
464
|
-
expect(list_members.
|
|
465
|
-
expect(list_members.
|
|
466
|
-
expect(list_members.users.first.id).to eq 7505382
|
|
489
|
+
expect(list_members.first).to be_a Twitter::User
|
|
490
|
+
expect(list_members.first.id).to eq(7505382)
|
|
467
491
|
end
|
|
468
|
-
context "with
|
|
492
|
+
context "with each" do
|
|
469
493
|
before do
|
|
470
494
|
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
495
|
end
|
|
472
496
|
it "requests the correct resource" do
|
|
473
|
-
@client.list_members("sferik", "presidents").
|
|
497
|
+
@client.list_members("sferik", "presidents").each{}
|
|
474
498
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
475
499
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
|
476
500
|
end
|
|
@@ -484,12 +508,12 @@ describe Twitter::API::Lists do
|
|
|
484
508
|
@client.list_members(7505382, "presidents")
|
|
485
509
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
486
510
|
end
|
|
487
|
-
context "with
|
|
511
|
+
context "with each" do
|
|
488
512
|
before do
|
|
489
513
|
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
514
|
end
|
|
491
515
|
it "requests the correct resource" do
|
|
492
|
-
@client.list_members(7505382, "presidents").
|
|
516
|
+
@client.list_members(7505382, "presidents").each{}
|
|
493
517
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
494
518
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_id => "7505382", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
|
495
519
|
end
|
|
@@ -504,12 +528,12 @@ describe Twitter::API::Lists do
|
|
|
504
528
|
@client.list_members("presidents")
|
|
505
529
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
506
530
|
end
|
|
507
|
-
context "with
|
|
531
|
+
context "with each" do
|
|
508
532
|
before do
|
|
509
533
|
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
534
|
end
|
|
511
535
|
it "requests the correct resource" do
|
|
512
|
-
@client.list_members("presidents").
|
|
536
|
+
@client.list_members("presidents").each{}
|
|
513
537
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "-1"})).to have_been_made
|
|
514
538
|
expect(a_get("/1.1/lists/members.json").with(:query => {:owner_screen_name => "sferik", :slug => "presidents", :cursor => "1322801608223717003"})).to have_been_made
|
|
515
539
|
end
|
|
@@ -517,19 +541,19 @@ describe Twitter::API::Lists do
|
|
|
517
541
|
end
|
|
518
542
|
end
|
|
519
543
|
|
|
520
|
-
describe "#
|
|
544
|
+
describe "#add_list_member" do
|
|
521
545
|
context "with a screen name passed" do
|
|
522
546
|
before do
|
|
523
547
|
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"})
|
|
524
548
|
end
|
|
525
549
|
it "requests the correct resource" do
|
|
526
|
-
@client.
|
|
550
|
+
@client.add_list_member("sferik", "presidents", 813286)
|
|
527
551
|
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
|
528
552
|
end
|
|
529
553
|
it "returns the list" do
|
|
530
|
-
list = @client.
|
|
554
|
+
list = @client.add_list_member("sferik", "presidents", 813286)
|
|
531
555
|
expect(list).to be_a Twitter::List
|
|
532
|
-
expect(list.name).to eq
|
|
556
|
+
expect(list.name).to eq("presidents")
|
|
533
557
|
end
|
|
534
558
|
end
|
|
535
559
|
context "without a screen name passed" do
|
|
@@ -538,25 +562,25 @@ describe Twitter::API::Lists do
|
|
|
538
562
|
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"})
|
|
539
563
|
end
|
|
540
564
|
it "requests the correct resource" do
|
|
541
|
-
@client.
|
|
565
|
+
@client.add_list_member("presidents", 813286)
|
|
542
566
|
expect(a_post("/1.1/lists/members/create.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents", :user_id => "813286"})).to have_been_made
|
|
543
567
|
end
|
|
544
568
|
end
|
|
545
569
|
end
|
|
546
570
|
|
|
547
|
-
describe "#
|
|
571
|
+
describe "#destroy_list" do
|
|
548
572
|
context "with a screen name passed" do
|
|
549
573
|
before do
|
|
550
574
|
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"})
|
|
551
575
|
end
|
|
552
576
|
it "requests the correct resource" do
|
|
553
|
-
@client.
|
|
577
|
+
@client.destroy_list("sferik", "presidents")
|
|
554
578
|
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
|
555
579
|
end
|
|
556
580
|
it "returns the deleted list" do
|
|
557
|
-
list = @client.
|
|
581
|
+
list = @client.destroy_list("sferik", "presidents")
|
|
558
582
|
expect(list).to be_a Twitter::List
|
|
559
|
-
expect(list.name).to eq
|
|
583
|
+
expect(list.name).to eq("presidents")
|
|
560
584
|
end
|
|
561
585
|
end
|
|
562
586
|
context "without a screen name passed" do
|
|
@@ -565,7 +589,7 @@ describe Twitter::API::Lists do
|
|
|
565
589
|
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"})
|
|
566
590
|
end
|
|
567
591
|
it "requests the correct resource" do
|
|
568
|
-
@client.
|
|
592
|
+
@client.destroy_list("presidents")
|
|
569
593
|
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :slug => "presidents"})).to have_been_made
|
|
570
594
|
end
|
|
571
595
|
end
|
|
@@ -574,7 +598,7 @@ describe Twitter::API::Lists do
|
|
|
574
598
|
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"})
|
|
575
599
|
end
|
|
576
600
|
it "requests the correct resource" do
|
|
577
|
-
@client.
|
|
601
|
+
@client.destroy_list("sferik", 12345678)
|
|
578
602
|
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_screen_name => "sferik", :list_id => "12345678"})).to have_been_made
|
|
579
603
|
end
|
|
580
604
|
end
|
|
@@ -584,7 +608,7 @@ describe Twitter::API::Lists do
|
|
|
584
608
|
end
|
|
585
609
|
it "requests the correct resource" do
|
|
586
610
|
list = Twitter::List.new(:id => "12345678", :user => {:id => 7505382, :screen_name => "sferik"})
|
|
587
|
-
@client.
|
|
611
|
+
@client.destroy_list(list)
|
|
588
612
|
expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "12345678"})).to have_been_made
|
|
589
613
|
end
|
|
590
614
|
end
|
|
@@ -602,7 +626,7 @@ describe Twitter::API::Lists do
|
|
|
602
626
|
it "returns the updated list" do
|
|
603
627
|
list = @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America")
|
|
604
628
|
expect(list).to be_a Twitter::List
|
|
605
|
-
expect(list.name).to eq
|
|
629
|
+
expect(list.name).to eq("presidents")
|
|
606
630
|
end
|
|
607
631
|
end
|
|
608
632
|
context "without a screen name passed" do
|
|
@@ -636,18 +660,18 @@ describe Twitter::API::Lists do
|
|
|
636
660
|
end
|
|
637
661
|
end
|
|
638
662
|
|
|
639
|
-
describe "#
|
|
663
|
+
describe "#create_list" do
|
|
640
664
|
before do
|
|
641
665
|
stub_post("/1.1/lists/create.json").with(:body => {:name => "presidents"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
|
642
666
|
end
|
|
643
667
|
it "requests the correct resource" do
|
|
644
|
-
@client.
|
|
668
|
+
@client.create_list("presidents")
|
|
645
669
|
expect(a_post("/1.1/lists/create.json").with(:body => {:name => "presidents"})).to have_been_made
|
|
646
670
|
end
|
|
647
671
|
it "returns the created list" do
|
|
648
|
-
list = @client.
|
|
672
|
+
list = @client.create_list("presidents")
|
|
649
673
|
expect(list).to be_a Twitter::List
|
|
650
|
-
expect(list.name).to eq
|
|
674
|
+
expect(list.name).to eq("presidents")
|
|
651
675
|
end
|
|
652
676
|
end
|
|
653
677
|
|
|
@@ -663,7 +687,7 @@ describe Twitter::API::Lists do
|
|
|
663
687
|
it "returns the updated list" do
|
|
664
688
|
list = @client.list("sferik", "presidents")
|
|
665
689
|
expect(list).to be_a Twitter::List
|
|
666
|
-
expect(list.name).to eq
|
|
690
|
+
expect(list.name).to eq("presidents")
|
|
667
691
|
end
|
|
668
692
|
end
|
|
669
693
|
context "with a user ID passed" do
|
|
@@ -728,16 +752,15 @@ describe Twitter::API::Lists do
|
|
|
728
752
|
it "returns the lists the specified user follows" do
|
|
729
753
|
subscriptions = @client.subscriptions("sferik")
|
|
730
754
|
expect(subscriptions).to be_a Twitter::Cursor
|
|
731
|
-
expect(subscriptions.
|
|
732
|
-
expect(subscriptions.
|
|
733
|
-
expect(subscriptions.lists.first.name).to eq "Rubyists"
|
|
755
|
+
expect(subscriptions.first).to be_a Twitter::List
|
|
756
|
+
expect(subscriptions.first.name).to eq("Rubyists")
|
|
734
757
|
end
|
|
735
|
-
context "with
|
|
758
|
+
context "with each" do
|
|
736
759
|
before do
|
|
737
760
|
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
761
|
end
|
|
739
762
|
it "requests the correct resource" do
|
|
740
|
-
@client.subscriptions("sferik").
|
|
763
|
+
@client.subscriptions("sferik").each{}
|
|
741
764
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
742
765
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
|
743
766
|
end
|
|
@@ -751,12 +774,12 @@ describe Twitter::API::Lists do
|
|
|
751
774
|
@client.subscriptions(7505382)
|
|
752
775
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
|
753
776
|
end
|
|
754
|
-
context "with
|
|
777
|
+
context "with each" do
|
|
755
778
|
before do
|
|
756
779
|
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
780
|
end
|
|
758
781
|
it "requests the correct resource" do
|
|
759
|
-
@client.subscriptions(7505382).
|
|
782
|
+
@client.subscriptions(7505382).each{}
|
|
760
783
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "-1"})).to have_been_made
|
|
761
784
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:user_id => "7505382", :cursor => "1401037770457540712"})).to have_been_made
|
|
762
785
|
end
|
|
@@ -771,12 +794,12 @@ describe Twitter::API::Lists do
|
|
|
771
794
|
@client.subscriptions
|
|
772
795
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
773
796
|
end
|
|
774
|
-
context "with
|
|
797
|
+
context "with each" do
|
|
775
798
|
before do
|
|
776
799
|
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
800
|
end
|
|
778
801
|
it "requests the correct resource" do
|
|
779
|
-
@client.subscriptions.
|
|
802
|
+
@client.subscriptions.each{}
|
|
780
803
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
781
804
|
expect(a_get("/1.1/lists/subscriptions.json").with(:query => {:screen_name => "sferik", :cursor => "1401037770457540712"})).to have_been_made
|
|
782
805
|
end
|
|
@@ -784,19 +807,19 @@ describe Twitter::API::Lists do
|
|
|
784
807
|
end
|
|
785
808
|
end
|
|
786
809
|
|
|
787
|
-
describe "#
|
|
810
|
+
describe "#remove_list_members" do
|
|
788
811
|
context "with a screen name passed" do
|
|
789
812
|
before do
|
|
790
813
|
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"})
|
|
791
814
|
end
|
|
792
815
|
it "requests the correct resource" do
|
|
793
|
-
@client.
|
|
816
|
+
@client.remove_list_members("sferik", "presidents", [813286, 18755393])
|
|
794
817
|
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
|
|
795
818
|
end
|
|
796
819
|
it "returns the list" do
|
|
797
|
-
list = @client.
|
|
820
|
+
list = @client.remove_list_members("sferik", "presidents", [813286, 18755393])
|
|
798
821
|
expect(list).to be_a Twitter::List
|
|
799
|
-
expect(list.name).to eq
|
|
822
|
+
expect(list.name).to eq("presidents")
|
|
800
823
|
end
|
|
801
824
|
end
|
|
802
825
|
context "with a user ID passed" do
|
|
@@ -804,7 +827,7 @@ describe Twitter::API::Lists do
|
|
|
804
827
|
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
828
|
end
|
|
806
829
|
it "requests the correct resource" do
|
|
807
|
-
@client.
|
|
830
|
+
@client.remove_list_members(7505382, "presidents", [813286, 18755393])
|
|
808
831
|
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
832
|
end
|
|
810
833
|
end
|
|
@@ -813,7 +836,7 @@ describe Twitter::API::Lists do
|
|
|
813
836
|
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"})
|
|
814
837
|
end
|
|
815
838
|
it "requests the correct resource" do
|
|
816
|
-
@client.
|
|
839
|
+
@client.remove_list_members("sferik", "presidents", [813286, "pengwynn", 18755393, "erebor"])
|
|
817
840
|
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
|
|
818
841
|
end
|
|
819
842
|
end
|
|
@@ -823,27 +846,26 @@ describe Twitter::API::Lists do
|
|
|
823
846
|
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"})
|
|
824
847
|
end
|
|
825
848
|
it "requests the correct resource" do
|
|
826
|
-
@client.
|
|
849
|
+
@client.remove_list_members("presidents", [813286, 18755393])
|
|
827
850
|
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
|
|
828
851
|
end
|
|
829
852
|
end
|
|
830
853
|
end
|
|
831
854
|
|
|
832
|
-
describe "#
|
|
855
|
+
describe "#owned_lists" do
|
|
833
856
|
context "with a screen name passed" do
|
|
834
857
|
before do
|
|
835
858
|
stub_get("/1.1/lists/ownerships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"}).to_return(:body => fixture("ownerships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
|
836
859
|
end
|
|
837
860
|
it "requests the correct resource" do
|
|
838
|
-
@client.
|
|
861
|
+
@client.owned_lists("sferik")
|
|
839
862
|
expect(a_get("/1.1/lists/ownerships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
840
863
|
end
|
|
841
864
|
it "returns the requested list" do
|
|
842
|
-
lists = @client.
|
|
865
|
+
lists = @client.owned_lists("sferik")
|
|
843
866
|
expect(lists).to be_a Twitter::Cursor
|
|
844
|
-
expect(lists.
|
|
845
|
-
expect(lists.
|
|
846
|
-
expect(lists.lists.first.name).to eq "My favstar.fm list"
|
|
867
|
+
expect(lists.first).to be_a Twitter::List
|
|
868
|
+
expect(lists.first.name).to eq("My favstar.fm list")
|
|
847
869
|
end
|
|
848
870
|
end
|
|
849
871
|
context "without a screen name passed" do
|
|
@@ -852,15 +874,14 @@ describe Twitter::API::Lists do
|
|
|
852
874
|
stub_get("/1.1/lists/ownerships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"}).to_return(:body => fixture("ownerships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
|
853
875
|
end
|
|
854
876
|
it "requests the correct resource" do
|
|
855
|
-
@client.
|
|
877
|
+
@client.owned_lists
|
|
856
878
|
expect(a_get("/1.1/lists/ownerships.json").with(:query => {:screen_name => "sferik", :cursor => "-1"})).to have_been_made
|
|
857
879
|
end
|
|
858
880
|
it "returns the requested list" do
|
|
859
|
-
lists = @client.
|
|
881
|
+
lists = @client.owned_lists
|
|
860
882
|
expect(lists).to be_a Twitter::Cursor
|
|
861
|
-
expect(lists.
|
|
862
|
-
expect(lists.
|
|
863
|
-
expect(lists.lists.first.name).to eq "My favstar.fm list"
|
|
883
|
+
expect(lists.first).to be_a Twitter::List
|
|
884
|
+
expect(lists.first.name).to eq("My favstar.fm list")
|
|
864
885
|
end
|
|
865
886
|
end
|
|
866
887
|
end
|