twitter 5.14.0 → 5.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -7
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE.md +1 -1
  4. data/README.md +10 -9
  5. data/lib/twitter/configuration.rb +3 -0
  6. data/lib/twitter/entity/uri.rb +2 -2
  7. data/lib/twitter/error.rb +9 -5
  8. data/lib/twitter/factory.rb +1 -1
  9. data/lib/twitter/headers.rb +1 -1
  10. data/lib/twitter/media/photo.rb +3 -0
  11. data/lib/twitter/media/video.rb +3 -0
  12. data/lib/twitter/media/video_info.rb +3 -0
  13. data/lib/twitter/null_object.rb +4 -0
  14. data/lib/twitter/place.rb +5 -3
  15. data/lib/twitter/profile_banner.rb +3 -0
  16. data/lib/twitter/rate_limit.rb +4 -0
  17. data/lib/twitter/rest/direct_messages.rb +8 -8
  18. data/lib/twitter/rest/favorites.rb +4 -4
  19. data/lib/twitter/rest/friends_and_followers.rb +14 -14
  20. data/lib/twitter/rest/help.rb +4 -4
  21. data/lib/twitter/rest/lists.rb +19 -19
  22. data/lib/twitter/rest/media.rb +1 -1
  23. data/lib/twitter/rest/oauth.rb +3 -3
  24. data/lib/twitter/rest/places_and_geo.rb +4 -4
  25. data/lib/twitter/rest/request/multipart_with_file.rb +6 -0
  26. data/lib/twitter/rest/saved_searches.rb +6 -6
  27. data/lib/twitter/rest/search.rb +2 -2
  28. data/lib/twitter/rest/spam_reporting.rb +1 -1
  29. data/lib/twitter/rest/suggested_users.rb +3 -3
  30. data/lib/twitter/rest/timelines.rb +7 -7
  31. data/lib/twitter/rest/trends.rb +3 -3
  32. data/lib/twitter/rest/tweets.rb +22 -20
  33. data/lib/twitter/rest/users.rb +27 -27
  34. data/lib/twitter/rest/utils.rb +4 -4
  35. data/lib/twitter/streaming/client.rb +20 -19
  36. data/lib/twitter/streaming/connection.rb +1 -1
  37. data/lib/twitter/streaming/deleted_tweet.rb +1 -1
  38. data/lib/twitter/suggestion.rb +3 -0
  39. data/lib/twitter/token.rb +3 -0
  40. data/lib/twitter/tweet.rb +5 -1
  41. data/lib/twitter/utils.rb +1 -1
  42. data/lib/twitter/version.rb +41 -11
  43. data/twitter.gemspec +2 -2
  44. metadata +102 -137
  45. data/lib/twitter/value.rb +0 -40
@@ -10,7 +10,7 @@ module Twitter
10
10
 
11
11
  # Returns the top 10 trending topics for a specific WOEID
12
12
  #
13
- # @see https://dev.twitter.com/docs/api/1.1/get/trends/place
13
+ # @see https://dev.twitter.com/rest/reference/get/trends/place
14
14
  # @rate_limited Yes
15
15
  # @authentication Requires user context
16
16
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -28,7 +28,7 @@ module Twitter
28
28
 
29
29
  # Returns the locations that Twitter has trending topic information for
30
30
  #
31
- # @see https://dev.twitter.com/docs/api/1.1/get/trends/available
31
+ # @see https://dev.twitter.com/rest/reference/get/trends/available
32
32
  # @rate_limited Yes
33
33
  # @authentication Requires user context
34
34
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -41,7 +41,7 @@ module Twitter
41
41
 
42
42
  # Returns the locations that Twitter has trending topic information for, closest to a specified location.
43
43
  #
44
- # @see https://dev.twitter.com/docs/api/1.1/get/trends/closest
44
+ # @see https://dev.twitter.com/rest/reference/get/trends/closest
45
45
  # @rate_limited Yes
46
46
  # @authentication Requires user context
47
47
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -15,7 +15,7 @@ module Twitter
15
15
 
16
16
  # Returns up to 100 of the first retweets of a given tweet
17
17
  #
18
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/:id
18
+ # @see https://dev.twitter.com/rest/reference/get/statuses/retweets/:id
19
19
  # @rate_limited Yes
20
20
  # @authentication Requires user context
21
21
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -30,7 +30,7 @@ module Twitter
30
30
 
