twitter 5.11.0 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -1
  3. data/README.md +7 -5
  4. data/lib/twitter/arguments.rb +1 -0
  5. data/lib/twitter/base.rb +4 -5
  6. data/lib/twitter/basic_user.rb +1 -0
  7. data/lib/twitter/client.rb +10 -9
  8. data/lib/twitter/configuration.rb +4 -2
  9. data/lib/twitter/cursor.rb +3 -2
  10. data/lib/twitter/direct_message.rb +1 -0
  11. data/lib/twitter/entity.rb +1 -0
  12. data/lib/twitter/entity/hashtag.rb +1 -0
  13. data/lib/twitter/entity/symbol.rb +1 -0
  14. data/lib/twitter/entity/user_mention.rb +4 -1
  15. data/lib/twitter/error.rb +22 -19
  16. data/lib/twitter/geo.rb +1 -0
  17. data/lib/twitter/geo_results.rb +3 -2
  18. data/lib/twitter/identity.rb +1 -0
  19. data/lib/twitter/language.rb +1 -0
  20. data/lib/twitter/list.rb +12 -5
  21. data/lib/twitter/media/photo.rb +1 -0
  22. data/lib/twitter/metadata.rb +1 -0
  23. data/lib/twitter/null_object.rb +22 -0
  24. data/lib/twitter/oembed.rb +5 -2
  25. data/lib/twitter/place.rb +4 -1
  26. data/lib/twitter/profile.rb +1 -1
  27. data/lib/twitter/rest/client.rb +4 -4
  28. data/lib/twitter/rest/favorites.rb +4 -3
  29. data/lib/twitter/rest/lists.rb +18 -3
  30. data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
  31. data/lib/twitter/rest/response/parse_json.rb +1 -1
  32. data/lib/twitter/rest/response/raise_error.rb +4 -5
  33. data/lib/twitter/rest/tweets.rb +2 -1
  34. data/lib/twitter/rest/users.rb +10 -7
  35. data/lib/twitter/saved_search.rb +1 -0
  36. data/lib/twitter/search_results.rb +3 -2
  37. data/lib/twitter/settings.rb +7 -3
  38. data/lib/twitter/size.rb +4 -1
  39. data/lib/twitter/streaming/deleted_tweet.rb +1 -0
  40. data/lib/twitter/streaming/event.rb +2 -2
  41. data/lib/twitter/streaming/message_parser.rb +1 -1
  42. data/lib/twitter/suggestion.rb +4 -1
  43. data/lib/twitter/token.rb +1 -0
  44. data/lib/twitter/trend.rb +1 -0
  45. data/lib/twitter/trend_results.rb +3 -2
  46. data/lib/twitter/tweet.rb +9 -6
  47. data/lib/twitter/user.rb +15 -13
  48. data/lib/twitter/utils.rb +2 -6
  49. data/lib/twitter/version.rb +1 -1
  50. data/twitter.gemspec +6 -9
  51. metadata +6 -259
  52. data/Rakefile +0 -37
  53. data/spec/fixtures/already_favorited.json +0 -1
  54. data/spec/fixtures/already_posted.json +0 -1
  55. data/spec/fixtures/already_retweeted.json +0 -1
  56. data/spec/fixtures/bearer_token.json +0 -1
  57. data/spec/fixtures/category.json +0 -1
  58. data/spec/fixtures/configuration.json +0 -1
  59. data/spec/fixtures/contributees.json +0 -1
  60. data/spec/fixtures/count.json +0 -1
  61. data/spec/fixtures/direct_message.json +0 -1
  62. data/spec/fixtures/direct_messages.json +0 -1
  63. data/spec/fixtures/empty.json +0 -0
  64. data/spec/fixtures/followers_list.json +0 -1
  65. data/spec/fixtures/followers_list2.json +0 -1
  66. data/spec/fixtures/following.json +0 -1
  67. data/spec/fixtures/forbidden.json +0 -1
  68. data/spec/fixtures/friends_list.json +0 -1
  69. data/spec/fixtures/friends_list2.json +0 -1
  70. data/spec/fixtures/friendships.json +0 -1
  71. data/spec/fixtures/ids.json +0 -1
  72. data/spec/fixtures/ids_list.json +0 -1
  73. data/spec/fixtures/ids_list2.json +0 -1
  74. data/spec/fixtures/languages.json +0 -1
  75. data/spec/fixtures/list.json +0 -1
  76. data/spec/fixtures/lists.json +0 -1
  77. data/spec/fixtures/locations.json +0 -1
  78. data/spec/fixtures/matching_trends.json +0 -1
  79. data/spec/fixtures/me.jpeg +0 -0
  80. data/spec/fixtures/members.json +0 -1
  81. data/spec/fixtures/memberships.json +0 -1
  82. data/spec/fixtures/memberships2.json +0 -1
  83. data/spec/fixtures/not_following.json +0 -1
  84. data/spec/fixtures/not_found.json +0 -1
  85. data/spec/fixtures/oembed.json +0 -1
  86. data/spec/fixtures/ownerships.json +0 -1
  87. data/spec/fixtures/pbjt.gif +0 -0
  88. data/spec/fixtures/pengwynn.json +0 -1
  89. data/spec/fixtures/place.json +0 -1
  90. data/spec/fixtures/places.json +0 -1
  91. data/spec/fixtures/privacy.json +0 -1
  92. data/spec/fixtures/profile_banner.json +0 -1
  93. data/spec/fixtures/request_token.txt +0 -6
  94. data/spec/fixtures/retweet.json +0 -1
  95. data/spec/fixtures/retweets.json +0 -1
  96. data/spec/fixtures/saved_search.json +0 -1
  97. data/spec/fixtures/saved_searches.json +0 -1
  98. data/spec/fixtures/search.json +0 -1
  99. data/spec/fixtures/search2.json +0 -1
  100. data/spec/fixtures/search_malformed.json +0 -1
  101. data/spec/fixtures/settings.json +0 -1
  102. data/spec/fixtures/sferik.json +0 -1
  103. data/spec/fixtures/status.json +0 -1
  104. data/spec/fixtures/statuses.json +0 -1
  105. data/spec/fixtures/subscriptions.json +0 -1
  106. data/spec/fixtures/subscriptions2.json +0 -1
  107. data/spec/fixtures/suggestions.json +0 -1
  108. data/spec/fixtures/tos.json +0 -1
  109. data/spec/fixtures/track_streaming.json +0 -3
  110. data/spec/fixtures/track_streaming_user.json +0 -6
  111. data/spec/fixtures/upload.json +0 -1
  112. data/spec/fixtures/user_search.json +0 -1
  113. data/spec/fixtures/user_timeline.json +0 -1
  114. data/spec/fixtures/users.json +0 -1
  115. data/spec/fixtures/users_list.json +0 -1
  116. data/spec/fixtures/users_list2.json +0 -1
  117. data/spec/fixtures/we_concept_bg2.png +0 -0
  118. data/spec/fixtures/wildcomet2.jpe +0 -0
  119. data/spec/helper.rb +0 -68
  120. data/spec/twitter/base_spec.rb +0 -39
  121. data/spec/twitter/basic_user_spec.rb +0 -23
  122. data/spec/twitter/configuration_spec.rb +0 -17
  123. data/spec/twitter/cursor_spec.rb +0 -30
  124. data/spec/twitter/direct_message_spec.rb +0 -232
  125. data/spec/twitter/entity/uri_spec.rb +0 -75
  126. data/spec/twitter/error_spec.rb +0 -52
  127. data/spec/twitter/geo/point_spec.rb +0 -41
  128. data/spec/twitter/geo/polygon_spec.rb +0 -29
  129. data/spec/twitter/geo_factory_spec.rb +0 -19
  130. data/spec/twitter/geo_results_spec.rb +0 -35
  131. data/spec/twitter/geo_spec.rb +0 -29
  132. data/spec/twitter/identifiable_spec.rb +0 -29
  133. data/spec/twitter/list_spec.rb +0 -88
  134. data/spec/twitter/media/photo_spec.rb +0 -151
  135. data/spec/twitter/media_factory_spec.rb +0 -15
  136. data/spec/twitter/oembed_spec.rb +0 -170
  137. data/spec/twitter/place_spec.rb +0 -168
  138. data/spec/twitter/profile_banner_spec.rb +0 -13
  139. data/spec/twitter/rate_limit_spec.rb +0 -59
  140. data/spec/twitter/relationship_spec.rb +0 -49
  141. data/spec/twitter/rest/client_spec.rb +0 -217
  142. data/spec/twitter/rest/direct_messages_spec.rb +0 -133
  143. data/spec/twitter/rest/favorites_spec.rb +0 -188
  144. data/spec/twitter/rest/friends_and_followers_spec.rb +0 -667
  145. data/spec/twitter/rest/geo_spec.rb +0 -68
  146. data/spec/twitter/rest/help_spec.rb +0 -68
  147. data/spec/twitter/rest/lists_spec.rb +0 -910
  148. data/spec/twitter/rest/media_spec.rb +0 -54
  149. data/spec/twitter/rest/oauth_spec.rb +0 -63
  150. data/spec/twitter/rest/saved_searches_spec.rb +0 -98
  151. data/spec/twitter/rest/search_spec.rb +0 -42
  152. data/spec/twitter/rest/spam_reporting_spec.rb +0 -25
  153. data/spec/twitter/rest/suggested_users_spec.rb +0 -59
  154. data/spec/twitter/rest/timelines_spec.rb +0 -138
  155. data/spec/twitter/rest/trends_spec.rb +0 -68
  156. data/spec/twitter/rest/tweets_spec.rb +0 -614
  157. data/spec/twitter/rest/undocumented_spec.rb +0 -103
  158. data/spec/twitter/rest/users_spec.rb +0 -797
  159. data/spec/twitter/saved_search_spec.rb +0 -45
  160. data/spec/twitter/search_results_spec.rb +0 -30
  161. data/spec/twitter/settings_spec.rb +0 -27
  162. data/spec/twitter/size_spec.rb +0 -28
  163. data/spec/twitter/source_user_spec.rb +0 -23
  164. data/spec/twitter/streaming/client_spec.rb +0 -123
  165. data/spec/twitter/streaming/connection_spec.rb +0 -32
  166. data/spec/twitter/streaming/deleted_tweet_spec.rb +0 -23
  167. data/spec/twitter/streaming/event_spec.rb +0 -43
  168. data/spec/twitter/streaming/friend_list_spec.rb +0 -11
  169. data/spec/twitter/streaming/message_parser_spec.rb +0 -54
  170. data/spec/twitter/streaming/response_spec.rb +0 -21
  171. data/spec/twitter/suggestion_spec.rb +0 -40
  172. data/spec/twitter/target_user_spec.rb +0 -23
  173. data/spec/twitter/token_spec.rb +0 -16
  174. data/spec/twitter/trend_results_spec.rb +0 -89
  175. data/spec/twitter/trend_spec.rb +0 -51
  176. data/spec/twitter/tweet_spec.rb +0 -456
  177. data/spec/twitter/user_spec.rb +0 -447
  178. data/spec/twitter/utils_spec.rb +0 -34
