twitter 4.8.1 → 5.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG.md +30 -0
  3. data/LICENSE.md +1 -1
  4. data/README.md +386 -266
  5. data/lib/twitter.rb +4 -39
  6. data/lib/twitter/arguments.rb +11 -0
  7. data/lib/twitter/base.rb +89 -68
  8. data/lib/twitter/client.rb +69 -110
  9. data/lib/twitter/configuration.rb +7 -3
  10. data/lib/twitter/creatable.rb +2 -4
  11. data/lib/twitter/cursor.rb +50 -42
  12. data/lib/twitter/direct_message.rb +2 -11
  13. data/lib/twitter/entity/uri.rb +13 -0
  14. data/lib/twitter/enumerable.rb +15 -0
  15. data/lib/twitter/error.rb +55 -7
  16. data/lib/twitter/error/already_favorited.rb +1 -1
  17. data/lib/twitter/error/already_posted.rb +10 -0
  18. data/lib/twitter/error/already_retweeted.rb +1 -1
  19. data/lib/twitter/error/bad_gateway.rb +2 -3
  20. data/lib/twitter/error/bad_request.rb +2 -2
  21. data/lib/twitter/error/forbidden.rb +2 -2
  22. data/lib/twitter/error/gateway_timeout.rb +2 -3
  23. data/lib/twitter/error/internal_server_error.rb +2 -3
  24. data/lib/twitter/error/not_acceptable.rb +2 -2
  25. data/lib/twitter/error/not_found.rb +2 -2
  26. data/lib/twitter/error/service_unavailable.rb +2 -3
  27. data/lib/twitter/error/too_many_requests.rb +2 -2
  28. data/lib/twitter/error/unauthorized.rb +2 -2
  29. data/lib/twitter/error/unprocessable_entity.rb +2 -2
  30. data/lib/twitter/factory.rb +2 -8
  31. data/lib/twitter/geo_factory.rb +2 -2
  32. data/lib/twitter/geo_results.rb +36 -0
  33. data/lib/twitter/identity.rb +0 -22
  34. data/lib/twitter/list.rb +18 -4
  35. data/lib/twitter/media/photo.rb +3 -3
  36. data/lib/twitter/media_factory.rb +2 -2
  37. data/lib/twitter/null_object.rb +24 -0
  38. data/lib/twitter/oembed.rb +3 -2
  39. data/lib/twitter/place.rb +15 -9
  40. data/lib/twitter/profile_banner.rb +5 -3
  41. data/lib/twitter/rate_limit.rb +1 -17
  42. data/lib/twitter/relationship.rb +2 -10
  43. data/lib/twitter/rest/api/direct_messages.rb +135 -0
  44. data/lib/twitter/rest/api/favorites.rb +120 -0
  45. data/lib/twitter/rest/api/friends_and_followers.rb +290 -0
  46. data/lib/twitter/rest/api/help.rb +58 -0
  47. data/lib/twitter/rest/api/lists.rb +491 -0
  48. data/lib/twitter/rest/api/oauth.rb +45 -0
  49. data/lib/twitter/rest/api/places_and_geo.rb +104 -0
  50. data/lib/twitter/rest/api/saved_searches.rb +91 -0
  51. data/lib/twitter/rest/api/search.rb +37 -0
  52. data/lib/twitter/rest/api/spam_reporting.rb +29 -0
  53. data/lib/twitter/rest/api/suggested_users.rb +51 -0
  54. data/lib/twitter/rest/api/timelines.rb +202 -0
  55. data/lib/twitter/rest/api/trends.rb +58 -0
  56. data/lib/twitter/rest/api/tweets.rb +293 -0
  57. data/lib/twitter/rest/api/undocumented.rb +52 -0
  58. data/lib/twitter/rest/api/users.rb +383 -0
  59. data/lib/twitter/rest/api/utils.rb +219 -0
  60. data/lib/twitter/rest/client.rb +193 -0
  61. data/lib/twitter/rest/request/multipart_with_file.rb +36 -0
  62. data/lib/twitter/rest/response/parse_json.rb +27 -0
  63. data/lib/twitter/{response → rest/response}/raise_error.rb +8 -11
  64. data/lib/twitter/search_results.rb +33 -21
  65. data/lib/twitter/settings.rb +1 -6
  66. data/lib/twitter/size.rb +1 -1
  67. data/lib/twitter/streaming/client.rb +77 -0
  68. data/lib/twitter/streaming/connection.rb +22 -0
  69. data/lib/twitter/streaming/response.rb +30 -0
  70. data/lib/twitter/suggestion.rb +4 -2
  71. data/lib/twitter/token.rb +8 -0
  72. data/lib/twitter/trend.rb +2 -1
  73. data/lib/twitter/trend_results.rb +59 -0
  74. data/lib/twitter/tweet.rb +41 -85
  75. data/lib/twitter/user.rb +51 -41
  76. data/lib/twitter/version.rb +4 -4
  77. data/spec/fixtures/already_posted.json +1 -0
  78. data/spec/fixtures/ids_list.json +1 -1
  79. data/spec/fixtures/ids_list2.json +1 -1
  80. data/spec/fixtures/search.json +1 -1
  81. data/spec/fixtures/search_malformed.json +1 -1
  82. data/spec/fixtures/track_streaming.json +3 -0
  83. data/spec/helper.rb +8 -13
  84. data/spec/twitter/base_spec.rb +25 -99
  85. data/spec/twitter/configuration_spec.rb +1 -1
  86. data/spec/twitter/cursor_spec.rb +13 -31
  87. data/spec/twitter/direct_message_spec.rb +41 -8
  88. data/spec/twitter/entity/uri_spec.rb +74 -0
  89. data/spec/twitter/error_spec.rb +59 -11
  90. data/spec/twitter/geo/point_spec.rb +1 -1
  91. data/spec/twitter/geo_factory_spec.rb +3 -3
  92. data/spec/twitter/geo_results_spec.rb +35 -0
  93. data/spec/twitter/identifiable_spec.rb +0 -21
  94. data/spec/twitter/list_spec.rb +51 -8
  95. data/spec/twitter/media/photo_spec.rb +118 -3
  96. data/spec/twitter/media_factory_spec.rb +2 -2
  97. data/spec/twitter/null_object_spec.rb +26 -0
  98. data/spec/twitter/oembed_spec.rb +69 -45
  99. data/spec/twitter/place_spec.rb +68 -12
  100. data/spec/twitter/profile_banner_spec.rb +1 -1
  101. data/spec/twitter/rate_limit_spec.rb +12 -12
  102. data/spec/twitter/relationship_spec.rb +31 -9
  103. data/spec/twitter/{api → rest/api}/direct_messages_spec.rb +22 -9
  104. data/spec/twitter/{api → rest/api}/favorites_spec.rb +80 -7
  105. data/spec/twitter/{api → rest/api}/friends_and_followers_spec.rb +104 -65
  106. data/spec/twitter/{api → rest/api}/geo_spec.rb +10 -10
  107. data/spec/twitter/{api → rest/api}/help_spec.rb +6 -6
  108. data/spec/twitter/{api → rest/api}/lists_spec.rb +77 -56
  109. data/spec/twitter/{api → rest/api}/oauth_spec.rb +6 -6
  110. data/spec/twitter/{api → rest/api}/saved_searches_spec.rb +7 -7
  111. data/spec/twitter/{api → rest/api}/search_spec.rb +8 -9
  112. data/spec/twitter/{api → rest/api}/spam_reporting_spec.rb +3 -3
  113. data/spec/twitter/{api → rest/api}/suggested_users_spec.rb +5 -5
  114. data/spec/twitter/{api → rest/api}/timelines_spec.rb +9 -9
  115. data/spec/twitter/{api → rest/api}/trends_spec.rb +6 -6
  116. data/spec/twitter/rest/api/tweets_spec.rb +503 -0
  117. data/spec/twitter/{api → rest/api}/undocumented_spec.rb +19 -45
  118. data/spec/twitter/{api → rest/api}/users_spec.rb +60 -35
  119. data/spec/twitter/rest/client_spec.rb +193 -0
  120. data/spec/twitter/saved_search_spec.rb +11 -0
  121. data/spec/twitter/search_results_spec.rb +29 -42
  122. data/spec/twitter/settings_spec.rb +17 -6
  123. data/spec/twitter/streaming/client_spec.rb +75 -0
  124. data/spec/twitter/token_spec.rb +16 -0
  125. data/spec/twitter/trend_results_spec.rb +89 -0
  126. data/spec/twitter/trend_spec.rb +23 -0
  127. data/spec/twitter/tweet_spec.rb +122 -115
  128. data/spec/twitter/user_spec.rb +136 -77
  129. data/spec/twitter_spec.rb +0 -119
  130. data/twitter.gemspec +8 -5
  131. metadata +148 -141
  132. metadata.gz.sig +0 -0
  133. data/lib/twitter/action/favorite.rb +0 -19
  134. data/lib/twitter/action/follow.rb +0 -30
  135. data/lib/twitter/action/list_member_added.rb +0 -39
  136. data/lib/twitter/action/mention.rb +0 -46
  137. data/lib/twitter/action/reply.rb +0 -27
  138. data/lib/twitter/action/retweet.rb +0 -27
  139. data/lib/twitter/action/tweet.rb +0 -20
  140. data/lib/twitter/action_factory.rb +0 -22
  141. data/lib/twitter/api/arguments.rb +0 -13
  142. data/lib/twitter/api/direct_messages.rb +0 -148
  143. data/lib/twitter/api/favorites.rb +0 -126
  144. data/lib/twitter/api/friends_and_followers.rb +0 -334
  145. data/lib/twitter/api/help.rb +0 -64
  146. data/lib/twitter/api/lists.rb +0 -618
  147. data/lib/twitter/api/oauth.rb +0 -44
  148. data/lib/twitter/api/places_and_geo.rb +0 -121
  149. data/lib/twitter/api/saved_searches.rb +0 -99
  150. data/lib/twitter/api/search.rb +0 -37
  151. data/lib/twitter/api/spam_reporting.rb +0 -30
  152. data/lib/twitter/api/suggested_users.rb +0 -55
  153. data/lib/twitter/api/timelines.rb +0 -214
  154. data/lib/twitter/api/trends.rb +0 -63
  155. data/lib/twitter/api/tweets.rb +0 -304
  156. data/lib/twitter/api/undocumented.rb +0 -97
  157. data/lib/twitter/api/users.rb +0 -439
  158. data/lib/twitter/api/utils.rb +0 -187
  159. data/lib/twitter/configurable.rb +0 -96
  160. data/lib/twitter/default.rb +0 -102
  161. data/lib/twitter/entity/url.rb +0 -9
  162. data/lib/twitter/error/client_error.rb +0 -35
  163. data/lib/twitter/error/decode_error.rb +0 -9
  164. data/lib/twitter/error/identity_map_key_error.rb +0 -9
  165. data/lib/twitter/error/server_error.rb +0 -28
  166. data/lib/twitter/exceptable.rb +0 -36
  167. data/lib/twitter/identity_map.rb +0 -22
  168. data/lib/twitter/request/multipart_with_file.rb +0 -34
  169. data/lib/twitter/response/parse_json.rb +0 -25
  170. data/spec/fixtures/about_me.json +0 -1
  171. data/spec/fixtures/activity_summary.json +0 -1
  172. data/spec/fixtures/bad_gateway.json +0 -1
  173. data/spec/fixtures/bad_request.json +0 -1
  174. data/spec/fixtures/by_friends.json +0 -1
  175. data/spec/fixtures/end_session.json +0 -1
  176. data/spec/fixtures/forbidden.json +0 -1
  177. data/spec/fixtures/internal_server_error.json +0 -1
  178. data/spec/fixtures/not_acceptable.json +0 -1
  179. data/spec/fixtures/phoenix_search.phoenix +0 -1
  180. data/spec/fixtures/resolve.json +0 -1
  181. data/spec/fixtures/service_unavailable.json +0 -1
  182. data/spec/fixtures/totals.json +0 -1
  183. data/spec/fixtures/trends.json +0 -1
  184. data/spec/fixtures/unauthorized.json +0 -1
  185. data/spec/fixtures/video_facets.json +0 -1
  186. data/spec/twitter/action/favorite_spec.rb +0 -29
  187. data/spec/twitter/action/follow_spec.rb +0 -29
  188. data/spec/twitter/action/list_member_added_spec.rb +0 -41
  189. data/spec/twitter/action/mention_spec.rb +0 -52
  190. data/spec/twitter/action/reply_spec.rb +0 -41
  191. data/spec/twitter/action/retweet_spec.rb +0 -41
  192. data/spec/twitter/action_factory_spec.rb +0 -35
  193. data/spec/twitter/action_spec.rb +0 -16
  194. data/spec/twitter/api/tweets_spec.rb +0 -285
  195. data/spec/twitter/client_spec.rb +0 -223
  196. data/spec/twitter/error/client_error_spec.rb +0 -23
  197. data/spec/twitter/error/server_error_spec.rb +0 -20