31
31
  # Show up to 100 users who retweeted the Tweet
32
32
  #
33
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/retweets/:id
33
+ # @see https://dev.twitter.com/rest/reference/get/statuses/retweets/:id
34
34
  # @rate_limited Yes
35
35
  # @authentication Requires user context
36
36
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -48,7 +48,7 @@ module Twitter
48
48
 
49
49
  # Returns a Tweet
50
50
  #
51
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/show/:id
51
+ # @see https://dev.twitter.com/rest/reference/get/statuses/show/:id
52
52
  # @rate_limited Yes
53
53
  # @authentication Requires user context
54
54
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -63,7 +63,7 @@ module Twitter
63
63
 
64
64
  # Returns Tweets
65
65
  #
66
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/lookup
66
+ # @see https://dev.twitter.com/rest/reference/get/statuses/lookup
67
67
  # @rate_limited Yes
68
68
  # @authentication Required
69
69
  # @return [Array<Twitter::Tweet>] The requested Tweets.
@@ -82,7 +82,7 @@ module Twitter
82
82
 
83
83
  # Destroys the specified Tweets
84
84
  #
85
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/destroy/:id
85
+ # @see https://dev.twitter.com/rest/reference/post/statuses/destroy/:id
86
86
  # @note The authenticating user must be the author of the specified Tweets.
87
87
  # @rate_limited No
88
88
  # @authentication Requires user context
@@ -106,16 +106,16 @@ module Twitter
106
106
 
107
107
  # Updates the authenticating user's status
108
108
  #
109
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/update
109
+ # @see https://dev.twitter.com/rest/reference/post/statuses/update
110
110
  # @note A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.
111
111
  # @rate_limited No
112
112
  # @authentication Requires user context
113
113
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
114
- # @return [Twitter::Tweet] The created Tweet.
114
+ # @return [Twitter::Tweet] The created Tweet. When the tweet is deemed a duplicate by Twitter, returns the last Tweet from the user's timeline.
115
115
  # @param status [String] The text of your status update, up to 140 characters.
116
116
  # @param options [Hash] A customizable set of options.
117
117
  # @option options [Boolean, String, Integer] :possibly_sensitive Set to true for content which may not be suitable for every audience.
118
- # @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to.
118
+ # @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to. If the status being replied to was not originally posted by the authenticated user, the text of the status must begin with an @-mention, or twitter will reject the update.
119
119
  # @option options [Integer] :in_reply_to_status_id The ID of an existing status that the update is in reply to.
120
120
  # @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
121
121
  # @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
@@ -132,7 +132,7 @@ module Twitter
132
132
 
133
133
  # Updates the authenticating user's status
134
134
  #
135
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/update
135
+ # @see https://dev.twitter.com/rest/reference/post/statuses/update
136
136
  # @note A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates.
137
137
  # @rate_limited No
138
138
  # @authentication Requires user context
@@ -142,7 +142,7 @@ module Twitter
142
142
  # @param status [String] The text of your status update, up to 140 characters.
143
143
  # @param options [Hash] A customizable set of options.
144
144
  # @option options [Boolean, String, Integer] :possibly_sensitive Set to true for content which may not be suitable for every audience.
145
- # @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to.
145
+ # @option options [Twitter::Tweet] :in_reply_to_status An existing status that the update is in reply to. If the status being replied to was not originally posted by the authenticated user, the text of the status must begin with an @-mention, or twitter will reject the update.
146
146
  # @option options [Integer] :in_reply_to_status_id The ID of an existing status that the update is in reply to.
147
147
  # @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn't a corresponding :long option.
148
148
  # @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option.
@@ -160,7 +160,7 @@ module Twitter
160
160
 
161
161
  # Retweets the specified Tweets as the authenticating user
162
162
  #
163
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/:id
163
+ # @see https://dev.twitter.com/rest/reference/post/statuses/retweet/:id
164
164
  # @rate_limited Yes
165
165
  # @authentication Requires user context
166
166
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -184,7 +184,7 @@ module Twitter
184
184
 
185
185
  # Retweets the specified Tweets as the authenticating user and raises an error if one has already been retweeted
186
186
  #
187
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/retweet/:id
187
+ # @see https://dev.twitter.com/rest/reference/post/statuses/retweet/:id
188
188
  # @rate_limited Yes
189
189
  # @authentication Requires user context
