twitter 4.8.1 → 5.0.0.rc.1
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.tar.gz.sig +0 -0
- data/CHANGELOG.md +30 -0
- data/LICENSE.md +1 -1
- data/README.md +386 -266
- data/lib/twitter.rb +4 -39
- data/lib/twitter/arguments.rb +11 -0
- data/lib/twitter/base.rb +89 -68
- data/lib/twitter/client.rb +69 -110
- data/lib/twitter/configuration.rb +7 -3
- data/lib/twitter/creatable.rb +2 -4
- data/lib/twitter/cursor.rb +50 -42
- data/lib/twitter/direct_message.rb +2 -11
- data/lib/twitter/entity/uri.rb +13 -0
- data/lib/twitter/enumerable.rb +15 -0
- data/lib/twitter/error.rb +55 -7
- 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/factory.rb +2 -8
- data/lib/twitter/geo_factory.rb +2 -2
- data/lib/twitter/geo_results.rb +36 -0
- data/lib/twitter/identity.rb +0 -22
- data/lib/twitter/list.rb +18 -4
- data/lib/twitter/media/photo.rb +3 -3
- data/lib/twitter/media_factory.rb +2 -2
- data/lib/twitter/null_object.rb +24 -0
- data/lib/twitter/oembed.rb +3 -2
- data/lib/twitter/place.rb +15 -9
- data/lib/twitter/profile_banner.rb +5 -3
- data/lib/twitter/rate_limit.rb +1 -17
- data/lib/twitter/relationship.rb +2 -10
- data/lib/twitter/rest/api/direct_messages.rb +135 -0
- data/lib/twitter/rest/api/favorites.rb +120 -0
- data/lib/twitter/rest/api/friends_and_followers.rb +290 -0
- data/lib/twitter/rest/api/help.rb +58 -0
- data/lib/twitter/rest/api/lists.rb +491 -0
- data/lib/twitter/rest/api/oauth.rb +45 -0
- data/lib/twitter/rest/api/places_and_geo.rb +104 -0
- data/lib/twitter/rest/api/saved_searches.rb +91 -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 +293 -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 +219 -0
- data/lib/twitter/rest/client.rb +193 -0
- data/lib/twitter/rest/request/multipart_with_file.rb +36 -0
- data/lib/twitter/rest/response/parse_json.rb +27 -0
- data/lib/twitter/{response → rest/response}/raise_error.rb +8 -11
- data/lib/twitter/search_results.rb +33 -21
- data/lib/twitter/settings.rb +1 -6
- data/lib/twitter/size.rb +1 -1
- data/lib/twitter/streaming/client.rb +77 -0
- data/lib/twitter/streaming/connection.rb +22 -0
- data/lib/twitter/streaming/response.rb +30 -0
- data/lib/twitter/suggestion.rb +4 -2
- data/lib/twitter/token.rb +8 -0
- data/lib/twitter/trend.rb +2 -1
- data/lib/twitter/trend_results.rb +59 -0
- data/lib/twitter/tweet.rb +41 -85
- data/lib/twitter/user.rb +51 -41
- data/lib/twitter/version.rb +4 -4
- 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/search.json +1 -1
- data/spec/fixtures/search_malformed.json +1 -1
- data/spec/fixtures/track_streaming.json +3 -0
- data/spec/helper.rb +8 -13
- data/spec/twitter/base_spec.rb +25 -99
- data/spec/twitter/configuration_spec.rb +1 -1
- data/spec/twitter/cursor_spec.rb +13 -31
- data/spec/twitter/direct_message_spec.rb +41 -8
- data/spec/twitter/entity/uri_spec.rb +74 -0
- data/spec/twitter/error_spec.rb +59 -11
- data/spec/twitter/geo/point_spec.rb +1 -1
- data/spec/twitter/geo_factory_spec.rb +3 -3
- data/spec/twitter/geo_results_spec.rb +35 -0
- data/spec/twitter/identifiable_spec.rb +0 -21
- data/spec/twitter/list_spec.rb +51 -8
- data/spec/twitter/media/photo_spec.rb +118 -3
- data/spec/twitter/media_factory_spec.rb +2 -2
- data/spec/twitter/null_object_spec.rb +26 -0
- data/spec/twitter/oembed_spec.rb +69 -45
- data/spec/twitter/place_spec.rb +68 -12
- data/spec/twitter/profile_banner_spec.rb +1 -1
- data/spec/twitter/rate_limit_spec.rb +12 -12
- data/spec/twitter/relationship_spec.rb +31 -9
- data/spec/twitter/{api → rest/api}/direct_messages_spec.rb +22 -9
- data/spec/twitter/{api → rest/api}/favorites_spec.rb +80 -7
- data/spec/twitter/{api → rest/api}/friends_and_followers_spec.rb +104 -65
- data/spec/twitter/{api → rest/api}/geo_spec.rb +10 -10
- data/spec/twitter/{api → rest/api}/help_spec.rb +6 -6
- data/spec/twitter/{api → rest/api}/lists_spec.rb +77 -56
- data/spec/twitter/{api → rest/api}/oauth_spec.rb +6 -6
- data/spec/twitter/{api → rest/api}/saved_searches_spec.rb +7 -7
- 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 +60 -35
- data/spec/twitter/rest/client_spec.rb +193 -0
- data/spec/twitter/saved_search_spec.rb +11 -0
- data/spec/twitter/search_results_spec.rb +29 -42
- data/spec/twitter/settings_spec.rb +17 -6
- data/spec/twitter/streaming/client_spec.rb +75 -0
- data/spec/twitter/token_spec.rb +16 -0
- data/spec/twitter/trend_results_spec.rb +89 -0
- data/spec/twitter/trend_spec.rb +23 -0
- data/spec/twitter/tweet_spec.rb +122 -115
- data/spec/twitter/user_spec.rb +136 -77
- data/spec/twitter_spec.rb +0 -119
- data/twitter.gemspec +8 -5
- metadata +148 -141
- 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::DirectMessages do
|
3
|
+
describe Twitter::REST::API::DirectMessages 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 "#direct_messages_received" do
|
@@ -18,7 +18,7 @@ describe Twitter::API::DirectMessages do
|
|
18
18
|
direct_messages = @client.direct_messages_received
|
19
19
|
expect(direct_messages).to be_an Array
|
20
20
|
expect(direct_messages.first).to be_a Twitter::DirectMessage
|
21
|
-
expect(direct_messages.first.sender.id).to eq
|
21
|
+
expect(direct_messages.first.sender.id).to eq(7505382)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -34,7 +34,7 @@ describe Twitter::API::DirectMessages do
|
|
34
34
|
direct_messages = @client.direct_messages_sent
|
35
35
|
expect(direct_messages).to be_an Array
|
36
36
|
expect(direct_messages.first).to be_a Twitter::DirectMessage
|
37
|
-
expect(direct_messages.first.sender.id).to eq
|
37
|
+
expect(direct_messages.first.sender.id).to eq(7505382)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -49,7 +49,7 @@ describe Twitter::API::DirectMessages do
|
|
49
49
|
it "returns the specified direct message" do
|
50
50
|
direct_message = @client.direct_message(1825786345)
|
51
51
|
expect(direct_message).to be_a Twitter::DirectMessage
|
52
|
-
expect(direct_message.sender.id).to eq
|
52
|
+
expect(direct_message.sender.id).to eq(7505382)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -66,7 +66,7 @@ describe Twitter::API::DirectMessages do
|
|
66
66
|
direct_messages = @client.direct_messages(1825786345)
|
67
67
|
expect(direct_messages).to be_an Array
|
68
68
|
expect(direct_messages.first).to be_a Twitter::DirectMessage
|
69
|
-
expect(direct_messages.first.sender.id).to eq
|
69
|
+
expect(direct_messages.first.sender.id).to eq(7505382)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
context "without ids passed" do
|
@@ -81,7 +81,7 @@ describe Twitter::API::DirectMessages do
|
|
81
81
|
direct_messages = @client.direct_messages
|
82
82
|
expect(direct_messages).to be_an Array
|
83
83
|
expect(direct_messages.first).to be_a Twitter::DirectMessage
|
84
|
-
expect(direct_messages.first.sender.id).to eq
|
84
|
+
expect(direct_messages.first.sender.id).to eq(7505382)
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -98,7 +98,7 @@ describe Twitter::API::DirectMessages do
|
|
98
98
|
direct_messages = @client.direct_message_destroy(1825785544)
|
99
99
|
expect(direct_messages).to be_an Array
|
100
100
|
expect(direct_messages.first).to be_a Twitter::DirectMessage
|
101
|
-
expect(direct_messages.first.sender.id).to eq
|
101
|
+
expect(direct_messages.first.sender.id).to eq(7505382)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -113,7 +113,20 @@ describe Twitter::API::DirectMessages do
|
|
113
113
|
it "returns the sent message" do
|
114
114
|
direct_message = @client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem")
|
115
115
|
expect(direct_message).to be_a Twitter::DirectMessage
|
116
|
-
expect(direct_message.text).to eq
|
116
|
+
expect(direct_message.text).to eq("Creating a fixture for the Twitter gem")
|
117
|
+
end
|
118
|
+
context "with a URI object passed" do
|
119
|
+
it "requests the correct resource" do
|
120
|
+
user = URI.parse("https://twitter.com/pengwynn")
|
121
|
+
@client.direct_message_create(user, "Creating a fixture for the Twitter gem")
|
122
|
+
expect(a_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
|
123
|
+
end
|
124
|
+
end
|
125
|
+
context "with a URI string passed" do
|
126
|
+
it "requests the correct resource" do
|
127
|
+
@client.direct_message_create("https://twitter.com/pengwynn", "Creating a fixture for the Twitter gem")
|
128
|
+
expect(a_post("/1.1/direct_messages/new.json").with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"})).to have_been_made
|
129
|
+
end
|
117
130
|
end
|
118
131
|
end
|
119
132
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
describe Twitter::API::Favorites do
|
3
|
+
describe Twitter::REST::API::Favorites 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 "#favorites" do
|
@@ -19,7 +19,20 @@ describe Twitter::API::Favorites do
|
|
19
19
|
favorites = @client.favorites("sferik")
|
20
20
|
expect(favorites).to be_an Array
|
21
21
|
expect(favorites.first).to be_a Twitter::Tweet
|
22
|
-
expect(favorites.first.user.id).to eq
|
22
|
+
expect(favorites.first.user.id).to eq(7505382)
|
23
|
+
end
|
24
|
+
context "with a URI object passed" do
|
25
|
+
it "requests the correct resource" do
|
26
|
+
user = URI.parse("https://twitter.com/sferik")
|
27
|
+
@client.favorites(user)
|
28
|
+
expect(a_get("/1.1/favorites/list.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
29
|
+
end
|
30
|
+
end
|
31
|
+
context "with a URI string passed" do
|
32
|
+
it "requests the correct resource" do
|
33
|
+
@client.favorites("https://twitter.com/sferik")
|
34
|
+
expect(a_get("/1.1/favorites/list.json").with(:query => {:screen_name => "sferik"})).to have_been_made
|
35
|
+
end
|
23
36
|
end
|
24
37
|
end
|
25
38
|
context "without arguments passed" do
|
@@ -34,7 +47,7 @@ describe Twitter::API::Favorites do
|
|
34
47
|
favorites = @client.favorites
|
35
48
|
expect(favorites).to be_an Array
|
36
49
|
expect(favorites.first).to be_a Twitter::Tweet
|
37
|
-
expect(favorites.first.user.id).to eq
|
50
|
+
expect(favorites.first.user.id).to eq(7505382)
|
38
51
|
end
|
39
52
|
end
|
40
53
|
end
|
@@ -51,7 +64,27 @@ describe Twitter::API::Favorites do
|
|
51
64
|
tweets = @client.unfavorite(25938088801)
|
52
65
|
expect(tweets).to be_an Array
|
53
66
|
expect(tweets.first).to be_a Twitter::Tweet
|
54
|
-
expect(tweets.first.text).to eq
|
67
|
+
expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
|
68
|
+
end
|
69
|
+
context "with a URI object passed" do
|
70
|
+
it "requests the correct resource" do
|
71
|
+
tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
|
72
|
+
@client.unfavorite(tweet)
|
73
|
+
expect(a_post("/1.1/favorites/destroy.json").with(:body => {:id => "25938088801"})).to have_been_made
|
74
|
+
end
|
75
|
+
end
|
76
|
+
context "with a URI string passed" do
|
77
|
+
it "requests the correct resource" do
|
78
|
+
@client.unfavorite("https://twitter.com/sferik/status/25938088801")
|
79
|
+
expect(a_post("/1.1/favorites/destroy.json").with(:body => {:id => "25938088801"})).to have_been_made
|
80
|
+
end
|
81
|
+
end
|
82
|
+
context "with a Tweet passed" do
|
83
|
+
it "requests the correct resource" do
|
84
|
+
tweet = Twitter::Tweet.new(:id => 25938088801)
|
85
|
+
@client.unfavorite(tweet)
|
86
|
+
expect(a_post("/1.1/favorites/destroy.json").with(:body => {:id => "25938088801"})).to have_been_made
|
87
|
+
end
|
55
88
|
end
|
56
89
|
end
|
57
90
|
|
@@ -67,7 +100,7 @@ describe Twitter::API::Favorites do
|
|
67
100
|
tweets = @client.favorite(25938088801)
|
68
101
|
expect(tweets).to be_an Array
|
69
102
|
expect(tweets.first).to be_a Twitter::Tweet
|
70
|
-
expect(tweets.first.text).to eq
|
103
|
+
expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
|
71
104
|
end
|
72
105
|
context "already favorited" do
|
73
106
|
before do
|
@@ -77,6 +110,26 @@ describe Twitter::API::Favorites do
|
|
77
110
|
expect{@client.favorite(25938088801)}.not_to raise_error
|
78
111
|
end
|
79
112
|
end
|
113
|
+
context "with a URI object passed" do
|
114
|
+
it "requests the correct resource" do
|
115
|
+
tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
|
116
|
+
@client.favorite(tweet)
|
117
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
118
|
+
end
|
119
|
+
end
|
120
|
+
context "with a URI string passed" do
|
121
|
+
it "requests the correct resource" do
|
122
|
+
@client.favorite("https://twitter.com/sferik/status/25938088801")
|
123
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
124
|
+
end
|
125
|
+
end
|
126
|
+
context "with a Tweet passed" do
|
127
|
+
it "requests the correct resource" do
|
128
|
+
tweet = Twitter::Tweet.new(:id => 25938088801)
|
129
|
+
@client.favorite(tweet)
|
130
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
131
|
+
end
|
132
|
+
end
|
80
133
|
end
|
81
134
|
|
82
135
|
describe "#favorite!" do
|
@@ -91,7 +144,7 @@ describe Twitter::API::Favorites do
|
|
91
144
|
tweets = @client.favorite!(25938088801)
|
92
145
|
expect(tweets).to be_an Array
|
93
146
|
expect(tweets.first).to be_a Twitter::Tweet
|
94
|
-
expect(tweets.first.text).to eq
|
147
|
+
expect(tweets.first.text).to eq("The problem with your code is that it's doing exactly what you told it to do.")
|
95
148
|
end
|
96
149
|
context "forbidden" do
|
97
150
|
before do
|
@@ -109,6 +162,26 @@ describe Twitter::API::Favorites do
|
|
109
162
|
expect{@client.favorite!(25938088801)}.to raise_error Twitter::Error::AlreadyFavorited
|
110
163
|
end
|
111
164
|
end
|
165
|
+
context "with a URI object passed" do
|
166
|
+
it "requests the correct resource" do
|
167
|
+
tweet = URI.parse("https://twitter.com/sferik/status/25938088801")
|
168
|
+
@client.favorite!(tweet)
|
169
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
170
|
+
end
|
171
|
+
end
|
172
|
+
context "with a URI string passed" do
|
173
|
+
it "requests the correct resource" do
|
174
|
+
@client.favorite!("https://twitter.com/sferik/status/25938088801")
|
175
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
176
|
+
end
|
177
|
+
end
|
178
|
+
context "with a Tweet passed" do
|
179
|
+
it "requests the correct resource" do
|
180
|
+
tweet = Twitter::Tweet.new(:id => 25938088801)
|
181
|
+
@client.favorite!(tweet)
|
182
|
+
expect(a_post("/1.1/favorites/create.json").with(:body => {:id => "25938088801"})).to have_been_made
|
183
|
+
end
|
184
|
+
end
|
112
185
|
end
|
113
186
|
|
114
187
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
describe Twitter::API::FriendsAndFollowers do
|
3
|
+
describe Twitter::REST::API::FriendsAndFollowers 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 "#friend_ids" do
|
@@ -18,15 +18,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
18
18
|
it "returns an array of numeric IDs for every user the specified user is following" do
|
19
19
|
friend_ids = @client.friend_ids("sferik")
|
20
20
|
expect(friend_ids).to be_a Twitter::Cursor
|
21
|
-
expect(friend_ids.
|
22
|
-
expect(friend_ids.ids.first).to eq 14100886
|
21
|
+
expect(friend_ids.first).to eq(20009713)
|
23
22
|
end
|
24
|
-
context "with
|
23
|
+
context "with each" do
|
25
24
|
before do
|
26
25
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
27
26
|
end
|
28
27
|
it "requests the correct resource" do
|
29
|
-
@client.friend_ids("sferik").
|
28
|
+
@client.friend_ids("sferik").each{}
|
30
29
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
31
30
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
|
32
31
|
end
|
@@ -40,12 +39,12 @@ describe Twitter::API::FriendsAndFollowers do
|
|
40
39
|
@client.friend_ids(7505382)
|
41
40
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
42
41
|
end
|
43
|
-
context "with
|
42
|
+
context "with each" do
|
44
43
|
before do
|
45
44
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
46
45
|
end
|
47
46
|
it "requests the correct resource" do
|
48
|
-
@client.friend_ids(7505382).
|
47
|
+
@client.friend_ids(7505382).each{}
|
49
48
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
50
49
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"})).to have_been_made
|
51
50
|
end
|
@@ -64,15 +63,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
64
63
|
it "returns an array of numeric IDs for every user the specified user is following" do
|
65
64
|
friend_ids = @client.friend_ids
|
66
65
|
expect(friend_ids).to be_a Twitter::Cursor
|
67
|
-
expect(friend_ids.
|
68
|
-
expect(friend_ids.ids.first).to eq 14100886
|
66
|
+
expect(friend_ids.first).to eq(20009713)
|
69
67
|
end
|
70
|
-
context "with
|
68
|
+
context "with each" do
|
71
69
|
before do
|
72
70
|
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
73
71
|
end
|
74
72
|
it "requests the correct resource" do
|
75
|
-
@client.friend_ids.
|
73
|
+
@client.friend_ids.each{}
|
76
74
|
expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
|
77
75
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
78
76
|
expect(a_get("/1.1/friends/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
|
@@ -93,15 +91,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
93
91
|
it "returns an array of numeric IDs for every user following the specified user" do
|
94
92
|
follower_ids = @client.follower_ids("sferik")
|
95
93
|
expect(follower_ids).to be_a Twitter::Cursor
|
96
|
-
expect(follower_ids.
|
97
|
-
expect(follower_ids.ids.first).to eq 14100886
|
94
|
+
expect(follower_ids.first).to eq(20009713)
|
98
95
|
end
|
99
|
-
context "with
|
96
|
+
context "with each" do
|
100
97
|
before do
|
101
98
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
102
99
|
end
|
103
100
|
it "requests the correct resource" do
|
104
|
-
@client.follower_ids("sferik").
|
101
|
+
@client.follower_ids("sferik").each{}
|
105
102
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
106
103
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
|
107
104
|
end
|
@@ -115,12 +112,12 @@ describe Twitter::API::FriendsAndFollowers do
|
|
115
112
|
@client.follower_ids(7505382)
|
116
113
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
117
114
|
end
|
118
|
-
context "with
|
115
|
+
context "with each" do
|
119
116
|
before do
|
120
117
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
121
118
|
end
|
122
119
|
it "requests the correct resource" do
|
123
|
-
@client.follower_ids(7505382).
|
120
|
+
@client.follower_ids(7505382).each{}
|
124
121
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
125
122
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :user_id => "7505382"})).to have_been_made
|
126
123
|
end
|
@@ -139,15 +136,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
139
136
|
it "returns an array of numeric IDs for every user following the specified user" do
|
140
137
|
follower_ids = @client.follower_ids
|
141
138
|
expect(follower_ids).to be_a Twitter::Cursor
|
142
|
-
expect(follower_ids.
|
143
|
-
expect(follower_ids.ids.first).to eq 14100886
|
139
|
+
expect(follower_ids.first).to eq(20009713)
|
144
140
|
end
|
145
|
-
context "with
|
141
|
+
context "with each" do
|
146
142
|
before do
|
147
143
|
stub_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
148
144
|
end
|
149
145
|
it "requests the correct resource" do
|
150
|
-
@client.follower_ids.
|
146
|
+
@client.follower_ids.each{}
|
151
147
|
expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
|
152
148
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
153
149
|
expect(a_get("/1.1/followers/ids.json").with(:query => {:cursor => "1305102810874389703", :screen_name => "sferik"})).to have_been_made
|
@@ -169,8 +165,8 @@ describe Twitter::API::FriendsAndFollowers do
|
|
169
165
|
friendships = @client.friendships("sferik", "pengwynn")
|
170
166
|
expect(friendships).to be_an Array
|
171
167
|
expect(friendships.first).to be_a Twitter::User
|
172
|
-
expect(friendships.first.id).to eq
|
173
|
-
expect(friendships.first.connections).to eq
|
168
|
+
expect(friendships.first.id).to eq(7505382)
|
169
|
+
expect(friendships.first.connections).to eq(["none"])
|
174
170
|
end
|
175
171
|
end
|
176
172
|
context "with numeric screen names passed" do
|
@@ -215,8 +211,8 @@ describe Twitter::API::FriendsAndFollowers do
|
|
215
211
|
friendships = @client.friendships("sferik", "pengwynn")
|
216
212
|
expect(friendships).to be_an Array
|
217
213
|
expect(friendships.first).to be_a Twitter::User
|
218
|
-
expect(friendships.first.id).to eq
|
219
|
-
expect(friendships.first.connections).to eq
|
214
|
+
expect(friendships.first.id).to eq(7505382)
|
215
|
+
expect(friendships.first.connections).to eq(["none"])
|
220
216
|
end
|
221
217
|
end
|
222
218
|
context "with numeric screen names passed" do
|
@@ -259,15 +255,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
259
255
|
it "returns an array of numeric IDs for every user who has a pending request to follow the authenticating user" do
|
260
256
|
friendships_incoming = @client.friendships_incoming
|
261
257
|
expect(friendships_incoming).to be_a Twitter::Cursor
|
262
|
-
expect(friendships_incoming.
|
263
|
-
expect(friendships_incoming.ids.first).to eq 14100886
|
258
|
+
expect(friendships_incoming.first).to eq(20009713)
|
264
259
|
end
|
265
|
-
context "with
|
260
|
+
context "with each" do
|
266
261
|
before do
|
267
262
|
stub_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
268
263
|
end
|
269
264
|
it "requests the correct resource" do
|
270
|
-
@client.friendships_incoming.
|
265
|
+
@client.friendships_incoming.each{}
|
271
266
|
expect(a_get("/1.1/friendships/incoming.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made
|
272
267
|
end
|
273
268
|
end
|
@@ -284,15 +279,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
284
279
|
it "returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request" do
|
285
280
|
friendships_outgoing = @client.friendships_outgoing
|
286
281
|
expect(friendships_outgoing).to be_a Twitter::Cursor
|
287
|
-
expect(friendships_outgoing.
|
288
|
-
expect(friendships_outgoing.ids.first).to eq 14100886
|
282
|
+
expect(friendships_outgoing.first).to eq(20009713)
|
289
283
|
end
|
290
|
-
context "with
|
284
|
+
context "with each" do
|
291
285
|
before do
|
292
286
|
stub_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "1305102810874389703"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
293
287
|
end
|
294
288
|
it "requests the correct resource" do
|
295
|
-
@client.friendships_outgoing.
|
289
|
+
@client.friendships_outgoing.each{}
|
296
290
|
expect(a_get("/1.1/friendships/outgoing.json").with(:query => {:cursor => "1305102810874389703"})).to have_been_made
|
297
291
|
end
|
298
292
|
end
|
@@ -302,7 +296,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
302
296
|
context "with :follow => true passed" do
|
303
297
|
before do
|
304
298
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
305
|
-
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("
|
299
|
+
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
306
300
|
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
307
301
|
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382", :follow => "true"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
308
302
|
end
|
@@ -317,13 +311,13 @@ describe Twitter::API::FriendsAndFollowers do
|
|
317
311
|
users = @client.follow("sferik", "pengwynn", :follow => true)
|
318
312
|
expect(users).to be_an Array
|
319
313
|
expect(users.first).to be_a Twitter::User
|
320
|
-
expect(users.first.id).to eq
|
314
|
+
expect(users.first.id).to eq(7505382)
|
321
315
|
end
|
322
316
|
end
|
323
317
|
context "with :follow => false passed" do
|
324
318
|
before do
|
325
319
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
326
|
-
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("
|
320
|
+
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
327
321
|
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
328
322
|
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
329
323
|
end
|
@@ -338,7 +332,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
338
332
|
context "without :follow passed" do
|
339
333
|
before do
|
340
334
|
stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
341
|
-
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("
|
335
|
+
stub_get("/1.1/friends/ids.json").with(:query => {:cursor => "-1", :screen_name => "sferik"}).to_return(:body => fixture("ids_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
342
336
|
stub_post("/1.1/users/lookup.json").with(:body => {:screen_name => "sferik,pengwynn"}).to_return(:body => fixture("friendships.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
343
337
|
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
344
338
|
end
|
@@ -365,7 +359,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
365
359
|
users = @client.follow!("sferik", :follow => true)
|
366
360
|
expect(users).to be_an Array
|
367
361
|
expect(users.first).to be_a Twitter::User
|
368
|
-
expect(users.first.id).to eq
|
362
|
+
expect(users.first.id).to eq(7505382)
|
369
363
|
end
|
370
364
|
end
|
371
365
|
context "with :follow => false passed" do
|
@@ -380,7 +374,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
380
374
|
users = @client.follow!("sferik", :follow => false)
|
381
375
|
expect(users).to be_an Array
|
382
376
|
expect(users.first).to be_a Twitter::User
|
383
|
-
expect(users.first.id).to eq
|
377
|
+
expect(users.first.id).to eq(7505382)
|
384
378
|
end
|
385
379
|
end
|
386
380
|
context "without :follow passed" do
|
@@ -395,7 +389,36 @@ describe Twitter::API::FriendsAndFollowers do
|
|
395
389
|
users = @client.follow!("sferik")
|
396
390
|
expect(users).to be_an Array
|
397
391
|
expect(users.first).to be_a Twitter::User
|
398
|
-
expect(users.first.id).to eq
|
392
|
+
expect(users.first.id).to eq(7505382)
|
393
|
+
end
|
394
|
+
end
|
395
|
+
context "with a user object passed" do
|
396
|
+
before do
|
397
|
+
stub_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
398
|
+
end
|
399
|
+
it "requests the correct resources" do
|
400
|
+
user = Twitter::User.new(:id => "7505382")
|
401
|
+
@client.follow!(user)
|
402
|
+
expect(a_post("/1.1/friendships/create.json").with(:body => {:user_id => "7505382"})).to have_been_made
|
403
|
+
end
|
404
|
+
end
|
405
|
+
context "with a URI object passed" do
|
406
|
+
before do
|
407
|
+
stub_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
408
|
+
end
|
409
|
+
it "requests the correct resource" do
|
410
|
+
user = URI.parse("https://twitter.com/sferik")
|
411
|
+
@client.follow!(user)
|
412
|
+
expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
|
413
|
+
end
|
414
|
+
end
|
415
|
+
context "with a URI string passed" do
|
416
|
+
before do
|
417
|
+
stub_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
418
|
+
end
|
419
|
+
it "requests the correct resource" do
|
420
|
+
@client.follow!("https://twitter.com/sferik")
|
421
|
+
expect(a_post("/1.1/friendships/create.json").with(:body => {:screen_name => "sferik"})).to have_been_made
|
399
422
|
end
|
400
423
|
end
|
401
424
|
end
|
@@ -412,7 +435,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
412
435
|
users = @client.friendship_destroy("sferik")
|
413
436
|
expect(users).to be_an Array
|
414
437
|
expect(users.first).to be_a Twitter::User
|
415
|
-
expect(users.first.id).to eq
|
438
|
+
expect(users.first.id).to eq(7505382)
|
416
439
|
end
|
417
440
|
end
|
418
441
|
|
@@ -427,7 +450,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
427
450
|
it "returns detailed information about the relationship between two users" do
|
428
451
|
relationship = @client.friendship_update("sferik", :retweets => true)
|
429
452
|
expect(relationship).to be_a Twitter::Relationship
|
430
|
-
expect(relationship.source.id).to eq
|
453
|
+
expect(relationship.source.id).to eq(7505382)
|
431
454
|
end
|
432
455
|
end
|
433
456
|
|
@@ -443,7 +466,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
443
466
|
it "returns detailed information about the relationship between two users" do
|
444
467
|
relationship = @client.friendship("sferik", "pengwynn")
|
445
468
|
expect(relationship).to be_a Twitter::Relationship
|
446
|
-
expect(relationship.source.id).to eq
|
469
|
+
expect(relationship.source.id).to eq(7505382)
|
447
470
|
end
|
448
471
|
end
|
449
472
|
context "with numeric screen names passed" do
|
@@ -475,6 +498,26 @@ describe Twitter::API::FriendsAndFollowers do
|
|
475
498
|
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_id => "7505382", :target_id => "14100886"})).to have_been_made
|
476
499
|
end
|
477
500
|
end
|
501
|
+
context "with URI objects passed" do
|
502
|
+
before do
|
503
|
+
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
504
|
+
end
|
505
|
+
it "requests the correct resource" do
|
506
|
+
user1 = URI.parse("https://twitter.com/sferik")
|
507
|
+
user2 = URI.parse("https://twitter.com/pengwynn")
|
508
|
+
@client.friendship(user1, user2)
|
509
|
+
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
|
510
|
+
end
|
511
|
+
end
|
512
|
+
context "with URI strings passed" do
|
513
|
+
before do
|
514
|
+
stub_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}).to_return(:body => fixture("following.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
515
|
+
end
|
516
|
+
it "requests the correct resource" do
|
517
|
+
@client.friendship("https://twitter.com/sferik", "https://twitter.com/pengwynn")
|
518
|
+
expect(a_get("/1.1/friendships/show.json").with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"})).to have_been_made
|
519
|
+
end
|
520
|
+
end
|
478
521
|
end
|
479
522
|
|
480
523
|
describe "#friendship?" do
|
@@ -530,15 +573,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
530
573
|
it "returns a cursor of followers with details for every user the specified user is followed by" do
|
531
574
|
followers = @client.followers("sferik")
|
532
575
|
expect(followers).to be_a Twitter::Cursor
|
533
|
-
expect(followers.
|
534
|
-
expect(followers.users.first).to be_a Twitter::User
|
576
|
+
expect(followers.first).to be_a Twitter::User
|
535
577
|
end
|
536
|
-
context "with
|
578
|
+
context "with each" do
|
537
579
|
before do
|
538
580
|
stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
539
581
|
end
|
540
582
|
it "requests the correct resource" do
|
541
|
-
@client.followers("sferik").
|
583
|
+
@client.followers("sferik").each{}
|
542
584
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
543
585
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"})).to have_been_made
|
544
586
|
end
|
@@ -552,12 +594,12 @@ describe Twitter::API::FriendsAndFollowers do
|
|
552
594
|
@client.followers(7505382)
|
553
595
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
554
596
|
end
|
555
|
-
context "with
|
597
|
+
context "with each" do
|
556
598
|
before do
|
557
599
|
stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :user_id => "7505382"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
558
600
|
end
|
559
601
|
it "requests the correct resource" do
|
560
|
-
@client.followers(7505382).
|
602
|
+
@client.followers(7505382).each{}
|
561
603
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
562
604
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :user_id => "7505382"})).to have_been_made
|
563
605
|
end
|
@@ -576,15 +618,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
576
618
|
it "returns a cursor of followers with details for every user the specified user is followed by" do
|
577
619
|
followers = @client.followers
|
578
620
|
expect(followers).to be_a Twitter::Cursor
|
579
|
-
expect(followers.
|
580
|
-
expect(followers.users.first).to be_a Twitter::User
|
621
|
+
expect(followers.first).to be_a Twitter::User
|
581
622
|
end
|
582
|
-
context "with
|
623
|
+
context "with each" do
|
583
624
|
before do
|
584
625
|
stub_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"}).to_return(:body => fixture("followers_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
585
626
|
end
|
586
627
|
it "requests the correct resource" do
|
587
|
-
@client.followers.
|
628
|
+
@client.followers.each{}
|
588
629
|
expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
|
589
630
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
590
631
|
expect(a_get("/1.1/followers/list.json").with(:query => {:cursor => "1419103567112105362", :screen_name => "sferik"})).to have_been_made
|
@@ -605,15 +646,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
605
646
|
it "returns a cursor of friends with details for every user the specified user is following" do
|
606
647
|
friends = @client.friends("sferik")
|
607
648
|
expect(friends).to be_a Twitter::Cursor
|
608
|
-
expect(friends.
|
609
|
-
expect(friends.users.first).to be_a Twitter::User
|
649
|
+
expect(friends.first).to be_a Twitter::User
|
610
650
|
end
|
611
|
-
context "with
|
651
|
+
context "with each" do
|
612
652
|
before do
|
613
653
|
stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
614
654
|
end
|
615
655
|
it "requests the correct resource" do
|
616
|
-
@client.friends("sferik").
|
656
|
+
@client.friends("sferik").each{}
|
617
657
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
618
658
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"})).to have_been_made
|
619
659
|
end
|
@@ -627,12 +667,12 @@ describe Twitter::API::FriendsAndFollowers do
|
|
627
667
|
@client.friends(7505382)
|
628
668
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
629
669
|
end
|
630
|
-
context "with
|
670
|
+
context "with each" do
|
631
671
|
before do
|
632
672
|
stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :user_id => "7505382"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
633
673
|
end
|
634
674
|
it "requests the correct resource" do
|
635
|
-
@client.friends(7505382).
|
675
|
+
@client.friends(7505382).each{}
|
636
676
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :user_id => "7505382"})).to have_been_made
|
637
677
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :user_id => "7505382"})).to have_been_made
|
638
678
|
end
|
@@ -651,15 +691,14 @@ describe Twitter::API::FriendsAndFollowers do
|
|
651
691
|
it "returns a cursor of friends with details for every user the specified user is following" do
|
652
692
|
friends = @client.friends
|
653
693
|
expect(friends).to be_a Twitter::Cursor
|
654
|
-
expect(friends.
|
655
|
-
expect(friends.users.first).to be_a Twitter::User
|
694
|
+
expect(friends.first).to be_a Twitter::User
|
656
695
|
end
|
657
|
-
context "with
|
696
|
+
context "with each" do
|
658
697
|
before do
|
659
698
|
stub_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"}).to_return(:body => fixture("friends_list2.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
660
699
|
end
|
661
700
|
it "requests the correct resource" do
|
662
|
-
@client.friends.
|
701
|
+
@client.friends.each{}
|
663
702
|
expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
|
664
703
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "-1", :screen_name => "sferik"})).to have_been_made
|
665
704
|
expect(a_get("/1.1/friends/list.json").with(:query => {:cursor => "1418947360875712729", :screen_name => "sferik"})).to have_been_made
|
@@ -684,7 +723,7 @@ describe Twitter::API::FriendsAndFollowers do
|
|
684
723
|
no_retweet_ids = @client.no_retweet_ids
|
685
724
|
expect(no_retweet_ids).to be_an Array
|
686
725
|
expect(no_retweet_ids.first).to be_an Integer
|
687
|
-
expect(no_retweet_ids.first).to eq
|
726
|
+
expect(no_retweet_ids.first).to eq(47)
|
688
727
|
end
|
689
728
|
end
|
690
729
|
end
|