@@ -1,9 +1,9 @@
1
1
  require 'helper'
2
2
 
3
- describe Twitter::API::PlacesAndGeo do
3
+ describe Twitter::REST::API::PlacesAndGeo 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 "#place" do
@@ -16,7 +16,7 @@ describe Twitter::API::PlacesAndGeo do
16
16
  end
17
17
  it "returns a place" do
18
18
  place = @client.place("247f43d441defc03")
19
- expect(place.name).to eq "Twitter HQ"
19
+ expect(place.name).to eq("Twitter HQ")
20
20
  end
21
21
  end
22
22
 
@@ -30,8 +30,8 @@ describe Twitter::API::PlacesAndGeo do
30
30
  end
31
31
  it "returns places" do
32
32
  places = @client.reverse_geocode(:lat => "37.7821120598956", :long => "-122.400612831116")
33
- expect(places).to be_an Array
34
- expect(places.first.name).to eq "Bernal Heights"
33
+ expect(places).to be_a Twitter::GeoResults
34
+ expect(places.first.name).to eq("Bernal Heights")
35
35
  end
36
36
  end
37
37
 
@@ -45,8 +45,8 @@ describe Twitter::API::PlacesAndGeo do
45
45
  end
46
46
  it "returns nearby places" do
47
47
  places = @client.geo_search(:ip => "74.125.19.104")
