twitter 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.yardopts +2 -0
  3. data/CHANGELOG.md +10 -1
  4. data/CONTRIBUTING.md +2 -2
  5. data/README.md +30 -20
  6. data/Rakefile +26 -5
  7. data/lib/twitter/arguments.rb +0 -1
  8. data/lib/twitter/base.rb +13 -16
  9. data/lib/twitter/basic_user.rb +3 -3
  10. data/lib/twitter/client.rb +7 -8
  11. data/lib/twitter/configuration.rb +5 -5
  12. data/lib/twitter/core_ext/enumerable.rb +0 -2
  13. data/lib/twitter/core_ext/kernel.rb +0 -2
  14. data/lib/twitter/creatable.rb +0 -1
  15. data/lib/twitter/cursor.rb +7 -10
  16. data/lib/twitter/direct_message.rb +1 -1
  17. data/lib/twitter/entity/uri.rb +2 -2
  18. data/lib/twitter/enumerable.rb +1 -2
  19. data/lib/twitter/error.rb +4 -6
  20. data/lib/twitter/error/already_favorited.rb +1 -1
  21. data/lib/twitter/error/already_posted.rb +1 -1
  22. data/lib/twitter/error/already_retweeted.rb +1 -1
  23. data/lib/twitter/error/too_many_requests.rb +2 -2
  24. data/lib/twitter/factory.rb +2 -6
  25. data/lib/twitter/geo.rb +1 -1
  26. data/lib/twitter/geo/point.rb +3 -5
  27. data/lib/twitter/geo_factory.rb +1 -5
  28. data/lib/twitter/geo_results.rb +5 -8
  29. data/lib/twitter/identity.rb +1 -2
  30. data/lib/twitter/list.rb +4 -5
  31. data/lib/twitter/media/photo.rb +1 -2
  32. data/lib/twitter/media_factory.rb +1 -5
  33. data/lib/twitter/null_object.rb +4 -6
  34. data/lib/twitter/oembed.rb +1 -1
  35. data/lib/twitter/place.rb +4 -5
  36. data/lib/twitter/profile_banner.rb +1 -3
  37. data/lib/twitter/rate_limit.rb +1 -3
  38. data/lib/twitter/relationship.rb +1 -2
  39. data/lib/twitter/rest/api/direct_messages.rb +13 -14
  40. data/lib/twitter/rest/api/favorites.rb +10 -11
  41. data/lib/twitter/rest/api/friends_and_followers.rb +36 -36
  42. data/lib/twitter/rest/api/help.rb +8 -9
  43. data/lib/twitter/rest/api/lists.rb +62 -63
  44. data/lib/twitter/rest/api/oauth.rb +3 -4
  45. data/lib/twitter/rest/api/places_and_geo.rb +9 -10
  46. data/lib/twitter/rest/api/saved_searches.rb +5 -6
  47. data/lib/twitter/rest/api/search.rb +2 -3
  48. data/lib/twitter/rest/api/spam_reporting.rb +1 -2
  49. data/lib/twitter/rest/api/suggested_users.rb +4 -5
  50. data/lib/twitter/rest/api/timelines.rb +17 -18
  51. data/lib/twitter/rest/api/trends.rb +10 -11
  52. data/lib/twitter/rest/api/tweets.rb +15 -16
  53. data/lib/twitter/rest/api/undocumented.rb +6 -7
  54. data/lib/twitter/rest/api/users.rb +51 -52
  55. data/lib/twitter/rest/api/utils.rb +23 -30
  56. data/lib/twitter/rest/client.rb +8 -9
  57. data/lib/twitter/rest/request/multipart_with_file.rb +0 -1
  58. data/lib/twitter/rest/response/parse_error_json.rb +0 -2
  59. data/lib/twitter/rest/response/parse_json.rb +0 -2
  60. data/lib/twitter/rest/response/raise_error.rb +1 -3
  61. data/lib/twitter/search_results.rb +12 -15
  62. data/lib/twitter/settings.rb +2 -2
  63. data/lib/twitter/size.rb +2 -2
  64. data/lib/twitter/source_user.rb +1 -1
  65. data/lib/twitter/streaming/client.rb +71 -18
  66. data/lib/twitter/streaming/connection.rb +1 -3
  67. data/lib/twitter/streaming/deleted_tweet.rb +8 -0
  68. data/lib/twitter/streaming/event.rb +8 -8
  69. data/lib/twitter/streaming/friend_list.rb +2 -9
  70. data/lib/twitter/streaming/message_parser.rb +13 -7
  71. data/lib/twitter/streaming/response.rb +0 -2
  72. data/lib/twitter/streaming/stall_warning.rb +7 -0
  73. data/lib/twitter/suggestion.rb +0 -1
  74. data/lib/twitter/token.rb +2 -3
  75. data/lib/twitter/trend_results.rb +5 -8
  76. data/lib/twitter/tweet.rb +16 -24
  77. data/lib/twitter/user.rb +30 -32
  78. data/lib/twitter/version.rb +2 -5
  79. data/spec/fixtures/track_streaming_user.json +2 -1
  80. data/spec/helper.rb +6 -2
  81. data/spec/twitter/base_spec.rb +9 -9
  82. data/spec/twitter/basic_user_spec.rb +6 -6
  83. data/spec/twitter/configuration_spec.rb +4 -4
  84. data/spec/twitter/cursor_spec.rb +27 -27
  85. data/spec/twitter/direct_message_spec.rb +36 -36
  86. data/spec/twitter/entity/uri_spec.rb +27 -27
  87. data/spec/twitter/error_spec.rb +21 -21
  88. data/spec/twitter/geo/point_spec.rb +9 -9
  89. data/spec/twitter/geo/polygon_spec.rb +5 -5
  90. data/spec/twitter/geo_factory_spec.rb +7 -7
  91. data/spec/twitter/geo_results_spec.rb +11 -11
  92. data/spec/twitter/geo_spec.rb +5 -5
  93. data/spec/twitter/identifiable_spec.rb +9 -9
  94. data/spec/twitter/list_spec.rb +38 -38
  95. data/spec/twitter/media/photo_spec.rb +54 -54
  96. data/spec/twitter/media_factory_spec.rb +5 -5
  97. data/spec/twitter/null_object_spec.rb +6 -6
  98. data/spec/twitter/oembed_spec.rb +65 -65
  99. data/spec/twitter/place_spec.rb +89 -60
  100. data/spec/twitter/profile_banner_spec.rb +3 -3
  101. data/spec/twitter/rate_limit_spec.rb +18 -18
  102. data/spec/twitter/relationship_spec.rb +16 -16
  103. data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
  104. data/spec/twitter/rest/api/favorites_spec.rb +93 -93
  105. data/spec/twitter/rest/api/friends_and_followers_spec.rb +349 -349
  106. data/spec/twitter/rest/api/geo_spec.rb +33 -33
  107. data/spec/twitter/rest/api/help_spec.rb +24 -24
  108. data/spec/twitter/rest/api/lists_spec.rb +487 -487
  109. data/spec/twitter/rest/api/oauth_spec.rb +30 -30
  110. data/spec/twitter/rest/api/saved_searches_spec.rb +40 -40
  111. data/spec/twitter/rest/api/search_spec.rb +16 -16
  112. data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
  113. data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
  114. data/spec/twitter/rest/api/timelines_spec.rb +58 -58
  115. data/spec/twitter/rest/api/trends_spec.rb +26 -26
  116. data/spec/twitter/rest/api/tweets_spec.rb +284 -284
  117. data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
  118. data/spec/twitter/rest/api/users_spec.rb +360 -360
  119. data/spec/twitter/rest/client_spec.rb +99 -103
  120. data/spec/twitter/saved_search_spec.rb +16 -16
  121. data/spec/twitter/search_results_spec.rb +44 -44
  122. data/spec/twitter/settings_spec.rb +8 -8
  123. data/spec/twitter/size_spec.rb +5 -5
  124. data/spec/twitter/source_user_spec.rb +6 -6
  125. data/spec/twitter/streaming/client_spec.rb +53 -49
  126. data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
  127. data/spec/twitter/streaming/event_spec.rb +20 -22
  128. data/spec/twitter/streaming/friend_list_spec.rb +11 -0
  129. data/spec/twitter/streaming/message_parser_spec.rb +54 -0
  130. data/spec/twitter/suggestion_spec.rb +11 -11
  131. data/spec/twitter/target_user_spec.rb +6 -6
  132. data/spec/twitter/token_spec.rb +4 -4
  133. data/spec/twitter/trend_results_spec.rb +30 -30
  134. data/spec/twitter/trend_spec.rb +20 -20
  135. data/spec/twitter/tweet_spec.rb +170 -173
  136. data/spec/twitter/user_spec.rb +179 -179
  137. data/twitter.gemspec +2 -2
  138. metadata +21 -4
  139. metadata.gz.sig +2 -1
