twitter 5.11.0 → 5.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/README.md +7 -5
- data/lib/twitter/arguments.rb +1 -0
- data/lib/twitter/base.rb +4 -5
- data/lib/twitter/basic_user.rb +1 -0
- data/lib/twitter/client.rb +10 -9
- data/lib/twitter/configuration.rb +4 -2
- data/lib/twitter/cursor.rb +3 -2
- data/lib/twitter/direct_message.rb +1 -0
- data/lib/twitter/entity.rb +1 -0
- data/lib/twitter/entity/hashtag.rb +1 -0
- data/lib/twitter/entity/symbol.rb +1 -0
- data/lib/twitter/entity/user_mention.rb +4 -1
- data/lib/twitter/error.rb +22 -19
- data/lib/twitter/geo.rb +1 -0
- data/lib/twitter/geo_results.rb +3 -2
- data/lib/twitter/identity.rb +1 -0
- data/lib/twitter/language.rb +1 -0
- data/lib/twitter/list.rb +12 -5
- data/lib/twitter/media/photo.rb +1 -0
- data/lib/twitter/metadata.rb +1 -0
- data/lib/twitter/null_object.rb +22 -0
- data/lib/twitter/oembed.rb +5 -2
- data/lib/twitter/place.rb +4 -1
- data/lib/twitter/profile.rb +1 -1
- data/lib/twitter/rest/client.rb +4 -4
- data/lib/twitter/rest/favorites.rb +4 -3
- data/lib/twitter/rest/lists.rb +18 -3
- data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
- data/lib/twitter/rest/response/parse_json.rb +1 -1
- data/lib/twitter/rest/response/raise_error.rb +4 -5
- data/lib/twitter/rest/tweets.rb +2 -1
- data/lib/twitter/rest/users.rb +10 -7
- data/lib/twitter/saved_search.rb +1 -0
- data/lib/twitter/search_results.rb +3 -2
- data/lib/twitter/settings.rb +7 -3
- data/lib/twitter/size.rb +4 -1
- data/lib/twitter/streaming/deleted_tweet.rb +1 -0
- data/lib/twitter/streaming/event.rb +2 -2
- data/lib/twitter/streaming/message_parser.rb +1 -1
- data/lib/twitter/suggestion.rb +4 -1
- data/lib/twitter/token.rb +1 -0
- data/lib/twitter/trend.rb +1 -0
- data/lib/twitter/trend_results.rb +3 -2
- data/lib/twitter/tweet.rb +9 -6
- data/lib/twitter/user.rb +15 -13
- data/lib/twitter/utils.rb +2 -6
- data/lib/twitter/version.rb +1 -1
- data/twitter.gemspec +6 -9
- metadata +6 -259
- data/Rakefile +0 -37
- data/spec/fixtures/already_favorited.json +0 -1
- data/spec/fixtures/already_posted.json +0 -1
- data/spec/fixtures/already_retweeted.json +0 -1
- data/spec/fixtures/bearer_token.json +0 -1
- data/spec/fixtures/category.json +0 -1
- data/spec/fixtures/configuration.json +0 -1
- data/spec/fixtures/contributees.json +0 -1
- data/spec/fixtures/count.json +0 -1
- data/spec/fixtures/direct_message.json +0 -1
- data/spec/fixtures/direct_messages.json +0 -1
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/followers_list.json +0 -1
- data/spec/fixtures/followers_list2.json +0 -1
- data/spec/fixtures/following.json +0 -1
- data/spec/fixtures/forbidden.json +0 -1
- data/spec/fixtures/friends_list.json +0 -1
- data/spec/fixtures/friends_list2.json +0 -1
- data/spec/fixtures/friendships.json +0 -1
- data/spec/fixtures/ids.json +0 -1
- data/spec/fixtures/ids_list.json +0 -1
- data/spec/fixtures/ids_list2.json +0 -1
- data/spec/fixtures/languages.json +0 -1
- data/spec/fixtures/list.json +0 -1
- data/spec/fixtures/lists.json +0 -1
- data/spec/fixtures/locations.json +0 -1
- data/spec/fixtures/matching_trends.json +0 -1
- data/spec/fixtures/me.jpeg +0 -0
- data/spec/fixtures/members.json +0 -1
- data/spec/fixtures/memberships.json +0 -1
- data/spec/fixtures/memberships2.json +0 -1
- data/spec/fixtures/not_following.json +0 -1
- data/spec/fixtures/not_found.json +0 -1
- data/spec/fixtures/oembed.json +0 -1
- data/spec/fixtures/ownerships.json +0 -1
- data/spec/fixtures/pbjt.gif +0 -0
- data/spec/fixtures/pengwynn.json +0 -1
- data/spec/fixtures/place.json +0 -1
- data/spec/fixtures/places.json +0 -1
- data/spec/fixtures/privacy.json +0 -1
- data/spec/fixtures/profile_banner.json +0 -1
- data/spec/fixtures/request_token.txt +0 -6
- data/spec/fixtures/retweet.json +0 -1
- data/spec/fixtures/retweets.json +0 -1
- data/spec/fixtures/saved_search.json +0 -1
- data/spec/fixtures/saved_searches.json +0 -1
- data/spec/fixtures/search.json +0 -1
- data/spec/fixtures/search2.json +0 -1
- data/spec/fixtures/search_malformed.json +0 -1
- data/spec/fixtures/settings.json +0 -1
- data/spec/fixtures/sferik.json +0 -1
- data/spec/fixtures/status.json +0 -1
- data/spec/fixtures/statuses.json +0 -1
- data/spec/fixtures/subscriptions.json +0 -1
- data/spec/fixtures/subscriptions2.json +0 -1
- data/spec/fixtures/suggestions.json +0 -1
- data/spec/fixtures/tos.json +0 -1
- data/spec/fixtures/track_streaming.json +0 -3
- data/spec/fixtures/track_streaming_user.json +0 -6
- data/spec/fixtures/upload.json +0 -1
- data/spec/fixtures/user_search.json +0 -1
- data/spec/fixtures/user_timeline.json +0 -1
- data/spec/fixtures/users.json +0 -1
- data/spec/fixtures/users_list.json +0 -1
- data/spec/fixtures/users_list2.json +0 -1
- data/spec/fixtures/we_concept_bg2.png +0 -0
- data/spec/fixtures/wildcomet2.jpe +0 -0
- data/spec/helper.rb +0 -68
- data/spec/twitter/base_spec.rb +0 -39
- data/spec/twitter/basic_user_spec.rb +0 -23
- data/spec/twitter/configuration_spec.rb +0 -17
- data/spec/twitter/cursor_spec.rb +0 -30
- data/spec/twitter/direct_message_spec.rb +0 -232
- data/spec/twitter/entity/uri_spec.rb +0 -75
- data/spec/twitter/error_spec.rb +0 -52
- data/spec/twitter/geo/point_spec.rb +0 -41
- data/spec/twitter/geo/polygon_spec.rb +0 -29
- data/spec/twitter/geo_factory_spec.rb +0 -19
- data/spec/twitter/geo_results_spec.rb +0 -35
- data/spec/twitter/geo_spec.rb +0 -29
- data/spec/twitter/identifiable_spec.rb +0 -29
- data/spec/twitter/list_spec.rb +0 -88
- data/spec/twitter/media/photo_spec.rb +0 -151
- data/spec/twitter/media_factory_spec.rb +0 -15
- data/spec/twitter/oembed_spec.rb +0 -170
- data/spec/twitter/place_spec.rb +0 -168
- data/spec/twitter/profile_banner_spec.rb +0 -13
- data/spec/twitter/rate_limit_spec.rb +0 -59
- data/spec/twitter/relationship_spec.rb +0 -49
- data/spec/twitter/rest/client_spec.rb +0 -217
- data/spec/twitter/rest/direct_messages_spec.rb +0 -133
- data/spec/twitter/rest/favorites_spec.rb +0 -188
- data/spec/twitter/rest/friends_and_followers_spec.rb +0 -667
- data/spec/twitter/rest/geo_spec.rb +0 -68
- data/spec/twitter/rest/help_spec.rb +0 -68
- data/spec/twitter/rest/lists_spec.rb +0 -910
- data/spec/twitter/rest/media_spec.rb +0 -54
- data/spec/twitter/rest/oauth_spec.rb +0 -63
- data/spec/twitter/rest/saved_searches_spec.rb +0 -98
- data/spec/twitter/rest/search_spec.rb +0 -42
- data/spec/twitter/rest/spam_reporting_spec.rb +0 -25
- data/spec/twitter/rest/suggested_users_spec.rb +0 -59
- data/spec/twitter/rest/timelines_spec.rb +0 -138
- data/spec/twitter/rest/trends_spec.rb +0 -68
- data/spec/twitter/rest/tweets_spec.rb +0 -614
- data/spec/twitter/rest/undocumented_spec.rb +0 -103
- data/spec/twitter/rest/users_spec.rb +0 -797
- data/spec/twitter/saved_search_spec.rb +0 -45
- data/spec/twitter/search_results_spec.rb +0 -30
- data/spec/twitter/settings_spec.rb +0 -27
- data/spec/twitter/size_spec.rb +0 -28
- data/spec/twitter/source_user_spec.rb +0 -23
- data/spec/twitter/streaming/client_spec.rb +0 -123
- data/spec/twitter/streaming/connection_spec.rb +0 -32
- data/spec/twitter/streaming/deleted_tweet_spec.rb +0 -23
- data/spec/twitter/streaming/event_spec.rb +0 -43
- data/spec/twitter/streaming/friend_list_spec.rb +0 -11
- data/spec/twitter/streaming/message_parser_spec.rb +0 -54
- data/spec/twitter/streaming/response_spec.rb +0 -21
- data/spec/twitter/suggestion_spec.rb +0 -40
- data/spec/twitter/target_user_spec.rb +0 -23
- data/spec/twitter/token_spec.rb +0 -16
- data/spec/twitter/trend_results_spec.rb +0 -89
- data/spec/twitter/trend_spec.rb +0 -51
- data/spec/twitter/tweet_spec.rb +0 -456
- data/spec/twitter/user_spec.rb +0 -447
- data/spec/twitter/utils_spec.rb +0 -34
data/lib/twitter/null_object.rb
CHANGED
@@ -2,11 +2,33 @@ require 'naught'
|
|
2
2
|
|
3
3
|
module Twitter
|
4
4
|
NullObject = Naught.build do |config|
|
5
|
+
include Comparable
|
6
|
+
|
5
7
|
config.black_hole
|
6
8
|
config.define_explicit_conversions
|
7
9
|
config.define_implicit_conversions
|
8
10
|
config.predicates_return false
|
9
11
|
|
12
|
+
def instance_of?(klass)
|
13
|
+
fail(TypeError.new('class or module required')) unless klass.is_a?(Class)
|
14
|
+
self.class == klass
|
15
|
+
end
|
16
|
+
|
17
|
+
def kind_of?(mod)
|
18
|
+
fail(TypeError.new('class or module required')) unless mod.is_a?(Module)
|
19
|
+
self.class.ancestors.include?(mod)
|
20
|
+
end
|
21
|
+
|
22
|
+
alias_method :is_a?, :kind_of?
|
23
|
+
|
24
|
+
def <=>(other)
|
25
|
+
if other.is_a?(self.class)
|
26
|
+
0
|
27
|
+
else
|
28
|
+
-1
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
10
32
|
def nil?
|
11
33
|
true
|
12
34
|
end
|
data/lib/twitter/oembed.rb
CHANGED
@@ -2,8 +2,11 @@ require 'twitter/base'
|
|
2
2
|
|
3
3
|
module Twitter
|
4
4
|
class OEmbed < Twitter::Base
|
5
|
-
|
6
|
-
|
5
|
+
# @return [Integer]
|
6
|
+
attr_reader :height, :width
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :author_name, :cache_age, :html, :provider_name, :type,
|
9
|
+
:version
|
7
10
|
uri_attr_reader :author_uri, :provider_uri, :uri
|
8
11
|
end
|
9
12
|
end
|
data/lib/twitter/place.rb
CHANGED
@@ -3,7 +3,10 @@ require 'twitter/identity'
|
|
3
3
|
|
4
4
|
module Twitter
|
5
5
|
class Place < Twitter::Identity
|
6
|
-
|
6
|
+
# @return [Hash]
|
7
|
+
attr_reader :attributes
|
8
|
+
# @return [String]
|
9
|
+
attr_reader :country, :full_name, :name
|
7
10
|
alias_method :woe_id, :id
|
8
11
|
alias_method :woeid, :id
|
9
12
|
object_attr_reader :GeoFactory, :bounding_box
|
data/lib/twitter/profile.rb
CHANGED
@@ -11,7 +11,7 @@ module Twitter
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def alias_predicate_uri_methods(method)
|
14
|
-
%w
|
14
|
+
%w(_url? _uri_https? _url_https?).each do |replacement|
|
15
15
|
alias_method_sub(method, PREDICATE_URI_METHOD_REGEX, replacement)
|
16
16
|
end
|
17
17
|
end
|
data/lib/twitter/rest/client.rb
CHANGED
@@ -41,7 +41,7 @@ module Twitter
|
|
41
41
|
:open_timeout => 10,
|
42
42
|
:timeout => 30,
|
43
43
|
},
|
44
|
-
:proxy => proxy
|
44
|
+
:proxy => proxy,
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
@@ -59,15 +59,15 @@ module Twitter
|
|
59
59
|
def middleware
|
60
60
|
@middleware ||= Faraday::RackBuilder.new do |faraday|
|
61
61
|
# Convert file uploads to Faraday::UploadIO objects
|
62
|
-
faraday.request :
|
62
|
+
faraday.request :twitter_multipart_with_file
|
63
63
|
# Checks for files in the payload, otherwise leaves everything untouched
|
64
64
|
faraday.request :multipart
|
65
65
|
# Encodes as "application/x-www-form-urlencoded" if not already encoded
|
66
66
|
faraday.request :url_encoded
|
67
67
|
# Handle error responses
|
68
|
-
faraday.response :
|
68
|
+
faraday.response :twitter_raise_error
|
69
69
|
# Parse JSON response bodies
|
70
|
-
faraday.response :
|
70
|
+
faraday.response :twitter_parse_json
|
71
71
|
# Set default HTTP adapter
|
72
72
|
faraday.adapter :net_http
|
73
73
|
end
|
@@ -71,7 +71,7 @@ module Twitter
|
|
71
71
|
pmap(arguments) do |tweet|
|
72
72
|
begin
|
73
73
|
perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
|
74
|
-
rescue Twitter::Error::AlreadyFavorited
|
74
|
+
rescue Twitter::Error::AlreadyFavorited, Twitter::Error::NotFound
|
75
75
|
next
|
76
76
|
end
|
77
77
|
end.compact
|
@@ -86,11 +86,12 @@ module Twitter
|
|
86
86
|
# @rate_limited No
|
87
87
|
# @authentication Requires user context
|
88
88
|
# @raise [Twitter::Error::AlreadyFavorited] Error raised when tweet has already been favorited.
|
89
|
+
# @raise [Twitter::Error::NotFound] Error raised when tweet does not exist or has been deleted.
|
89
90
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
90
91
|
# @return [Array<Twitter::Tweet>] The favorited Tweets.
|
91
|
-
# @overload favorite(*tweets)
|
92
|
+
# @overload favorite!(*tweets)
|
92
93
|
# @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
|
93
|
-
# @overload favorite(*tweets, options)
|
94
|
+
# @overload favorite!(*tweets, options)
|
94
95
|
# @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
|
95
96
|
# @param options [Hash] A customizable set of options.
|
96
97
|
def favorite!(*args)
|
data/lib/twitter/rest/lists.rb
CHANGED
@@ -40,6 +40,7 @@ module Twitter
|
|
40
40
|
# @see https://dev.twitter.com/docs/api/1.1/get/lists/statuses
|
41
41
|
# @rate_limited Yes
|
42
42
|
# @authentication Requires user context
|
43
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
43
44
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
44
45
|
# @return [Array<Twitter::Tweet>]
|
45
46
|
# @overload list_timeline(list, options = {})
|
@@ -67,6 +68,7 @@ module Twitter
|
|
67
68
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/members/destroy
|
68
69
|
# @rate_limited No
|
69
70
|
# @authentication Requires user context
|
71
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
70
72
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
71
73
|
# @return [Twitter::List] The list.
|
72
74
|
# @overload remove_list_member(list, user_to_remove, options = {})
|
@@ -108,6 +110,7 @@ module Twitter
|
|
108
110
|
# @see https://dev.twitter.com/docs/api/1.1/get/lists/subscribers
|
109
111
|
# @rate_limited Yes
|
110
112
|
# @authentication Requires user context
|
113
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
111
114
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
112
115
|
# @return [Twitter::Cursor] The subscribers of the specified list.
|
113
116
|
# @overload list_subscribers(list, options = {})
|
@@ -126,6 +129,7 @@ module Twitter
|
|
126
129
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/subscribers/create
|
127
130
|
# @rate_limited No
|
128
131
|
# @authentication Requires user context
|
132
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
129
133
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
130
134
|
# @return [Twitter::List] The specified list.
|
131
135
|
# @overload list_subscribe(list, options = {})
|
@@ -144,6 +148,7 @@ module Twitter
|
|
144
148
|
# @see https://dev.twitter.com/docs/api/1.1/get/lists/subscribers/show
|
145
149
|
# @rate_limited Yes
|
146
150
|
# @authentication Requires user context
|
151
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
147
152
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
148
153
|
# @return [Boolean] true if user is a subscriber of the specified list, otherwise false.
|
149
154
|
# @overload list_subscriber?(list, user_to_check, options = {})
|
@@ -165,6 +170,7 @@ module Twitter
|
|
165
170
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/subscribers/destroy
|
166
171
|
# @rate_limited No
|
167
172
|
# @authentication Requires user context
|
173
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
168
174
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
169
175
|
# @return [Twitter::List] The specified list.
|
170
176
|
# @overload list_unsubscribe(list, options = {})
|
@@ -181,9 +187,11 @@ module Twitter
|
|
181
187
|
# Adds specified members to a list
|
182
188
|
#
|
183
189
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/members/create_all
|
184
|
-
# @note Lists are limited to having
|
190
|
+
# @note Lists are limited to having 5,000 members, and you are limited to adding up to 100 members to a list at a time with this method.
|
185
191
|
# @rate_limited No
|
186
192
|
# @authentication Requires user context
|
193
|
+
# @raise [Twitter::Error::Forbidden] Error raised when user has already been added.
|
194
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
187
195
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
188
196
|
# @return [Twitter::List] The list.
|
189
197
|
# @overload add_list_members(list, users, options = {})
|
@@ -205,6 +213,7 @@ module Twitter
|
|
205
213
|
# @see https://dev.twitter.com/docs/api/1.1/get/lists/members/show
|
206
214
|
# @authentication Requires user context
|
207
215
|
# @rate_limited Yes
|
216
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
208
217
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
209
218
|
# @return [Boolean] true if user is a member of the specified list, otherwise false.
|
210
219
|
# @overload list_member?(list, user_to_check, options = {})
|
@@ -225,6 +234,7 @@ module Twitter
|
|
225
234
|
# @see https://dev.twitter.com/docs/api/1.1/get/lists/members
|
226
235
|
# @rate_limited Yes
|
227
236
|
# @authentication Requires user context
|
237
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
228
238
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
229
239
|
# @return [Twitter::Cursor]
|
230
240
|
# @overload list_members(list, options = {})
|
@@ -241,9 +251,10 @@ module Twitter
|
|
241
251
|
# Add a member to a list
|
242
252
|
#
|
243
253
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/members/create
|
244
|
-
# @note Lists are limited to having
|
254
|
+
# @note Lists are limited to having 5,000 members.
|
245
255
|
# @rate_limited No
|
246
256
|
# @authentication Requires user context
|
257
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
247
258
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
248
259
|
# @return [Twitter::List] The list.
|
249
260
|
# @overload add_list_member(list, user_to_add, options = {})
|
@@ -266,6 +277,7 @@ module Twitter
|
|
266
277
|
# @note Must be owned by the authenticated user.
|
267
278
|
# @rate_limited No
|
268
279
|
# @authentication Requires user context
|
280
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
269
281
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
270
282
|
# @return [Twitter::List] The deleted list.
|
271
283
|
# @overload destroy_list(list, options = {})
|
@@ -285,6 +297,7 @@ module Twitter
|
|
285
297
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/update
|
286
298
|
# @rate_limited No
|
287
299
|
# @authentication Requires user context
|
300
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
288
301
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
289
302
|
# @return [Twitter::List] The created list.
|
290
303
|
# @overload list_update(list, options = {})
|
@@ -325,6 +338,7 @@ module Twitter
|
|
325
338
|
# @note Private lists will only be shown if the authenticated user owns the specified list.
|
326
339
|
# @rate_limited Yes
|
327
340
|
# @authentication Requires user context
|
341
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
328
342
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
329
343
|
# @return [Twitter::List] The specified list.
|
330
344
|
# @overload list(list, options = {})
|
@@ -359,6 +373,7 @@ module Twitter
|
|
359
373
|
# @see https://dev.twitter.com/docs/api/1.1/post/lists/members/destroy_all
|
360
374
|
# @rate_limited No
|
361
375
|
# @authentication Requires user context
|
376
|
+
# @raise [Twitter::Error::NotFound] Error raised when supplied list is not found.
|
362
377
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
363
378
|
# @return [Twitter::List] The list.
|
364
379
|
# @overload remove_list_members(list, users, options = {})
|
@@ -422,7 +437,7 @@ module Twitter
|
|
422
437
|
merge_owner!(arguments.options, arguments.pop)
|
423
438
|
send(request_method.to_sym, path, arguments.options)
|
424
439
|
true
|
425
|
-
rescue Twitter::Error::
|
440
|
+
rescue Twitter::Error::Forbidden, Twitter::Error::NotFound
|
426
441
|
false
|
427
442
|
end
|
428
443
|
|
@@ -9,12 +9,11 @@ module Twitter
|
|
9
9
|
status_code = response.status.to_i
|
10
10
|
klass = Twitter::Error.errors[status_code]
|
11
11
|
return unless klass
|
12
|
-
|
13
|
-
handle_forbidden_errors(response)
|
12
|
+
if klass == Twitter::Error::Forbidden
|
13
|
+
fail(handle_forbidden_errors(response))
|
14
14
|
else
|
15
|
-
klass.from_response(response)
|
15
|
+
fail(klass.from_response(response))
|
16
16
|
end
|
17
|
-
fail(error)
|
18
17
|
end
|
19
18
|
|
20
19
|
private
|
@@ -33,4 +32,4 @@ module Twitter
|
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
|
-
Faraday::Response.register_middleware :
|
35
|
+
Faraday::Response.register_middleware :twitter_raise_error => Twitter::REST::Response::RaiseError
|
data/lib/twitter/rest/tweets.rb
CHANGED
@@ -178,7 +178,7 @@ module Twitter
|
|
178
178
|
pmap(arguments) do |tweet|
|
179
179
|
begin
|
180
180
|
post_retweet(extract_id(tweet), arguments.options)
|
181
|
-
rescue Twitter::Error::AlreadyRetweeted
|
181
|
+
rescue Twitter::Error::AlreadyRetweeted, Twitter::Error::NotFound
|
182
182
|
next
|
183
183
|
end
|
184
184
|
end.compact
|
@@ -190,6 +190,7 @@ module Twitter
|
|
190
190
|
# @rate_limited Yes
|
191
191
|
# @authentication Requires user context
|
192
192
|
# @raise [Twitter::Error::AlreadyRetweeted] Error raised when tweet has already been retweeted.
|
193
|
+
# @raise [Twitter::Error::NotFound] Error raised when tweet does not exist or has been deleted.
|
193
194
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
194
195
|
# @return [Array<Twitter::Tweet>] The original tweets with retweet details embedded.
|
195
196
|
# @overload retweet!(*tweets)
|
data/lib/twitter/rest/users.rb
CHANGED
@@ -167,14 +167,17 @@ module Twitter
|
|
167
167
|
# @param user [Integer, String, URI, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
168
168
|
# @param options [Hash] A customizable set of options.
|
169
169
|
def block?(user, options = {})
|
170
|
-
user_id =
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
170
|
+
user_id = begin
|
171
|
+
case user
|
172
|
+
when Integer
|
173
|
+
user
|
174
|
+
when String, URI, Addressable::URI
|
175
|
+
user(user).id
|
176
|
+
when Twitter::User
|
177
|
+
user.id
|
178
|
+
end
|
177
179
|
end
|
180
|
+
|
178
181
|
blocked_ids(options).collect(&:to_i).include?(user_id)
|
179
182
|
end
|
180
183
|
|
data/lib/twitter/saved_search.rb
CHANGED
@@ -7,10 +7,11 @@ module Twitter
|
|
7
7
|
class SearchResults
|
8
8
|
include Twitter::Enumerable
|
9
9
|
include Twitter::Utils
|
10
|
+
# @return [Hash]
|
10
11
|
attr_reader :attrs
|
11
12
|
alias_method :to_h, :attrs
|
12
|
-
|
13
|
-
deprecate_alias :to_hsh, :
|
13
|
+
alias_method :to_hash, :to_h
|
14
|
+
deprecate_alias :to_hsh, :to_hash
|
14
15
|
|
15
16
|
# Initializes a new SearchResults object
|
16
17
|
#
|
data/lib/twitter/settings.rb
CHANGED
@@ -2,10 +2,14 @@ require 'twitter/base'
|
|
2
2
|
|
3
3
|
module Twitter
|
4
4
|
class Settings < Twitter::Base
|
5
|
-
|
5
|
+
# @return [Hash]
|
6
|
+
attr_reader :sleep_time, :time_zone
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :language, :screen_name
|
6
9
|
object_attr_reader :Place, :trend_location
|
7
10
|
predicate_attr_reader :always_use_https, :discoverable_by_email,
|
8
|
-
:
|
9
|
-
:
|
11
|
+
:discoverable_by_mobile_phone,
|
12
|
+
:display_sensitive_media, :geo_enabled, :protected,
|
13
|
+
:show_all_inline_media, :use_cookie_personalization
|
10
14
|
end
|
11
15
|
end
|
data/lib/twitter/size.rb
CHANGED
@@ -4,7 +4,10 @@ require 'twitter/base'
|
|
4
4
|
module Twitter
|
5
5
|
class Size < Twitter::Base
|
6
6
|
include Equalizer.new(:h, :w)
|
7
|
-
|
7
|
+
# @return [Integer]
|
8
|
+
attr_reader :h, :w
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :resize
|
8
11
|
alias_method :height, :h
|
9
12
|
alias_method :width, :w
|
10
13
|
end
|
@@ -4,11 +4,11 @@ module Twitter
|
|
4
4
|
LIST_EVENTS = [
|
5
5
|
:list_created, :list_destroyed, :list_updated, :list_member_added,
|
6
6
|
:list_member_added, :list_member_removed, :list_user_subscribed,
|
7
|
-
:list_user_subscribed, :list_user_unsubscribed, :list_user_unsubscribed
|
7
|
+
:list_user_subscribed, :list_user_unsubscribed, :list_user_unsubscribed
|
8
8
|
]
|
9
9
|
|
10
10
|
TWEET_EVENTS = [
|
11
|
-
:favorite, :unfavorite
|
11
|
+
:favorite, :unfavorite
|
12
12
|
]
|
13
13
|
|
14
14
|
attr_reader :name, :source, :target, :target_object
|
@@ -8,7 +8,7 @@ require 'twitter/tweet'
|
|
8
8
|
module Twitter
|
9
9
|
module Streaming
|
10
10
|
class MessageParser
|
11
|
-
def self.parse(data) # rubocop:disable CyclomaticComplexity
|
11
|
+
def self.parse(data) # rubocop:disable CyclomaticComplexity, PerceivedComplexity
|
12
12
|
if data[:id]
|
13
13
|
Tweet.new(data)
|
14
14
|
elsif data[:event]
|
data/lib/twitter/suggestion.rb
CHANGED
@@ -4,7 +4,10 @@ require 'twitter/base'
|
|
4
4
|
module Twitter
|
5
5
|
class Suggestion < Twitter::Base
|
6
6
|
include Equalizer.new(:slug)
|
7
|
-
|
7
|
+
# @return [Integer]
|
8
|
+
attr_reader :size
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :name, :slug
|
8
11
|
|
9
12
|
# @return [Array<Twitter::User>]
|
10
13
|
def users
|
data/lib/twitter/token.rb
CHANGED
data/lib/twitter/trend.rb
CHANGED
@@ -10,10 +10,11 @@ module Twitter
|
|
10
10
|
include Twitter::Enumerable
|
11
11
|
include Twitter::Utils
|
12
12
|
include Memoizable
|
13
|
+
# @return [Hash]
|
13
14
|
attr_reader :attrs
|
14
15
|
alias_method :to_h, :attrs
|
15
|
-
|
16
|
-
deprecate_alias :to_hsh, :
|
16
|
+
alias_method :to_hash, :to_h
|
17
|
+
deprecate_alias :to_hsh, :to_hash
|
17
18
|
|
18
19
|
# Initializes a new TrendResults object
|
19
20
|
#
|