190
190
  # @raise [Twitter::Error::AlreadyRetweeted] Error raised when tweet has already been retweeted.
@@ -206,7 +206,7 @@ module Twitter
206
206
 
207
207
  # Updates the authenticating user's status with media
208
208
  #
209
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media
209
+ # @see https://dev.twitter.com/rest/reference/post/statuses/update_with_media
210
210
  # @note A status update with text/media identical to the authenticating user's current status will NOT be ignored
211
211
  # @rate_limited No
212
212
  # @authentication Requires user context
@@ -235,7 +235,7 @@ module Twitter
235
235
 
236
236
  # Returns oEmbed for a Tweet
237
237
  #
238
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/oembed
238
+ # @see https://dev.twitter.com/rest/reference/get/statuses/oembed
239
239
  # @rate_limited Yes
240
240
  # @authentication Requires user context
241
241
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -243,12 +243,14 @@ module Twitter
243
243
  # @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
244
244
  # @param options [Hash] A customizable set of options.
245
245
  # @option options [Integer] :maxwidth The maximum width in pixels that the embed should be rendered at. This value is constrained to be between 250 and 550 pixels.
246
- # @option options [Boolean, String, Integer] :hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via {https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media POST statuses/update_with_media}. When set to either true, t or 1 images will not be expanded. Defaults to false.
246
+ # @option options [Boolean, String, Integer] :hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via {https://dev.twitter.com/rest/reference/post/statuses/update_with_media POST statuses/update_with_media}. When set to either true, t or 1 images will not be expanded. Defaults to false.
247
247
  # @option options [Boolean, String, Integer] :hide_thread Specifies whether the embedded Tweet should automatically show the original message in the case that the embedded Tweet is a reply. When set to either true, t or 1 the original Tweet will not be shown. Defaults to false.
248
248
  # @option options [Boolean, String, Integer] :omit_script Specifies whether the embedded Tweet HTML should include a `<script>` element pointing to widgets.js. In cases where a page already includes widgets.js, setting this value to true will prevent a redundant script element from being included. When set to either true, t or 1 the `<script>` element will not be included in the embed HTML, meaning that pages must include a reference to widgets.js manually. Defaults to false.
249
249
  # @option options [String] :align Specifies whether the embedded Tweet should be left aligned, right aligned, or centered in the page. Valid values are left, right, center, and none. Defaults to none, meaning no alignment styles are specified for the Tweet.
250
- # @option options [String] :related A value for the TWT related parameter, as described in {https://dev.twitter.com/docs/intents Web Intents}. This value will be forwarded to all Web Intents calls.
250
+ # @option options [String] :related A value for the TWT related parameter, as described in {https://dev.twitter.com/web/intents Web Intents}. This value will be forwarded to all Web Intents calls.
251
251
  # @option options [String] :lang Language code for the rendered embed. This will affect the text and localization of the rendered HTML.
252
+ # @option options [String] :widget_type Set to video to return a Twitter Video embed for the given Tweet.
253
+ # @option options [Boolean, String] :hide_tweet Applies to video type only. Set to 1 or true to link directly to the Tweet URL instead of displaying a Tweet overlay when a viewer clicks on the Twitter bird logo.
252
254
  def oembed(tweet, options = {})
253
255
  options[:id] = extract_id(tweet)
254
256
  perform_get_with_object('/1.1/statuses/oembed.json', options, Twitter::OEmbed)
@@ -256,7 +258,7 @@ module Twitter
256
258
 
257
259
  # Returns oEmbeds for Tweets
258
260
  #
259
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/oembed
261
+ # @see https://dev.twitter.com/rest/reference/get/statuses/oembed
260
262
  # @rate_limited Yes
261
263
  # @authentication Requires user context
262
264
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -267,11 +269,11 @@ module Twitter
267
269
  # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
268
270
  # @param options [Hash] A customizable set of options.
269
271
  # @option options [Integer] :maxwidth The maximum width in pixels that the embed should be rendered at. This value is constrained to be between 250 and 550 pixels.
270
- # @option options [Boolean, String, Integer] :hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via {https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media POST statuses/update_with_media}. When set to either true, t or 1 images will not be expanded. Defaults to false.
272
+ # @option options [Boolean, String, Integer] :hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via {https://dev.twitter.com/rest/reference/post/statuses/update_with_media POST statuses/update_with_media}. When set to either true, t or 1 images will not be expanded. Defaults to false.
271
273
  # @option options [Boolean, String, Integer] :hide_thread Specifies whether the embedded Tweet should automatically show the original message in the case that the embedded Tweet is a reply. When set to either true, t or 1 the original Tweet will not be shown. Defaults to false.