@@ -23,9 +23,9 @@ module Twitter
23
23
  # client = Twitter::REST::Client.new(:consumer_key => "abc", :consumer_secret => 'def')
24
24
  # bearer_token = client.token
25
25
  def token
26
- object_from_response(Twitter::Token, :post, "/oauth2/token", :grant_type => "client_credentials", :bearer_token_request => true)
26
+ object_from_response(Twitter::Token, :post, '/oauth2/token', :grant_type => 'client_credentials', :bearer_token_request => true)
27
27
  end
28
- alias bearer_token token
28
+ alias_method :bearer_token, :token
29
29
 
30
30
  # Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
31
31
  #
@@ -37,7 +37,7 @@ module Twitter
37
37
  # @return [Twitter::Token] The invalidated token. token_type should be nil.
38
38
  def invalidate_token(access_token)
39
39
  access_token = access_token.access_token if access_token.is_a?(Twitter::Token)
40
- object_from_response(Twitter::Token, :post, "/oauth2/invalidate_token", :access_token => access_token)
40
+ object_from_response(Twitter::Token, :post, '/oauth2/invalidate_token', :access_token => access_token)
41
41
  end
42
42
 
43
43
  # Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
@@ -55,7 +55,6 @@ module Twitter
55
55
  end
56
56
  response.body