@@ -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
@@ -2,8 +2,11 @@ require 'twitter/base'
2
2
 
3
3
  module Twitter
4
4
  class OEmbed < Twitter::Base
5
- attr_reader :author_name, :cache_age, :height, :html, :provider_name,
6
- :type, :version, :width
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
@@ -3,7 +3,10 @@ require 'twitter/identity'
3
3
 
4
4
  module Twitter
5
5
  class Place < Twitter::Identity
6
- attr_reader :attributes, :country, :full_name, :name
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
@@ -11,7 +11,7 @@ module Twitter
11
11
  private
12
12
 
13
13
  def alias_predicate_uri_methods(method)
14
- %w[_url? _uri_https? _url_https?].each do |replacement|
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
@@ -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 :multipart_with_file
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 :raise_error
68
+ faraday.response :twitter_raise_error
69
69
  # Parse JSON response bodies
70
- faraday.response :parse_json
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)
@@ -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 500 members, and you are limited to adding up to 100 members to a list at a time with this method.
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 500 members.
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::NotFound, Twitter::Error::Forbidden
440
+ rescue Twitter::Error::Forbidden, Twitter::Error::NotFound
426
441
  false
427
442
  end
428
443
 
@@ -36,4 +36,4 @@ module Twitter
36
36
  end