272
274
  # @option options [Boolean, String, Integer] :omit_script Specifies whether the embedded Tweet HTML should include a `<script>` element pointing to widgets.js. In cases where a page already includes widgets.js, setting this value to true will prevent a redundant script element from being included. When set to either true, t or 1 the `<script>` element will not be included in the embed HTML, meaning that pages must include a reference to widgets.js manually. Defaults to false.
273
275
  # @option options [String] :align Specifies whether the embedded Tweet should be left aligned, right aligned, or centered in the page. Valid values are left, right, center, and none. Defaults to none, meaning no alignment styles are specified for the Tweet.
274
- # @option options [String] :related A value for the TWT related parameter, as described in {https://dev.twitter.com/docs/intents Web Intents}. This value will be forwarded to all Web Intents calls.
276
+ # @option options [String] :related A value for the TWT related parameter, as described in {https://dev.twitter.com/web/intents Web Intents}. This value will be forwarded to all Web Intents calls.
275
277
  # @option options [String] :lang Language code for the rendered embed. This will affect the text and localization of the rendered HTML.
276
278
  def oembeds(*args)
277
279
  arguments = Twitter::Arguments.new(args)
@@ -282,7 +284,7 @@ module Twitter
282
284
 
283
285
  # Returns a collection of up to 100 user IDs belonging to users who have retweeted the tweet specified by the id parameter.
284
286
  #
285
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/retweeters/ids
287
+ # @see https://dev.twitter.com/rest/reference/get/statuses/retweeters/ids
286
288
  # @rate_limited Yes
287
289
  # @authentication Required
288
290
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -17,19 +17,19 @@ module Twitter
17
17
  # Updates the authenticating user's settings.
18
18
  # Or, if no options supplied, returns settings (including current trend, geo and sleep time information) for the authenticating user.
19
19
  #
20
- # @see https://dev.twitter.com/docs/api/1.1/post/account/settings
21
- # @see https://dev.twitter.com/docs/api/1.1/get/account/settings
20
+ # @see https://dev.twitter.com/rest/reference/post/account/settings
21
+ # @see https://dev.twitter.com/rest/reference/get/account/settings
22
22
  # @rate_limited Yes
23
23
  # @authentication Requires user context
24
24
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
25
25
  # @return [Twitter::Settings]
26
26
  # @param options [Hash] A customizable set of options.
27
- # @option options [Integer] :trend_location_woeid The Yahoo! Where On Earth ID to use as the user's default trend location. Global information is available by using 1 as the WOEID. The woeid must be one of the locations returned by {https://dev.twitter.com/docs/api/1.1/get/trends/available GET trends/available}.
27
+ # @option options [Integer] :trend_location_woeid The Yahoo! Where On Earth ID to use as the user's default trend location. Global information is available by using 1 as the WOEID. The woeid must be one of the locations returned by {https://dev.twitter.com/rest/reference/get/trends/available GET trends/available}.
28
28
  # @option options [Boolean, String, Integer] :sleep_time_enabled When set to true, 't' or 1, will enable sleep time for the user. Sleep time is the time when push or SMS notifications should not be sent to the user.
29
29
  # @option options [Integer] :start_sleep_time The hour that sleep time should begin if it is enabled. The value for this parameter should be provided in {http://en.wikipedia.org/wiki/ISO_8601 ISO8601} format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
30
30
  # @option options [Integer] :end_sleep_time The hour that sleep time should end if it is enabled. The value for this parameter should be provided in {http://en.wikipedia.org/wiki/ISO_8601 ISO8601} format (i.e. 00-23). The time is considered to be in the same timezone as the user's time_zone setting.
31
31
  # @option options [String] :time_zone The timezone dates and times should be displayed in for the user. The timezone must be one of the {http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html Rails TimeZone} names.
32
- # @option options [String] :lang The language which Twitter should render in for this user. The language must be specified by the appropriate two letter ISO 639-1 representation. Currently supported languages are provided by {https://dev.twitter.com/docs/api/1.1/get/help/languages GET help/languages}.
32
+ # @option options [String] :lang The language which Twitter should render in for this user. The language must be specified by the appropriate two letter ISO 639-1 representation. Currently supported languages are provided by {https://dev.twitter.com/rest/reference/get/help/languages GET help/languages}.
33
33
  def settings(options = {})