57
57
  end
58
-
59
58
  end
60
59
  end
61
60
  end
@@ -17,7 +17,7 @@ module Twitter
17
17
  # @param place_id [String] A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
18
18
  # @param options [Hash] A customizable set of options.
19
19
  # @return [Twitter::Place] The requested place.
20
- def place(place_id, options={})
20
+ def place(place_id, options = {})
21
21
  object_from_response(Twitter::Place, :get, "/1.1/geo/id/#{place_id}.json", options)
22
22
  end
23
23
 
@@ -35,8 +35,8 @@ module Twitter
35
35
  # @option options [String] :granularity ('neighborhood') This is the minimal granularity of place types to return and must be one of: 'poi', 'neighborhood', 'city', 'admin' or 'country'.
36
36
  # @option options [Integer] :max_results A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many "nearby" results to return. Ideally, only pass in the number of places you intend to display to the user here.
37
37
  # @return [Array<Twitter::Place>]
38
- def reverse_geocode(options={})
39
- object_from_response(Twitter::GeoResults, :get, "/1.1/geo/reverse_geocode.json", options)
38
+ def reverse_geocode(options = {})
39
+ object_from_response(Twitter::GeoResults, :get, '/1.1/geo/reverse_geocode.json', options)
40
40
  end
41
41
 
42
42
  # Search for places that can be attached to a {Twitter::REST::API::Tweets#update}
@@ -56,10 +56,10 @@ module Twitter
56
56
  # @option options [String] :contained_within This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
57
57
  # @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
58
58
  # @return [Array<Twitter::Place>]
59
- def geo_search(options={})
60
- object_from_response(Twitter::GeoResults, :get, "/1.1/geo/search.json", options)
59
+ def geo_search(options = {})
60
+ object_from_response(Twitter::GeoResults, :get, '/1.1/geo/search.json', options)
61
61
  end
62
- alias places_nearby geo_search
62
+ alias_method :places_nearby, :geo_search
63
63
 
64
64
  # Locates places near the given coordinates which are similar in name
65
65
  #
