twitter 5.1.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. data/.yardopts +2 -0
  2. data/CHANGELOG.md +14 -1
  3. data/CONTRIBUTING.md +2 -2
  4. data/README.md +30 -20
  5. data/Rakefile +26 -5
  6. data/lib/twitter/arguments.rb +0 -1
  7. data/lib/twitter/base.rb +13 -16
  8. data/lib/twitter/basic_user.rb +3 -3
  9. data/lib/twitter/client.rb +7 -8
  10. data/lib/twitter/configuration.rb +5 -5
  11. data/lib/twitter/core_ext/enumerable.rb +0 -2
  12. data/lib/twitter/core_ext/kernel.rb +0 -2
  13. data/lib/twitter/creatable.rb +0 -1
  14. data/lib/twitter/cursor.rb +7 -10
  15. data/lib/twitter/direct_message.rb +1 -1
  16. data/lib/twitter/entity/uri.rb +2 -2
  17. data/lib/twitter/enumerable.rb +1 -2
  18. data/lib/twitter/error/already_favorited.rb +1 -1
  19. data/lib/twitter/error/already_posted.rb +1 -1
  20. data/lib/twitter/error/already_retweeted.rb +1 -1
  21. data/lib/twitter/error/too_many_requests.rb +2 -2
  22. data/lib/twitter/error.rb +4 -6
  23. data/lib/twitter/factory.rb +2 -6
  24. data/lib/twitter/geo/point.rb +3 -5
  25. data/lib/twitter/geo.rb +1 -1
  26. data/lib/twitter/geo_factory.rb +1 -5
  27. data/lib/twitter/geo_results.rb +5 -8
  28. data/lib/twitter/identity.rb +1 -2
  29. data/lib/twitter/list.rb +4 -5
  30. data/lib/twitter/media/photo.rb +1 -2
  31. data/lib/twitter/media_factory.rb +1 -5
  32. data/lib/twitter/null_object.rb +4 -6
  33. data/lib/twitter/oembed.rb +1 -1
  34. data/lib/twitter/place.rb +17 -6
  35. data/lib/twitter/profile_banner.rb +1 -3
  36. data/lib/twitter/rate_limit.rb +1 -3
  37. data/lib/twitter/relationship.rb +1 -2
  38. data/lib/twitter/rest/api/direct_messages.rb +13 -14
  39. data/lib/twitter/rest/api/favorites.rb +10 -11
  40. data/lib/twitter/rest/api/friends_and_followers.rb +36 -36
  41. data/lib/twitter/rest/api/help.rb +8 -9
  42. data/lib/twitter/rest/api/lists.rb +62 -63
  43. data/lib/twitter/rest/api/oauth.rb +3 -4
  44. data/lib/twitter/rest/api/places_and_geo.rb +9 -10
  45. data/lib/twitter/rest/api/saved_searches.rb +5 -6
  46. data/lib/twitter/rest/api/search.rb +2 -3
  47. data/lib/twitter/rest/api/spam_reporting.rb +1 -2
  48. data/lib/twitter/rest/api/suggested_users.rb +4 -5
  49. data/lib/twitter/rest/api/timelines.rb +17 -18
  50. data/lib/twitter/rest/api/trends.rb +10 -11
  51. data/lib/twitter/rest/api/tweets.rb +15 -16
  52. data/lib/twitter/rest/api/undocumented.rb +6 -7
  53. data/lib/twitter/rest/api/users.rb +51 -52
  54. data/lib/twitter/rest/api/utils.rb +23 -30
  55. data/lib/twitter/rest/client.rb +8 -9
  56. data/lib/twitter/rest/request/multipart_with_file.rb +0 -1
  57. data/lib/twitter/rest/response/parse_error_json.rb +0 -2
  58. data/lib/twitter/rest/response/parse_json.rb +0 -2
  59. data/lib/twitter/rest/response/raise_error.rb +1 -3
  60. data/lib/twitter/search_results.rb +12 -15
  61. data/lib/twitter/settings.rb +2 -2
  62. data/lib/twitter/size.rb +2 -2
  63. data/lib/twitter/source_user.rb +1 -1
  64. data/lib/twitter/streaming/client.rb +71 -18
  65. data/lib/twitter/streaming/connection.rb +1 -3
  66. data/lib/twitter/streaming/deleted_tweet.rb +8 -0
  67. data/lib/twitter/streaming/event.rb +8 -8
  68. data/lib/twitter/streaming/friend_list.rb +2 -9
  69. data/lib/twitter/streaming/message_parser.rb +13 -7
  70. data/lib/twitter/streaming/response.rb +0 -2
  71. data/lib/twitter/streaming/stall_warning.rb +7 -0
  72. data/lib/twitter/suggestion.rb +0 -1
  73. data/lib/twitter/token.rb +2 -3
  74. data/lib/twitter/trend_results.rb +5 -8
  75. data/lib/twitter/tweet.rb +16 -24
  76. data/lib/twitter/user.rb +30 -32
  77. data/lib/twitter/version.rb +1 -4
  78. data/spec/fixtures/track_streaming_user.json +2 -1
  79. data/spec/helper.rb +6 -2
  80. data/spec/twitter/base_spec.rb +9 -9
  81. data/spec/twitter/basic_user_spec.rb +6 -6
  82. data/spec/twitter/configuration_spec.rb +4 -4
  83. data/spec/twitter/cursor_spec.rb +27 -27
  84. data/spec/twitter/direct_message_spec.rb +36 -36
  85. data/spec/twitter/entity/uri_spec.rb +27 -27
  86. data/spec/twitter/error_spec.rb +21 -21
  87. data/spec/twitter/geo/point_spec.rb +9 -9
  88. data/spec/twitter/geo/polygon_spec.rb +5 -5
  89. data/spec/twitter/geo_factory_spec.rb +7 -7
  90. data/spec/twitter/geo_results_spec.rb +11 -11
  91. data/spec/twitter/geo_spec.rb +5 -5
  92. data/spec/twitter/identifiable_spec.rb +9 -9
  93. data/spec/twitter/list_spec.rb +38 -38
  94. data/spec/twitter/media/photo_spec.rb +54 -54
  95. data/spec/twitter/media_factory_spec.rb +5 -5
  96. data/spec/twitter/null_object_spec.rb +6 -6
  97. data/spec/twitter/oembed_spec.rb +65 -65
  98. data/spec/twitter/place_spec.rb +89 -60
  99. data/spec/twitter/profile_banner_spec.rb +3 -3
  100. data/spec/twitter/rate_limit_spec.rb +18 -18
  101. data/spec/twitter/relationship_spec.rb +16 -16
  102. data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
  103. data/spec/twitter/rest/api/favorites_spec.rb +93 -93
  104. data/spec/twitter/rest/api/friends_and_followers_spec.rb +349 -349
  105. data/spec/twitter/rest/api/geo_spec.rb +33 -33
  106. data/spec/twitter/rest/api/help_spec.rb +24 -24
  107. data/spec/twitter/rest/api/lists_spec.rb +487 -487
  108. data/spec/twitter/rest/api/oauth_spec.rb +30 -30
  109. data/spec/twitter/rest/api/saved_searches_spec.rb +40 -40
  110. data/spec/twitter/rest/api/search_spec.rb +16 -16
  111. data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
  112. data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
  113. data/spec/twitter/rest/api/timelines_spec.rb +58 -58
  114. data/spec/twitter/rest/api/trends_spec.rb +26 -26
  115. data/spec/twitter/rest/api/tweets_spec.rb +284 -284
  116. data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
  117. data/spec/twitter/rest/api/users_spec.rb +360 -360
  118. data/spec/twitter/rest/client_spec.rb +99 -103
  119. data/spec/twitter/saved_search_spec.rb +16 -16
  120. data/spec/twitter/search_results_spec.rb +44 -44
  121. data/spec/twitter/settings_spec.rb +8 -8
  122. data/spec/twitter/size_spec.rb +5 -5
  123. data/spec/twitter/source_user_spec.rb +6 -6
  124. data/spec/twitter/streaming/client_spec.rb +53 -49
  125. data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
  126. data/spec/twitter/streaming/event_spec.rb +20 -22
  127. data/spec/twitter/streaming/friend_list_spec.rb +11 -0
  128. data/spec/twitter/streaming/message_parser_spec.rb +54 -0
  129. data/spec/twitter/suggestion_spec.rb +11 -11
  130. data/spec/twitter/target_user_spec.rb +6 -6
  131. data/spec/twitter/token_spec.rb +4 -4
  132. data/spec/twitter/trend_results_spec.rb +30 -30
  133. data/spec/twitter/trend_spec.rb +20 -20
  134. data/spec/twitter/tweet_spec.rb +170 -173
  135. data/spec/twitter/user_spec.rb +179 -179
  136. data/twitter.gemspec +2 -2
  137. data.tar.gz.sig +0 -0
  138. metadata +21 -4
  139. metadata.gz.sig +2 -3