34
34
  request_method = options.size.zero? ? :get : :post
35
35
  response = perform_request(request_method.to_sym, '/1.1/account/settings.json', options)
@@ -40,7 +40,7 @@ module Twitter
40
40
 
41
41
  # Returns the requesting user if authentication was successful, otherwise raises {Twitter::Error::Unauthorized}
42
42
  #
43
- # @see https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials
43
+ # @see https://dev.twitter.com/rest/reference/get/account/verify_credentials
44
44
  # @rate_limited Yes
45
45
  # @authentication Requires user context
46
46
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -54,7 +54,7 @@ module Twitter
54
54
 
55
55
  # Sets which device Twitter delivers updates to for the authenticating user
56
56
  #
57
- # @see https://dev.twitter.com/docs/api/1.1/post/account/update_delivery_device
57
+ # @see https://dev.twitter.com/rest/reference/post/account/update_delivery_device
58
58
  # @rate_limited No
59
59
  # @authentication Requires user context
60
60
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -67,7 +67,7 @@ module Twitter
67
67
 
68
68
  # Sets values that users are able to set under the "Account" tab of their settings page
69
69
  #
70
- # @see https://dev.twitter.com/docs/api/1.1/post/account/update_profile
70
+ # @see https://dev.twitter.com/rest/reference/post/account/update_profile
71
71
  # @note Only the options specified will be updated.
72
72
  # @rate_limited No
73
73
  # @authentication Requires user context
@@ -84,7 +84,7 @@ module Twitter
84
84
 
85
85
  # Updates the authenticating user's profile background image
86
86
  #
87
- # @see https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image
87
+ # @see https://dev.twitter.com/rest/reference/post/account/update_profile_background_image
88
88
  # @rate_limited No
89
89
  # @authentication Requires user context
90
90
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -98,7 +98,7 @@ module Twitter
98
98
 
99
99
  # Sets one or more hex values that control the color scheme of the authenticating user's profile
100
100
  #
101
- # @see https://dev.twitter.com/docs/api/1.1/post/account/update_profile_colors
101
+ # @see https://dev.twitter.com/rest/reference/post/account/update_profile_colors
102
102
  # @rate_limited No
103
103
  # @authentication Requires user context
104
104
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -115,7 +115,7 @@ module Twitter
115
115
 
116
116
  # Updates the authenticating user's profile image
117
117
  #
118
- # @see https://dev.twitter.com/docs/api/1.1/post/account/update_profile_image
118
+ # @see https://dev.twitter.com/rest/reference/post/account/update_profile_image
119
119
  # @note Updates the authenticating user's profile image. Note that this method expects raw multipart data, not a URL to an image.
120
120
  # @note This method asynchronously processes the uploaded file before updating the user's profile image URL. You can either update your local cache the next time you request the user's information, or, at least 5 seconds after uploading the image, ask for the updated URL using GET users/show.
121
121
  # @rate_limited No
@@ -130,7 +130,7 @@ module Twitter
130
130
 
131
131
  # Returns an array of user objects that the authenticating user is blocking
132
132
  #
133
- # @see https://dev.twitter.com/docs/api/1.1/get/blocks/list
133
+ # @see https://dev.twitter.com/rest/reference/get/blocks/list
134
134
  # @rate_limited Yes
135
135
  # @authentication Requires user context
136
136
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -144,7 +144,7 @@ module Twitter
144
144
 
145
145
  # Returns an array of numeric user IDs the authenticating user is blocking
146
146
  #
147
- # @see https://dev.twitter.com/docs/api/1.1/get/blocks/ids
147
+ # @see https://dev.twitter.com/rest/reference/get/blocks/ids
148
148
  # @rate_limited Yes
149
149
  # @authentication Requires user context
150
150
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -159,7 +159,7 @@ module Twitter
159
159
 
160
160
  # Returns true if the authenticating user is blocking a target user
161
161
  #
162
- # @see https://dev.twitter.com/docs/api/1.1/get/blocks/ids
162
+ # @see https://dev.twitter.com/rest/reference/get/blocks/ids
163
163
  # @rate_limited Yes
164
164
  # @authentication Requires user context