48
- expect(places).to be_an Array
49
- expect(places.first.name).to eq "Bernal Heights"
48
+ expect(places).to be_a Twitter::GeoResults
49
+ expect(places.first.name).to eq("Bernal Heights")
50
50
  end
51
51
  end
52
52
 
@@ -60,8 +60,8 @@ describe Twitter::API::PlacesAndGeo do
60
60
  end
61
61
  it "returns similar places" do
62
62
  places = @client.similar_places(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ")
63
- expect(places).to be_an Array
64
- expect(places.first.name).to eq "Bernal Heights"
63
+ expect(places).to be_a Twitter::GeoResults
64
+ expect(places.first.name).to eq("Bernal Heights")
65
65
  end
66
66
  end
67
67
 
@@ -75,7 +75,7 @@ describe Twitter::API::PlacesAndGeo do
75
75
  end
76
76
  it "returns a place" do
77
77
  place = @client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581")
78
- expect(place.name).to eq "Twitter HQ"
78
+ expect(place.name).to eq("Twitter HQ")
79
79
  end
80
80
  end
81
81
 
@@ -1,9 +1,9 @@
1
1
  require 'helper'
2
2
 
3
- describe Twitter::API::Help do
3
+ describe Twitter::REST::API::Help 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 "#configuration" do
@@ -17,7 +17,7 @@ describe Twitter::API::Help do
17
17
  it "returns Twitter's current configuration" do
18
18
  configuration = @client.configuration
19
19
  expect(configuration).to be_a Twitter::Configuration
20
- expect(configuration.characters_reserved_per_media).to eq 20
20
+ expect(configuration.characters_reserved_per_media).to eq(20)
21
21
  end
22
22
  end
23
23
 
@@ -33,7 +33,7 @@ describe Twitter::API::Help do
33
33
  languages = @client.languages
34
34
  expect(languages).to be_an Array
35
35
  expect(languages.first).to be_a Twitter::Language
36
- expect(languages.first.name).to eq "Portuguese"
36
+ expect(languages.first.name).to eq("Portuguese")
37
37
  end
38
38
  end
39
39
 
@@ -47,7 +47,7 @@ describe Twitter::API::Help do
47
47
  end
48
48
  it "returns Twitter's Privacy Policy" do
49
49
  privacy = @client.privacy
50
- expect(privacy.split.first).to eq "Twitter"
50
+ expect(privacy.split.first).to eq("Twitter")
51
51
  end
52
52
  end
53
53
 
@@ -61,7 +61,7 @@ describe Twitter::API::Help do
61
61
  end
62
62
  it "returns Twitter's Terms of Service" do
63
63
  tos = @client.tos
64
- expect(tos.split.first).to eq "Terms"
64
+ expect(tos.split.first).to eq("Terms")
65
65
  end
66
66
  end
67
67
 
@@ -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 "Rubyists"
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 "Happy Birthday @imdane. Watch out for those @rally pranksters!"
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
@@ -62,7 +89,7 @@ describe Twitter::API::Lists do
62
89
  it "returns the list" do
63
90
  list = @client.list_remove_member("sferik", "presidents", 813286)
64
91
  expect(list).to be_a Twitter::List
65
- expect(list.name).to eq "presidents"
92
+ expect(list.name).to eq("presidents")
66
93
  end
67
94
  end
68
95
  context "without a screen name passed" do
@@ -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.lists).to be_an Array
93
- expect(memberships.lists.first).to be_a Twitter::List
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 all" do
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").all
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 all" do
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).all
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 all" do
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.all
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.users).to be_an Array
161
- expect(list_subscribers.users.first).to be_a Twitter::User
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 all" do
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").all
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 all" do
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").all
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 all" do
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").all
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 "presidents"
253
+ expect(list.name).to eq("presidents")
229
254
  end