@@ -13,12 +13,12 @@ module Twitter
13
13
  # @rate_limited Yes
14
14
  # @authentication Requires user context
15
15
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
16
- # @overload suggestions(options={})
16
+ # @overload suggestions(options = {})
17
17
  # Returns the list of suggested user categories
18
18
  #
19
19
  # @see https://dev.twitter.com/docs/api/1.1/get/users/suggestions
20
20
  # @param options [Hash] A customizable set of options.
21
- # @overload suggestions(slug, options={})
21
+ # @overload suggestions(slug, options = {})
22
22
  # Returns the users in a given category
23
23
  #
24
24
  # @see https://dev.twitter.com/docs/api/1.1/get/users/suggestions/:slug
@@ -29,7 +29,7 @@ module Twitter
29
29
  if arguments.last
30
30
  object_from_response(Twitter::Suggestion, :get, "/1.1/users/suggestions/#{arguments.pop}.json", arguments.options)
31
31
  else
32
- objects_from_response(Twitter::Suggestion, :get, "/1.1/users/suggestions.json", arguments.options)
32
+ objects_from_response(Twitter::Suggestion, :get, '/1.1/users/suggestions.json', arguments.options)
33
33
  end
34
34
  end
35
35
 
@@ -41,10 +41,9 @@ module Twitter
41
41
  # @param slug [String] The short name of list or a category.