37
37
  end
38
38
 
39
- Faraday::Request.register_middleware :multipart_with_file => Twitter::REST::Request::MultipartWithFile
39
+ Faraday::Request.register_middleware :twitter_multipart_with_file => Twitter::REST::Request::MultipartWithFile
@@ -28,4 +28,4 @@ module Twitter
28
28
  end
29
29
  end
30
30
 
31
- Faraday::Response.register_middleware :parse_json => Twitter::REST::Response::ParseJson
31
+ Faraday::Response.register_middleware :twitter_parse_json => Twitter::REST::Response::ParseJson
@@ -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
- error = if klass == Twitter::Error::Forbidden
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 :raise_error => Twitter::REST::Response::RaiseError
35
+ Faraday::Response.register_middleware :twitter_raise_error => Twitter::REST::Response::RaiseError
@@ -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)
@@ -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 = case user
171
- when Integer
172
- user
173
- when String, URI, Addressable::URI
174
- user(user).id
175
- when Twitter::User
176
- user.id
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
 
@@ -4,6 +4,7 @@ require 'twitter/identity'
4
4
  module Twitter
5
5
  class SavedSearch < Twitter::Identity
6
6
  include Twitter::Creatable
7
+ # @return [String]
7
8
  attr_reader :name, :position, :query