230
255
  end
231
256
  context "without a screen name 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 "presidents"
353
+ expect(list.name).to eq("presidents")
329
354
  end
330
355
  end
331
356
  context "without a screen name passed" do
@@ -352,7 +377,7 @@ describe Twitter::API::Lists do
352
377
  it "returns the list" do
353
378
  list = @client.list_add_members("sferik", "presidents", [813286, 18755393])
354
379
  expect(list).to be_a Twitter::List
355
- expect(list.name).to eq "presidents"
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
@@ -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.users).to be_an Array
465
- expect(list_members.users.first).to be_a Twitter::User
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 all" do
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").all
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 all" do
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").all
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 all" do
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").all
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
@@ -529,7 +553,7 @@ describe Twitter::API::Lists do
529
553
  it "returns the list" do
530
554
  list = @client.list_add_member("sferik", "presidents", 813286)
531
555
  expect(list).to be_a Twitter::List
532
- expect(list.name).to eq "presidents"
556
+ expect(list.name).to eq("presidents")
533
557
  end
534
558
  end
535
559
  context "without a screen name passed" do
@@ -556,7 +580,7 @@ describe Twitter::API::Lists do
556
580
  it "returns the deleted list" do
557
581
  list = @client.list_destroy("sferik", "presidents")
558
582
  expect(list).to be_a Twitter::List