42
42
  # @param options [Hash] A customizable set of options.
43
43
  # @return [Array<Twitter::User>]
44
- def suggest_users(slug, options={})
44
+ def suggest_users(slug, options = {})
45
45
  objects_from_response(Twitter::User, :get, "/1.1/users/suggestions/#{slug}/members.json", options)
46
46
  end
47
-
48
47
  end
49
48
  end
50
49
  end
@@ -23,10 +23,10 @@ module Twitter
23
23
  # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
24
24
  # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
25
25
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
26
- def mentions_timeline(options={})
27
- objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/mentions_timeline.json", options)
26
+ def mentions_timeline(options = {})
27
+ objects_from_response(Twitter::Tweet, :get, '/1.1/statuses/mentions_timeline.json', options)
28
28
  end
29
- alias mentions mentions_timeline
29
+ alias_method :mentions, :mentions_timeline
30
30
 
31
31
  # Returns the 20 most recent Tweets posted by the specified user
32
32
  #
@@ -36,7 +36,7 @@ module Twitter
36
36
  # @authentication Requires user context
37
37
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
38
38
  # @return [Array<Twitter::Tweet>]
39
- # @overload user_timeline(user, options={})
39
+ # @overload user_timeline(user, options = {})
40
40
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
41
41
  # @param options [Hash] A customizable set of options.