165
165
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -183,7 +183,7 @@ module Twitter
183
183
 
184
184
  # Blocks the users specified by the authenticating user
185
185
  #
186
- # @see https://dev.twitter.com/docs/api/1.1/post/blocks/create
186
+ # @see https://dev.twitter.com/rest/reference/post/blocks/create
187
187
  # @note Destroys a friendship to the blocked user if it exists.
188
188
  # @rate_limited Yes
189
189
  # @authentication Requires user context
@@ -200,7 +200,7 @@ module Twitter
200
200
 
201
201
  # Un-blocks the users specified by the authenticating user
202
202
  #
203
- # @see https://dev.twitter.com/docs/api/1.1/post/blocks/destroy
203
+ # @see https://dev.twitter.com/rest/reference/post/blocks/destroy
204
204
  # @rate_limited No
205
205
  # @authentication Requires user context
206
206
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -216,7 +216,7 @@ module Twitter
216
216
 
217
217
  # Returns extended information for up to 100 users
218
218
  #
219
- # @see https://dev.twitter.com/docs/api/1.1/get/users/lookup
219
+ # @see https://dev.twitter.com/rest/reference/get/users/lookup
220
220
  # @rate_limited Yes
221
221
  # @authentication Required
222
222
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -233,7 +233,7 @@ module Twitter
233
233
  end
234
234
  end
235
235
 
236
- # @see https://dev.twitter.com/docs/api/1.1/get/users/show
236
+ # @see https://dev.twitter.com/rest/reference/get/users/show
237
237
  # @rate_limited Yes
238
238
  # @authentication Requires user context
239
239
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -276,7 +276,7 @@ module Twitter
276
276
 
277
277
  # Returns users that match the given query
278
278
  #
279
- # @see https://dev.twitter.com/docs/api/1.1/get/users/search
279
+ # @see https://dev.twitter.com/rest/reference/get/users/search
280
280
  # @rate_limited Yes
281
281
  # @authentication Requires user context
282
282
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -291,7 +291,7 @@ module Twitter
291
291
 
292
292
  # Returns an array of users that the specified user can contribute to
293
293
  #
294
- # @see https://dev.twitter.com/docs/api/1.1/get/users/contributees
294
+ # @see https://dev.twitter.com/rest/reference/get/users/contributees
295
295
  # @rate_limited Yes
296
296
  # @authentication Requires user context
297
297
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -309,7 +309,7 @@ module Twitter
309
309
 
310
310
  # Returns an array of users who can contribute to the specified account
311
311
  #
312
- # @see https://dev.twitter.com/docs/api/1.1/get/users/contributors
312
+ # @see https://dev.twitter.com/rest/reference/get/users/contributors
313
313
  # @rate_limited Yes
314
314
  # @authentication Requires user context
315
315
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -327,7 +327,7 @@ module Twitter
327
327
 
328
328
  # Removes the authenticating user's profile banner image
329
329
  #
330
- # @see https://dev.twitter.com/docs/api/1.1/post/account/remove_profile_banner
330
+ # @see https://dev.twitter.com/rest/reference/post/account/remove_profile_banner
331
331
  # @rate_limited No
332
332
  # @authentication Requires user context
333
333
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -341,7 +341,7 @@ module Twitter
341
341
 
342
342
  # Updates the authenticating user's profile banner image
343
343
  #
344
- # @see https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner
344
+ # @see https://dev.twitter.com/rest/reference/post/account/update_profile_banner
345
345
  # @note Uploads a profile banner on behalf of the authenticating user. For best results, upload an <5MB image that is exactly 1252px by 626px. Images will be resized for a number of display options. Users with an uploaded profile banner will have a profile_banner_url node in their Users objects. More information about sizing variations can be found in User Profile Images and Banners.
346
346
  # @note Profile banner images are processed asynchronously. The profile_banner_url and its variant sizes will not necessary be available directly after upload.
347
347
  # @rate_limited No
@@ -363,7 +363,7 @@ module Twitter
363
363
 
364
364
  # Returns the available size variations of the specified user's profile banner.
365
365
  #
366
- # @see https://dev.twitter.com/docs/api/1.1/get/users/profile_banner
366
+ # @see https://dev.twitter.com/rest/reference/get/users/profile_banner
367
367
  # @note If the user has not uploaded a profile banner, a HTTP 404 will be served instead.