559
- expect(list.name).to eq "presidents"
583
+ expect(list.name).to eq("presidents")
560
584
  end
561
585
  end
562
586
  context "without a screen name passed" do
@@ -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 "presidents"
629
+ expect(list.name).to eq("presidents")
606
630
  end
607
631
  end
608
632
  context "without a screen name passed" do
@@ -647,7 +671,7 @@ describe Twitter::API::Lists do
647
671
  it "returns the created list" do
648
672
  list = @client.list_create("presidents")
649
673
  expect(list).to be_a Twitter::List
650
- expect(list.name).to eq "presidents"
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 "presidents"
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.lists).to be_an Array
732
- expect(subscriptions.lists.first).to be_a Twitter::List
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 all" do
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").all
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 all" do
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).all
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 all" do
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.all
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
@@ -796,7 +819,7 @@ describe Twitter::API::Lists do
796
819
  it "returns the list" do
797
820
  list = @client.list_remove_members("sferik", "presidents", [813286, 18755393])
798
821
  expect(list).to be_a Twitter::List
799
- expect(list.name).to eq "presidents"
822
+ expect(list.name).to eq("presidents")
800
823
  end
801
824
  end
802
825
  context "with a user ID passed" do
@@ -841,9 +864,8 @@ describe Twitter::API::Lists do
841
864
  it "returns the requested list" do
842
865
  lists = @client.lists_owned("sferik")
843
866
  expect(lists).to be_a Twitter::Cursor
844
- expect(lists.lists).to be_an Array
845
- expect(lists.lists.first).to be_a Twitter::List
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
@@ -858,9 +880,8 @@ describe Twitter::API::Lists do
858
880
  it "returns the requested list" do
859
881
  lists = @client.lists_owned
860
882
  expect(lists).to be_a Twitter::Cursor
861
- expect(lists.lists).to be_an Array
862
- expect(lists.lists.first).to be_a Twitter::List
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