42
42
  # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
@@ -47,7 +47,7 @@ module Twitter
47
47
  # @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
48
48
  # @option options [Boolean, String, Integer] :include_rts Specifies that the timeline should include native retweets in addition to regular tweets. Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will no longer contain a full user object.
49
49
  def user_timeline(*args)
50
- objects_from_response_with_user(Twitter::Tweet, :get, "/1.1/statuses/user_timeline.json", args)
50
+ objects_from_response_with_user(Twitter::Tweet, :get, '/1.1/statuses/user_timeline.json', args)
51
51
  end
52
52
 
53
53
  # Returns the 20 most recent retweets posted by the specified user
@@ -66,12 +66,12 @@ module Twitter
66
66
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
67
67
  # @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
68
68
  # @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
69
- def retweeted_by_user(user, options={})
69
+ def retweeted_by_user(user, options = {})
70
70
  retweets_from_timeline(options) do |opts|
71
71
  user_timeline(user, opts)
72
72
  end
73
73
  end
74
- alias retweeted_by retweeted_by_user
74
+ alias_method :retweeted_by, :retweeted_by_user
75
75
 
76
76
  # Returns the 20 most recent retweets posted by the authenticating user
77
77
  #
@@ -88,7 +88,7 @@ module Twitter
88
88
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
89
89
  # @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
90
90
  # @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
91
- def retweeted_by_me(options={})
91
+ def retweeted_by_me(options = {})
92
92
  retweets_from_timeline(options) do |opts|
93
93
  user_timeline(opts)
94
94
  end
@@ -111,8 +111,8 @@ module Twitter
111
111
  # @option options [Boolean, String, Integer] :include_rts Specifies that the timeline should include native retweets in addition to regular tweets. Note: If you're using the trim_user parameter in conjunction with include_rts, the retweets will no longer contain a full user object.
112
112
  # @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
113
113
  # @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
114
- def home_timeline(options={})
115
- objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/home_timeline.json", options)
114
+ def home_timeline(options = {})
115
+ objects_from_response(Twitter::Tweet, :get, '/1.1/statuses/home_timeline.json', options)
116
116
  end
117
117
 
118
118
  # Returns the 20 most recent retweets posted by users the authenticating user follow.
@@ -131,7 +131,7 @@ module Twitter
131
131
  # @option options [Boolean, String, Integer] :exclude_replies This parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the count parameter will mean you will receive up-to count tweets - this is because the count parameter retrieves that many tweets before filtering out retweets and replies.
132
132
  # @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
133
133
  # @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
134
- def retweeted_to_me(options={})
134
+ def retweeted_to_me(options = {})
135
135
  retweets_from_timeline(options) do |opts|
136
136
  home_timeline(opts)
137
137
  end
@@ -151,8 +151,8 @@ module Twitter
151
151
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
152
152
  # @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
153
153
  # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
154
- def retweets_of_me(options={})
155
- objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/retweets_of_me.json", options)
154
+ def retweets_of_me(options = {})
155
+ objects_from_response(Twitter::Tweet, :get, '/1.1/statuses/retweets_of_me.json', options)
156
156
  end
157
157
 
158
158
  private
@@ -166,13 +166,13 @@ module Twitter
166
166
  end
167
167
 
168
168
  # @param tweets [Array]
169
- # @return [Array]
169
+ # @return [Array<Twitter::Tweet>]
170
170
  def select_retweets(tweets)
171
171
  tweets.select(&:retweet?)
172
172
  end
173
173
 
174
174
  # @param count [Integer]
175
- # @return [Array]
175
+ # @return [Array<Twitter::Tweet>]
176
176
  def collect_with_count(count, &block)
177
177
  options = {}
178
178
  options[:count] = MAX_TWEETS_PER_REQUEST