368
368
  # @rate_limited Yes
369
369
  # @authentication Requires user context
@@ -380,7 +380,7 @@ module Twitter
380
380
 
381
381
  # Mutes the users specified by the authenticating user
382
382
  #
383
- # @see https://dev.twitter.com/docs/api/1.1/post/mutes/users/create
383
+ # @see https://dev.twitter.com/rest/reference/post/mutes/users/create
384
384
  # @rate_limited Yes
385
385
  # @authentication Requires user context
386
386
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -396,7 +396,7 @@ module Twitter
396
396
 
397
397
  # Un-mutes the user specified by the authenticating user.
398
398
  #
399
- # @see https://dev.twitter.com/docs/api/1.1/post/mutes/users/destroy
399
+ # @see https://dev.twitter.com/rest/reference/post/mutes/users/destroy
400
400
  # @rate_limited Yes
401
401
  # @authentication Requires user context
402
402
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -412,7 +412,7 @@ module Twitter
412
412
 
413
413
  # Returns an array of user objects that the authenticating user is muting
414
414
  #
415
- # @see https://dev.twitter.com/docs/api/1.1/get/mutes/users/list
415
+ # @see https://dev.twitter.com/rest/reference/get/mutes/users/list
416
416
  # @rate_limited Yes
417
417
  # @authentication Requires user context
418
418
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -426,7 +426,7 @@ module Twitter
426
426
 
427
427
  # Returns an array of numeric user IDs the authenticating user is muting
428
428
  #
429
- # @see https://dev.twitter.com/docs/api/1.1/get/mutes/users/ids
429
+ # @see https://dev.twitter.com/rest/reference/get/mutes/users/ids
430
430
  # @rate_limited Yes
431
431
  # @authentication Requires user context
432
432
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
@@ -39,7 +39,6 @@ module Twitter
39
39
 
40
40
  # @param path [String]
41
41
  # @param options [Hash]
42
- # @param klass [Class]
43
42
  def perform_post(path, options = {})
44
43
  perform_request(:post, path, options)
45
44
  end
@@ -100,7 +99,7 @@ module Twitter
100
99
 
101
100
  # @param path [String]
102
101
  # @param options [Hash]
103
- # @collection_name [Symbol]
102
+ # @param collection_name [Symbol]
104
103
  # @param klass [Class]
105
104
  def perform_get_with_cursor(path, options, collection_name, klass = nil)
106
105
  merge_default_cursor!(options)
@@ -157,7 +156,7 @@ module Twitter
157
156
  # @param path [String]
158
157
  # @param args [Array]
159
158
  # @return [Twitter::Cursor]
160
- def cursor_from_response_with_user(collection_name, klass, path, args) # rubocop:disable ParameterLists
159
+ def cursor_from_response_with_user(collection_name, klass, path, args)
161
160
  arguments = Twitter::Arguments.new(args)
162
161
  merge_user!(arguments.options, arguments.pop || user_id) unless arguments.options[:user_id] || arguments.options[:screen_name]
163
162
  perform_get_with_cursor(path, arguments.options, collection_name, klass)
@@ -234,7 +233,8 @@ module Twitter
234
233
  end
235
234
 
236
235
  def collect_user_ids_and_screen_names(users) # rubocop:disable MethodLength
237
- user_ids, screen_names = [], []
236
+ user_ids = []
237
+ screen_names = []
238
238
  users.flatten.each do |user|
239
239
  case user
240
240
  when Integer
@@ -25,8 +25,8 @@ module Twitter
25
25
 
26
26
  # Returns public statuses that match one or more filter predicates
27
27
  #
28
- # @see https://dev.twitter.com/docs/api/1.1/post/statuses/filter
29
- # @see https://dev.twitter.com/docs/streaming-apis/parameters
28
+ # @see https://dev.twitter.com/streaming/reference/post/statuses/filter
29
+ # @see https://dev.twitter.com/streaming/overview/request-parameters
30
30
  # @note At least one predicate parameter (follow, locations, or track) must be specified.
31
31
  # @param options [Hash] A customizable set of options.
32
32
  # @option options [String] :follow A comma separated list of user IDs, indicating the users to return statuses for in the stream.
@@ -39,8 +39,8 @@ module Twitter
39
39
 
40
40
  # Returns all public statuses
41
41
  #