8
9
  end
9
10
  end
@@ -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
- deprecate_alias :to_hash, :to_h
13
- deprecate_alias :to_hsh, :to_h
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
  #
@@ -2,10 +2,14 @@ require 'twitter/base'
2
2
 
3
3
  module Twitter
4
4
  class Settings < Twitter::Base
5
- attr_reader :language, :screen_name, :sleep_time, :time_zone
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
- :geo_enabled, :protected, :show_all_inline_media,
9
- :use_cookie_personalization
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
@@ -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
- attr_reader :h, :resize, :w
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
@@ -1,6 +1,7 @@
1
1
  module Twitter
2
2
  module Streaming
3
3
  class DeletedTweet < Twitter::Identity
4
+ # @return [Integer]
4
5
  attr_reader :user_id
5
6
  end
6
7
  DeletedStatus = DeletedTweet # rubocop:disable ConstantName
@@ -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]
@@ -4,7 +4,10 @@ require 'twitter/base'
4
4
  module Twitter
5
5
  class Suggestion < Twitter::Base
6
6
  include Equalizer.new(:slug)
7
- attr_reader :name, :size, :slug
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
@@ -2,6 +2,7 @@ require 'twitter/base'
2
2
 
3
3
  module Twitter
4
4
  class Token < Twitter::Base
5
+ # @return [String]
5
6
  attr_reader :access_token, :token_type
6
7
  alias_method :to_s, :access_token
7
8
 
@@ -4,6 +4,7 @@ require 'twitter/base'
4
4
  module Twitter
5
5
  class Trend < Twitter::Base
6
6
  include Equalizer.new(:name)
7
+ # @return [String]
7
8
  attr_reader :events, :name, :query
8
9
  predicate_attr_reader :promoted_content
9
10
  uri_attr_reader :uri
@@ -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
- deprecate_alias :to_hash, :to_h
16
- deprecate_alias :to_hsh, :to_h
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
  #