@@ -188,14 +188,13 @@ module Twitter
188
188
 
189
189
  # @param collection [Array]
190
190
  # @param max_id [Integer, NilClass]
191
- # @return [Array]
192
- def collect_with_max_id(collection=[], max_id=nil, &block)
191
+ # @return [Array<Twitter::Tweet>]
192
+ def collect_with_max_id(collection = [], max_id = nil, &block)
193
193
  tweets = yield(max_id)
194
194
  return collection if tweets.nil?
195
195
  collection += tweets
196
196
  tweets.empty? ? collection.flatten : collect_with_max_id(collection, tweets.last.id - 1, &block)
197
197
  end
198
-
199
198
  end
200
199
  end
201
200
  end
@@ -14,16 +14,16 @@ module Twitter
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.
17
- # @param id [Integer] The {https://developer.yahoo.com/geo/geoplanet Yahoo! Where On Earth ID} of the location to return trending information for. WOEIDs can be retrieved by calling {Twitter::REST::API::Trends#trend_locations}. Global information is available by using 1 as the WOEID.
17
+ # @param id [Integer] The {https://developer.yahoo.com/geo/geoplanet Yahoo! Where On Earth ID} of the location to return trending information for. WOEIDs can be retrieved by calling {Twitter::REST::API::Trends#trends_available}. Global information is available by using 1 as the WOEID.
18
18
  # @param options [Hash] A customizable set of options.
19
19
  # @option options [String] :exclude Setting this equal to 'hashtags' will remove all hashtags from the trends list.
20
20
  # @return [Array<Twitter::Trend>]
21
- def trends(id=1, options={})
21
+ def trends(id = 1, options = {})
22
22
  options[:id] = id
23
- object_from_response(Twitter::TrendResults, :get, "/1.1/trends/place.json", options)
23
+ object_from_response(Twitter::TrendResults, :get, '/1.1/trends/place.json', options)
24
24
  end
25
- alias local_trends trends
26
- alias trends_place trends
25
+ alias_method :local_trends, :trends
26
+ alias_method :trends_place, :trends
27
27
 
28
28
  # Returns the locations that Twitter has trending topic information for
29
29
  #
@@ -33,10 +33,10 @@ module Twitter
33
33
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
34
34
  # @param options [Hash] A customizable set of options.
35
35
  # @return [Array<Twitter::Place>]
36
- def trends_available(options={})
37
- objects_from_response(Twitter::Place, :get, "/1.1/trends/available.json", options)
36
+ def trends_available(options = {})
37
+ objects_from_response(Twitter::Place, :get, '/1.1/trends/available.json', options)
38
38
  end
39
- alias trend_locations trends_available
39
+ alias_method :trend_locations, :trends_available
40
40
 
41
41
  # Returns the locations that Twitter has trending topic information for, closest to a specified location.
42
42
  #
@@ -48,10 +48,9 @@ module Twitter
48
48
  # @option options [Float] :lat If provided with a :long option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for latitude are -90.0 to +90.0 (North is positive) inclusive.
49
49
  # @option options [Float] :long If provided with a :lat option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive.
50
50
  # @return [Array<Twitter::Place>]
51
- def trends_closest(options={})
52
- objects_from_response(Twitter::Place, :get, "/1.1/trends/closest.json", options)
51
+ def trends_closest(options = {})
52
+ objects_from_response(Twitter::Place, :get, '/1.1/trends/closest.json', options)
53
53
  end
54
-
55
54
  end
56
55
  end
57
56
  end
@@ -23,7 +23,7 @@ module Twitter
23
23
  # @param options [Hash] A customizable set of options.
24
24
  # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
25
25
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
26
- def retweets(tweet, options={})
26
+ def retweets(tweet, options = {})
27
27
  id = extract_id(tweet)
28
28
  objects_from_response(Twitter::Tweet, :get, "/1.1/statuses/retweets/#{id}.json", options)