42
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/firehose
43
- # @see https://dev.twitter.com/docs/streaming-apis/parameters
42
+ # @see https://dev.twitter.com/streaming/reference/get/statuses/firehose
43
+ # @see https://dev.twitter.com/streaming/overview/request-parameters
44
44
  # @note This endpoint requires special permission to access.
45
45
  # @param options [Hash] A customizable set of options.
46
46
  # @option options [Integer] :count The number of messages to backfill.
@@ -51,24 +51,25 @@ module Twitter
51
51
 
52
52
  # Returns a small random sample of all public statuses
53
53
  #
54
- # @see https://dev.twitter.com/docs/api/1.1/get/statuses/sample
55
- # @see https://dev.twitter.com/docs/streaming-apis/parameters
54
+ # @see https://dev.twitter.com/streaming/reference/get/statuses/sample
55
+ # @see https://dev.twitter.com/streaming/overview/request-parameters
56
56
  # @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
57
57
  def sample(options = {}, &block)
58
58
  request(:get, 'https://stream.twitter.com:443/1.1/statuses/sample.json', options, &block)
59
59
  end
60
60
 
61
- # Streams messages for a set of user
61
+ # Streams messages for a set of users
62
62
  #
63
- # @see https://dev.twitter.com/docs/api/1.1/get/site
64
- # @see https://dev.twitter.com/docs/streaming-apis/streams/site
65
- # @see https://dev.twitter.com/docs/streaming-apis/parameters
63
+ # @see https://dev.twitter.com/streaming/reference/get/site
64
+ # @see https://dev.twitter.com/streaming/sitestreams
65
+ # @see https://dev.twitter.com/streaming/overview/request-parameters
66
66
  # @note Site Streams is currently in a limited beta. Access is restricted to whitelisted accounts.
67
- # @param follow [Enumerable<Integer, String, Twitter::User>] A list of user IDs, indicating the users to return statuses for in the stream.
68
- # @param options [Hash] A customizable set of options.
69
- # @option options [String] :with Specifies whether to return information for just the users specified in the follow parameter, or include messages from accounts they follow.
70
- # @option options [String] :replies Specifies whether stall warnings should be delivered.
71
- # @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
67
+ # @overload site(*follow, options = {}, &block)
68
+ # @param follow [Enumerable<Integer, String, Twitter::User>] A list of user IDs, indicating the users to return statuses for in the stream.
69
+ # @param options [Hash] A customizable set of options.
70
+ # @option options [String] :with Specifies whether to return information for just the users specified in the follow parameter, or include messages from accounts they follow.
71
+ # @option options [String] :replies Specifies whether stall warnings should be delivered.
72
+ # @yield [Twitter::Tweet, Twitter::Streaming::Event, Twitter::DirectMessage, Twitter::Streaming::FriendList, Twitter::Streaming::DeletedTweet, Twitter::Streaming::StallWarning] A stream of Twitter objects.
72
73
  def site(*args, &block)
73
74
  arguments = Arguments.new(args)
74
75
  user_ids = collect_user_ids(arguments)
@@ -77,9 +78,9 @@ module Twitter
77
78
 
78
79
  # Streams messages for a single user
79
80
  #
80
- # @see https://dev.twitter.com/docs/api/1.1/get/user
81
- # @see https://dev.twitter.com/docs/streaming-apis/streams/user
82
- # @see https://dev.twitter.com/docs/streaming-apis/parameters
81
+ # @see https://dev.twitter.com/streaming/reference/get/user
82
+ # @see https://dev.twitter.com/streaming/userstreams
83
+ # @see https://dev.twitter.com/streaming/overview/request-parameters
83
84
  # @param options [Hash] A customizable set of options.
84
85
  # @option options [String] :with Specifies whether to return information for just the users specified in the follow parameter, or include messages from accounts they follow.
85
86
  # @option options [String] :replies Specifies whether to return additional @replies.
@@ -111,7 +112,7 @@ module Twitter
111
112
  headers = default_headers.merge(:authorization => authorization)
112
113
  request = HTTP::Request.new(method, uri + '?' + to_url_params(params), headers)
113
114
  response = Streaming::Response.new do |data|
114
- if item = Streaming::MessageParser.parse(data) # rubocop:disable AssignmentInCondition, IfUnlessModifier
115
+ if item = Streaming::MessageParser.parse(data) # rubocop:disable AssignmentInCondition
115
116
  yield(item)
116
117
  end
117
118
  end