@@ -75,11 +75,10 @@ module Twitter
75
75
  # @option options [String] :contained_within This is the place_id which you would like to restrict the search results to. Setting this value means only places within the given place_id will be found.
76
76
  # @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
77
77
  # @return [Array<Twitter::Place>]
78
- def similar_places(options={})
79
- object_from_response(Twitter::GeoResults, :get, "/1.1/geo/similar_places.json", options)
78
+ def similar_places(options = {})
79
+ object_from_response(Twitter::GeoResults, :get, '/1.1/geo/similar_places.json', options)
80
80
  end
81
- alias places_similar similar_places
82
-
81
+ alias_method :places_similar, :similar_places
83
82
  end
84
83
  end
85
84
  end
@@ -12,7 +12,7 @@ module Twitter
12
12
  # @authentication Requires user context
13
13
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
14
14
  # @return [Array<Twitter::SavedSearch>] The saved searches.
15
- # @overload saved_search(options={})
15
+ # @overload saved_search(options = {})
16
16
  # Returns the authenticated user's saved search queries
17
17
  #
18
18
  # @see https://dev.twitter.com/docs/api/1.1/get/saved_searches/list
@@ -31,7 +31,7 @@ module Twitter
31
31
  def saved_searches(*args)
32
32
  arguments = Twitter::Arguments.new(args)
33
33
  if arguments.empty?
34
- objects_from_response(Twitter::SavedSearch, :get, "/1.1/saved_searches/list.json", arguments.options)
34
+ objects_from_response(Twitter::SavedSearch, :get, '/1.1/saved_searches/list.json', arguments.options)
35
35
  else
36
36
  arguments.flatten.threaded_map do |id|
37
37
  saved_search(id, arguments.options)
@@ -48,7 +48,7 @@ module Twitter
48
48
  # @return [Twitter::SavedSearch] The saved searches.
49
49
  # @param id [Integer] The ID of the saved search.
50
50
  # @param options [Hash] A customizable set of options.
51
- def saved_search(id, options={})
51
+ def saved_search(id, options = {})
52
52
  object_from_response(Twitter::SavedSearch, :get, "/1.1/saved_searches/show/#{id}.json", options)
53
53
  end
54
54
 
@@ -61,8 +61,8 @@ module Twitter
61
61
  # @return [Twitter::SavedSearch] The created saved search.
62
62
  # @param query [String] The query of the search the user would like to save.
63
63
  # @param options [Hash] A customizable set of options.
64
- def create_saved_search(query, options={})
65
- object_from_response(Twitter::SavedSearch, :post, "/1.1/saved_searches/create.json", options.merge(:query => query))
64
+ def create_saved_search(query, options = {})
65
+ object_from_response(Twitter::SavedSearch, :post, '/1.1/saved_searches/create.json', options.merge(:query => query))
66
66
  end
67
67
  deprecate_alias :saved_search_create, :create_saved_search
68
68
 
@@ -86,7 +86,6 @@ module Twitter
86
86
  end
87
87
  end
88
88
  deprecate_alias :saved_search_destroy, :destroy_saved_search
89
-
90
89
  end
91
90
  end
92
91
  end
@@ -27,10 +27,9 @@ module Twitter
27
27
  # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
28
28
  # @option options [Boolean, String, Integer] :include_entities The tweet entities node will be disincluded when set to false.
29
29
  # @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
30
- def search(q, options={})
31
- object_from_response(Twitter::SearchResults, :get, "/1.1/search/tweets.json", options.merge(:q => q))
30
+ def search(q, options = {})
31
+ object_from_response(Twitter::SearchResults, :get, '/1.1/search/tweets.json', options.merge(:q => q))
32
32
  end
33
-
34
33
  end
35
34
  end
36
35
  end
@@ -20,9 +20,8 @@ module Twitter
20
20
  # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
21
21
  # @param options [Hash] A customizable set of options.
22
22
  def report_spam(*args)
23
- threaded_user_objects_from_response(:post, "/1.1/users/report_spam.json", args)
23
+ threaded_user_objects_from_response(:post, '/1.1/users/report_spam.json', args)
24
24
  end
25
-
26
25
  end
27
26
  end
28
27
  end
@@ -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