29
29
  end
@@ -40,7 +40,7 @@ module Twitter
40
40
  # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
41
41
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
42
42
  # @option options [Boolean] :ids_only ('false') Only return user ids instead of full user objects.
43
- def retweeters_of(tweet, options={})
43
+ def retweeters_of(tweet, options = {})
44
44
  ids_only = !!options.delete(:ids_only)
45
45
  retweeters = retweets(tweet, options).map(&:user)
46
46
  ids_only ? retweeters.map(&:id) : retweeters
@@ -57,7 +57,7 @@ module Twitter
57
57
  # @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
58
58
  # @param options [Hash] A customizable set of options.
59
59
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
60
- def status(tweet, options={})
60
+ def status(tweet, options = {})
61
61
  id = extract_id(tweet)
62
62
  object_from_response(Twitter::Tweet, :get, "/1.1/statuses/show/#{id}.json", options)
63
63
  end
@@ -76,7 +76,7 @@ module Twitter
76
76
  # @param options [Hash] A customizable set of options.
77
77
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
78
78
  def statuses(*args)
79
- threaded_tweets_from_response(:get, "/1.1/statuses/show", args)
79
+ threaded_tweets_from_response(:get, '/1.1/statuses/show', args)
80
80
  end
81
81
 
82
82
  # Destroys the specified Tweets
@@ -94,9 +94,9 @@ module Twitter
94
94
  # @param options [Hash] A customizable set of options.
95
95
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
96
96
  def destroy_status(*args)
97
- threaded_tweets_from_response(:post, "/1.1/statuses/destroy", args)
97
+ threaded_tweets_from_response(:post, '/1.1/statuses/destroy', args)
98
98
  end
99
- alias destroy_tweet destroy_status
99
+ alias_method :destroy_tweet, :destroy_status
100
100
  deprecate_alias :status_destroy, :destroy_status
101
101
  deprecate_alias :tweet_destroy, :destroy_status
102
102
 
@@ -118,11 +118,11 @@ module Twitter
118
118
  # @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
119
119
  # @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
120
120
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
121
- def update(status, options={})
121
+ def update(status, options = {})
122
122
  hash = options.dup
123
123
  hash[:in_reply_to_status_id] = hash.delete(:in_reply_to_status).id unless hash[:in_reply_to_status].nil?
124
124
  hash[:place_id] = hash.delete(:place).woeid unless hash[:place].nil?
125
- object_from_response(Twitter::Tweet, :post, "/1.1/statuses/update.json", hash.merge(:status => status))
125
+ object_from_response(Twitter::Tweet, :post, '/1.1/statuses/update.json', hash.merge(:status => status))
126
126
  rescue Twitter::Error::Forbidden => error
127
127
  handle_forbidden_error(Twitter::Error::AlreadyPosted, error)
128
128
  end
@@ -198,11 +198,11 @@ module Twitter
198
198
  # @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
199
199
  # @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from.
200
200
  # @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
201
- def update_with_media(status, media, options={})
201
+ def update_with_media(status, media, options = {})
202
202
  hash = options.dup
203
203
  hash[:in_reply_to_status_id] = hash.delete(:in_reply_to_status).id unless hash[:in_reply_to_status].nil?
204
204
  hash[:place_id] = hash.delete(:place).woeid unless hash[:place].nil?
205
- object_from_response(Twitter::Tweet, :post, "/1.1/statuses/update_with_media.json", hash.merge('media[]' => media, 'status' => status))
205
+ object_from_response(Twitter::Tweet, :post, '/1.1/statuses/update_with_media.json', hash.merge('media[]' => media, 'status' => status))
206
206
  rescue Twitter::Error::Forbidden => error
207
207
  handle_forbidden_error(Twitter::Error::AlreadyPosted, error)
208
208
  end
@@ -223,9 +223,9 @@ module Twitter
223
223
  # @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.
224
224
  # @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.
225
225
  # @option options [String] :lang Language code for the rendered embed. This will affect the text and localization of the rendered HTML.
226
- def oembed(tweet, options={})
226
+ def oembed(tweet, options = {})
227
227
  options[:id] = extract_id(tweet)
228
- object_from_response(Twitter::OEmbed, :get, "/1.1/statuses/oembed.json", options)
228
+ object_from_response(Twitter::OEmbed, :get, '/1.1/statuses/oembed.json', options)
229
229
  end
230
230
 
231
231
  # Returns oEmbeds for Tweets
@@ -261,16 +261,16 @@ module Twitter
261
261
  # @rate_limited Yes
262
262
  # @authentication Required
263
263
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
264
- # @return [Array<Integer>]
264
+ # @return [Twitter::Cursor]
265
265
  # @overload retweeters_ids(options)
266
266
  # @param options [Hash] A customizable set of options.
267
- # @overload retweeters_ids(id, options={})
267
+ # @overload retweeters_ids(id, options = {})
268
268
  # @param tweet [Integer, String, URI, Twitter::Tweet] A Tweet ID, URI, or object.
269
269
  # @param options [Hash] A customizable set of options.
270
270
  def retweeters_ids(*args)
271
271
  arguments = Twitter::Arguments.new(args)
272
272
  arguments.options[:id] ||= extract_id(arguments.first)
273
- cursor_from_response(:ids, nil, :get, "/1.1/statuses/retweeters/ids.json", arguments.options)
273
+ cursor_from_response(:ids, nil, :get, '/1.1/statuses/retweeters/ids.json', arguments.options)
274
274
  end
275
275
 
276
276
  private
@@ -295,7 +295,6 @@ module Twitter
295
295
  retweeted_status[:body][:retweeted_status] = response[:body]
296
296
  Twitter::Tweet.from_response(retweeted_status)
297
297
  end
298
-
299
298
  end
300
299
  end
301
300
  end
@@ -15,14 +15,14 @@ module Twitter
15
15
  # @authentication Requires user context
16
16
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
17
17
  #
18
- # @overload following_followers_of(options={})
18
+ # @overload following_followers_of(options = {})
19
19
  # Returns users following followers of the specified user
20
20
  #
21
21
  # @param options [Hash] A customizable set of options.
22
22
  # @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
23
23
  # @return [Twitter::Cursor]
24
24
  #
25
- # @overload following_followers_of(user, options={})
25
+ # @overload following_followers_of(user, options = {})
26
26
  # Returns users following followers of the authenticated user
27
27
  #
28
28
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -30,7 +30,7 @@ module Twitter
30
30
  # @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
31
31
  # @return [Twitter::Cursor]
32
32
  def following_followers_of(*args)
33
- cursor_from_response_with_user(:users, Twitter::User, :get, "/users/following_followers_of.json", args)
33
+ cursor_from_response_with_user(:users, Twitter::User, :get, '/users/following_followers_of.json', args)
34
34
  end
35
35
 
36
36
  # Returns Tweets count for a URI
@@ -41,11 +41,10 @@ module Twitter
41
41
  # @return [Integer]
42
42
  # @param uri [String, URI] A URI.
43
43
  # @param options [Hash] A customizable set of options.
44
- def tweet_count(uri, options={})
45
- connection = Faraday.new("https://cdn.api.twitter.com", connection_options.merge(:builder => middleware))
46
- connection.get("/1/urls/count.json", options.merge(:url => uri.to_s)).body[:count]
44
+ def tweet_count(uri, options = {})
45
+ connection = Faraday.new('https://cdn.api.twitter.com', connection_options.merge(:builder => middleware))
46
+ connection.get('/1/urls/count.json', options.merge(:url => uri.to_s)).body[:count]
47
47
  end
48
-
49
48
  end
50
49
  end
51
50
  end