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
@@ -22,8 +22,8 @@ module Twitter
22
22
  # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
23
23
  # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
24
24
  # @option options [Integer] :page Specifies the page of results to retrieve.
25
- def direct_messages_received(options={})
26
- objects_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages.json", options)
25
+ def direct_messages_received(options = {})
26
+ objects_from_response(Twitter::DirectMessage, :get, '/1.1/direct_messages.json', options)
27
27
  end
28
28
 
29
29
  # Returns the 20 most recent direct messages sent by the authenticating user
@@ -39,8 +39,8 @@ module Twitter
39
39
  # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
40
40
  # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
41
41
  # @option options [Integer] :page Specifies the page of results to retrieve.
42
- def direct_messages_sent(options={})
43
- objects_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages/sent.json", options)
42
+ def direct_messages_sent(options = {})
43
+ objects_from_response(Twitter::DirectMessage, :get, '/1.1/direct_messages/sent.json', options)
44
44
  end
45
45
 
46
46
  # Returns a direct message
@@ -53,9 +53,9 @@ module Twitter
53
53
  # @return [Twitter::DirectMessage] The requested messages.
54
54
  # @param id [Integer] A direct message ID.
55
55
  # @param options [Hash] A customizable set of options.
56
- def direct_message(id, options={})
56
+ def direct_message(id, options = {})
57
57
  options[:id] = id
58
- object_from_response(Twitter::DirectMessage, :get, "/1.1/direct_messages/show.json", options)
58
+ object_from_response(Twitter::DirectMessage, :get, '/1.1/direct_messages/show.json', options)
59
59
  end
60
60
 
61
61
  # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
@@ -63,7 +63,7 @@ module Twitter
63
63
  # @authentication Requires user context
64
64
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
65
65
  # @return [Array<Twitter::DirectMessage>] The requested messages.
66
- # @overload direct_messages(options={})
66
+ # @overload direct_messages(options = {})
67
67
  # Returns the 20 most recent direct messages sent to the authenticating user
68
68
  #
69
69
  # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages
@@ -108,7 +108,7 @@ module Twitter
108
108
  # @param ids [Enumerable<Integer>] A collection of direct message IDs.
109
109
  # @param options [Hash] A customizable set of options.
110
110
  def destroy_direct_message(*args)
111
- threaded_objects_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/destroy.json", args)
111
+ threaded_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
112
112
  end
113
113
  deprecate_alias :direct_message_destroy, :destroy_direct_message
114
114
 
@@ -122,16 +122,15 @@ module Twitter
122
122
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
123
123
  # @param text [String] The text of your direct message, up to 140 characters.
124
124
  # @param options [Hash] A customizable set of options.
125
- def create_direct_message(user, text, options={})
125
+ def create_direct_message(user, text, options = {})
126
126
  merge_user!(options, user)
127
127
  options[:text] = text
128
- object_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/new.json", options)
128
+ object_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/new.json', options)
129
129
  end
130
- alias d create_direct_message
131
- alias m create_direct_message
132
- alias dm create_direct_message
130
+ alias_method :d, :create_direct_message
131
+ alias_method :m, :create_direct_message
132
+ alias_method :dm, :create_direct_message
133
133
  deprecate_alias :direct_message_create, :create_direct_message
134
-
135
134
  end
136
135
  end
137
136
  end
@@ -32,7 +32,7 @@ module Twitter
32
32
  def favorites(*args)
33
33
  arguments = Twitter::Arguments.new(args)
34
34
  merge_user!(arguments.options, arguments.pop) if arguments.last
35
- objects_from_response(Twitter::Tweet, :get, "/1.1/favorites/list.json", arguments.options)
35
+ objects_from_response(Twitter::Tweet, :get, '/1.1/favorites/list.json', arguments.options)
36
36
  end
37
37
 
38
38
  # Un-favorites the specified Tweets as the authenticating user
@@ -48,9 +48,9 @@ module Twitter
48
48
  # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
49
49
  # @param options [Hash] A customizable set of options.
50
50
  def unfavorite(*args)
51
- threaded_objects_from_response(Twitter::Tweet, :post, "/1.1/favorites/destroy.json", args)
51
+ threaded_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
52
52
  end
53
- alias destroy_favorite unfavorite
53
+ alias_method :destroy_favorite, :unfavorite
54
54
  deprecate_alias :favorite_destroy, :unfavorite
55
55
 
56
56
  # Favorites the specified Tweets as the authenticating user
@@ -70,14 +70,14 @@ module Twitter
70
70
  arguments.flatten.threaded_map do |tweet|
71
71
  id = extract_id(tweet)
72
72
  begin
73
- object_from_response(Twitter::Tweet, :post, "/1.1/favorites/create.json", arguments.options.merge(:id => id))
73
+ object_from_response(Twitter::Tweet, :post, '/1.1/favorites/create.json', arguments.options.merge(:id => id))
74
74
  rescue Twitter::Error::Forbidden => error
75
75
  raise unless error.message == Twitter::Error::AlreadyFavorited::MESSAGE
76
76
  end
77
77
  end.compact
78
78
  end
79
- alias fav favorite
80
- alias fave favorite
79
+ alias_method :fav, :favorite
80
+ alias_method :fave, :favorite
81
81
  deprecate_alias :favorite_create, :favorite
82
82
 
83
83
  # Favorites the specified Tweets as the authenticating user and raises an error if one has already been favorited
@@ -98,17 +98,16 @@ module Twitter
98
98
  arguments.flatten.threaded_map do |tweet|
99
99
  id = extract_id(tweet)
100
100
  begin
101
- object_from_response(Twitter::Tweet, :post, "/1.1/favorites/create.json", arguments.options.merge(:id => id))
101
+ object_from_response(Twitter::Tweet, :post, '/1.1/favorites/create.json', arguments.options.merge(:id => id))
102
102
  rescue Twitter::Error::Forbidden => error
103
103
  handle_forbidden_error(Twitter::Error::AlreadyFavorited, error)
104
104
  end
105
105
  end
106
106
  end
107
- alias create_favorite! favorite!
108
- alias fav! favorite!
109
- alias fave! favorite!
107
+ alias_method :create_favorite!, :favorite!
108
+ alias_method :fav!, :favorite!
109
+ alias_method :fave!, :favorite!
110
110
  deprecate_alias :favorite_create!, :favorite!
111
-
112
111
  end
113
112
  end
114
113
  end
@@ -16,19 +16,19 @@ module Twitter
16
16
  # @authentication Requires user context
17
17
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
18
18
  # @return [Twitter::Cursor]
19
- # @overload friend_ids(options={})
19
+ # @overload friend_ids(options = {})
20
20
  # Returns an array of numeric IDs for every user the authenticated user is following
21
21
  #
22
22
  # @param options [Hash] A customizable set of options.
23
23
  # @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
24
- # @overload friend_ids(user, options={})
24
+ # @overload friend_ids(user, options = {})
25
25
  # Returns an array of numeric IDs for every user the specified user is following
26
26
  #
27
27
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
28
28
  # @param options [Hash] A customizable set of options.
29
29
  # @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.
30
30
  def friend_ids(*args)
31
- cursor_from_response_with_user(:ids, nil, :get, "/1.1/friends/ids.json", args)
31
+ cursor_from_response_with_user(:ids, nil, :get, '/1.1/friends/ids.json', args)
32
32
  end
33
33
 
34
34
  # @see https://dev.twitter.com/docs/api/1.1/get/followers/ids
@@ -36,19 +36,19 @@ 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 [Twitter::Cursor]
39
- # @overload follower_ids(options={})
39
+ # @overload follower_ids(options = {})
40
40
  # Returns an array of numeric IDs for every user following the authenticated user
41
41
  #
42
42
  # @param options [Hash] A customizable set of options.
43
43
  # @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.
44
- # @overload follower_ids(user, options={})
44
+ # @overload follower_ids(user, options = {})
45
45
  # Returns an array of numeric IDs for every user following the specified user
46
46
  #
47
47
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
48
48
  # @param options [Hash] A customizable set of options.
49
49
  # @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
50
50
  def follower_ids(*args)
51
- cursor_from_response_with_user(:ids, nil, :get, "/1.1/followers/ids.json", args)
51
+ cursor_from_response_with_user(:ids, nil, :get, '/1.1/followers/ids.json', args)
52
52
  end
53
53
 
54
54
  # Returns the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none.
@@ -66,7 +66,7 @@ module Twitter
66
66
  def friendships(*args)
67
67
  arguments = Twitter::Arguments.new(args)
68
68
  merge_users!(arguments.options, arguments)
69
- objects_from_response(Twitter::User, :get, "/1.1/friendships/lookup.json", arguments.options)
69
+ objects_from_response(Twitter::User, :get, '/1.1/friendships/lookup.json', arguments.options)
70
70
  end
71
71
 
72
72
  # Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user
@@ -78,8 +78,8 @@ module Twitter
78
78
  # @return [Twitter::Cursor]
79
79
  # @param options [Hash] A customizable set of options.
80
80
  # @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.
81
- def friendships_incoming(options={})
82
- cursor_from_response(:ids, nil, :get, "/1.1/friendships/incoming.json", options)
81
+ def friendships_incoming(options = {})
82
+ cursor_from_response(:ids, nil, :get, '/1.1/friendships/incoming.json', options)
83
83
  end
84
84
 
85
85
  # Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request
@@ -91,8 +91,8 @@ module Twitter
91
91
  # @return [Twitter::Cursor]
92
92
  # @param options [Hash] A customizable set of options.
93
93
  # @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.
94
- def friendships_outgoing(options={})
95
- cursor_from_response(:ids, nil, :get, "/1.1/friendships/outgoing.json", options)
94
+ def friendships_outgoing(options = {})
95
+ cursor_from_response(:ids, nil, :get, '/1.1/friendships/outgoing.json', options)
96
96
  end
97
97
 
98
98
  # Allows the authenticating user to follow the specified users, unless they are already followed
@@ -118,7 +118,7 @@ module Twitter
118
118
  end
119
119
  follow!(new_friends.value - existing_friends.value, arguments.options)
120
120
  end
121
- alias create_friendship follow
121
+ alias_method :create_friendship, :follow
122
122
  deprecate_alias :friendship_create, :follow
123
123
 
124
124
  # Allows the authenticating user to follow the specified users
@@ -138,14 +138,15 @@ module Twitter
138
138
  arguments = Twitter::Arguments.new(args)
139
139
  arguments.flatten.threaded_map do |user|
140
140
  begin
141
- object_from_response(Twitter::User, :post, "/1.1/friendships/create.json", merge_user(arguments.options, user))
141
+ object_from_response(Twitter::User, :post, '/1.1/friendships/create.json', merge_user(arguments.options, user))
142
142
  rescue Twitter::Error::Forbidden
143
143
  # This error will be raised if the user doesn't have permission to
144
144
  # follow list_member, for whatever reason.
145
+ next
145
146
  end
146
147
  end.compact
147
148
  end
148
- alias create_friendship! follow!
149
+ alias_method :create_friendship!, :follow!
149
150
  deprecate_alias :friendship_create!, :follow!
150
151
 
151
152
  # Allows the authenticating user to unfollow the specified users
@@ -161,9 +162,9 @@ module Twitter
161
162
  # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
162
163
  # @param options [Hash] A customizable set of options.
163
164
  def unfollow(*args)
164
- threaded_user_objects_from_response(:post, "/1.1/friendships/destroy.json", args)
165
+ threaded_user_objects_from_response(:post, '/1.1/friendships/destroy.json', args)
165
166
  end
166
- alias destroy_friendship unfollow
167
+ alias_method :destroy_friendship, :unfollow
167
168
  deprecate_alias :friendship_destroy, :unfollow
168
169
 
169
170
  # Allows one to enable or disable retweets and device notifications from the specified user.
@@ -177,9 +178,9 @@ module Twitter
177
178
  # @param options [Hash] A customizable set of options.
178
179
  # @option options [Boolean] :device Enable/disable device notifications from the target user.
179
180
  # @option options [Boolean] :retweets Enable/disable retweets from the target user.
180
- def friendship_update(user, options={})
181
+ def friendship_update(user, options = {})
181
182
  merge_user!(options, user)
182
- object_from_response(Twitter::Relationship, :post, "/1.1/friendships/update.json", options)
183
+ object_from_response(Twitter::Relationship, :post, '/1.1/friendships/update.json', options)
183
184
  end
184
185
 
185
186
  # Returns detailed information about the relationship between two users
@@ -192,15 +193,15 @@ module Twitter
192
193
  # @param source [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the source user.
193
194
  # @param target [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the target user.
194
195
  # @param options [Hash] A customizable set of options.
195
- def friendship(source, target, options={})
196
- merge_user!(options, source, "source")
196
+ def friendship(source, target, options = {})
197
+ merge_user!(options, source, 'source')
197
198
  options[:source_id] = options.delete(:source_user_id) unless options[:source_user_id].nil?
198
- merge_user!(options, target, "target")
199
+ merge_user!(options, target, 'target')
199
200
  options[:target_id] = options.delete(:target_user_id) unless options[:target_user_id].nil?
200
- object_from_response(Twitter::Relationship, :get, "/1.1/friendships/show.json", options)
201
+ object_from_response(Twitter::Relationship, :get, '/1.1/friendships/show.json', options)
201
202
  end
202
- alias friendship_show friendship
203
- alias relationship friendship
203
+ alias_method :friendship_show, :friendship
204
+ alias_method :relationship, :friendship
204
205
 
205
206
  # Test for the existence of friendship between two users
206
207
  #
@@ -212,7 +213,7 @@ module Twitter
212
213
  # @param source [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the source user.
213
214
  # @param target [Integer, String, Twitter::User] The Twitter user ID, screen name, or object of the target user.
214
215
  # @param options [Hash] A customizable set of options.
215
- def friendship?(source, target, options={})
216
+ def friendship?(source, target, options = {})
216
217
  friendship(source, target, options).source.following?
217
218
  end
218
219
 
@@ -223,14 +224,14 @@ module Twitter
223
224
  # @authentication Requires user context
224
225
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
225
226
  # @return [Twitter::Cursor]
226
- # @overload followers(options={})
227
+ # @overload followers(options = {})
227
228
  # Returns a cursored collection of user objects for users following the authenticated user.
228
229
  #
229
230
  # @param options [Hash] A customizable set of options.
230
231
  # @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
231
232
  # @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
232
233
  # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
233
- # @overload followers(user, options={})
234
+ # @overload followers(user, options = {})
234
235
  # Returns a cursored collection of user objects for users following the specified user.
235
236
  #
236
237
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -239,7 +240,7 @@ module Twitter
239
240
  # @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
240
241
  # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
241
242
  def followers(*args)
242
- cursor_from_response_with_user(:users, Twitter::User, :get, "/1.1/followers/list.json", args)
243
+ cursor_from_response_with_user(:users, Twitter::User, :get, '/1.1/followers/list.json', args)
243
244
  end
244
245
 
245
246
  # Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
@@ -249,14 +250,14 @@ module Twitter
249
250
  # @authentication Requires user context
250
251
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
251
252
  # @return [Twitter::Cursor]
252
- # @overload friends(options={})
253
+ # @overload friends(options = {})
253
254
  # Returns a cursored collection of user objects for every user the authenticated user is following (otherwise known as their "friends").
254
255
  #
255
256
  # @param options [Hash] A customizable set of options.
256
257
  # @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
257
258
  # @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
258
259
  # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
259
- # @overload friends(user, options={})
260
+ # @overload friends(user, options = {})
260
261
  # Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends").
261
262
  #
262
263
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
@@ -265,9 +266,9 @@ module Twitter
265
266
  # @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1.
266
267
  # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
267
268
  def friends(*args)
268
- cursor_from_response_with_user(:users, Twitter::User, :get, "/1.1/friends/list.json", args)
269
+ cursor_from_response_with_user(:users, Twitter::User, :get, '/1.1/friends/list.json', args)
269
270
  end
270
- alias following friends
271
+ alias_method :following, :friends
271
272
 
272
273
  # Returns a collection of user IDs that the currently authenticated user does not want to receive retweets from.
273
274
  # @see https://dev.twitter.com/docs/api/1.1/get/friendships/no_retweets/ids
@@ -276,11 +277,10 @@ module Twitter
276
277
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
277
278
  # @return [Array<Integer>]
278
279
  # @param options [Hash] A customizable set of options.
279
- def no_retweet_ids(options={})
280
- get("/1.1/friendships/no_retweets/ids.json", options)[:body].map(&:to_i)
280
+ def no_retweet_ids(options = {})
281
+ get('/1.1/friendships/no_retweets/ids.json', options)[:body].map(&:to_i)
281
282
  end
282
- alias no_retweets_ids no_retweet_ids
283
-
283
+ alias_method :no_retweets_ids, :no_retweet_ids
284
284
  end
285
285
  end
286
286
  end
@@ -15,8 +15,8 @@ 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
  # @return [Twitter::Configuration] Twitter's configuration.
18
- def configuration(options={})
19
- object_from_response(Twitter::Configuration, :get, "/1.1/help/configuration.json", options)
18
+ def configuration(options = {})
19
+ object_from_response(Twitter::Configuration, :get, '/1.1/help/configuration.json', options)
20
20
  end
21
21
 
22
22
  # Returns the list of languages supported by Twitter
@@ -26,8 +26,8 @@ module Twitter
26
26
  # @authentication Requires user context
27
27
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
28
28
  # @return [Array<Twitter::Language>]
29
- def languages(options={})
30
- objects_from_response(Twitter::Language, :get, "/1.1/help/languages.json", options)
29
+ def languages(options = {})
30
+ objects_from_response(Twitter::Language, :get, '/1.1/help/languages.json', options)
31
31
  end
32
32
 
33
33
  # Returns {https://twitter.com/privacy Twitter's Privacy Policy}
@@ -37,8 +37,8 @@ module Twitter
37
37
  # @authentication Requires user context
38
38
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
39
39
  # @return [String]
40
- def privacy(options={})
41
- get("/1.1/help/privacy.json", options)[:body][:privacy]
40
+ def privacy(options = {})
41
+ get('/1.1/help/privacy.json', options)[:body][:privacy]
42
42
  end
43
43
 
44
44
  # Returns {https://twitter.com/tos Twitter's Terms of Service}
@@ -48,10 +48,9 @@ module Twitter
48
48
  # @authentication Requires user context
49
49
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
50
50
  # @return [String]
51
- def tos(options={})
52
- get("/1.1/help/tos.json", options)[:body][:tos]
51
+ def tos(options = {})
52
+ get('/1.1/help/tos.json', options)[:body][:tos]
53
53
  end
54
-
55
54
  end
56
55
  end
57
56
  end
@@ -14,7 +14,7 @@ module Twitter
14
14
  module Lists
15
15
  include Twitter::REST::API::Utils
16
16
  MAX_USERS_PER_REQUEST = 100
17
- URI_SUBSTRING = "://"
17
+ URI_SUBSTRING = '://'
18
18
 
19
19
  # Returns all lists the authenticating or specified user subscribes to, including their own
20
20
  #
@@ -23,17 +23,17 @@ module Twitter
23
23
  # @authentication Requires user context
24
24
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
25
25
  # @return [Array<Twitter::List>]
26
- # @overload lists(options={})
26
+ # @overload lists(options = {})
27
27
  # @param options [Hash] A customizable set of options.
28
28
  # @option options [Boolean] :reverse Set this to true if you would like owned lists to be returned first.
29
- # @overload lists(user, options={})
29
+ # @overload lists(user, options = {})
30
30
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
31
31
  # @param options [Hash] A customizable set of options.
32
32
  # @option options [Boolean] :reverse Set this to true if you would like owned lists to be returned first.
33
33
  def lists(*args)
34
- objects_from_response_with_user(Twitter::List, :get, "/1.1/lists/list.json", args)
34
+ objects_from_response_with_user(Twitter::List, :get, '/1.1/lists/list.json', args)
35
35
  end
36
- alias lists_subscribed_to lists
36
+ alias_method :lists_subscribed_to, :lists
37
37
 
38
38
  # Show tweet timeline for members of the specified list
39
39
  #
@@ -42,13 +42,13 @@ module Twitter
42
42
  # @authentication Requires user context
43
43
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
44
44
  # @return [Array<Twitter::Tweet>]
45
- # @overload list_timeline(list, options={})
45
+ # @overload list_timeline(list, options = {})
46
46
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
47
47
  # @param options [Hash] A customizable set of options.
48
48
  # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
49
49
  # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
50
50
  # @option options [Integer] :count The number of results to retrieve.
51
- # @overload list_timeline(user, list, options={})
51
+ # @overload list_timeline(user, list, options = {})
52
52
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
53
53
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
54
54
  # @param options [Hash] A customizable set of options.
@@ -59,7 +59,7 @@ module Twitter
59
59
  arguments = Twitter::Arguments.new(args)
60
60
  merge_list!(arguments.options, arguments.pop)
61
61
  merge_owner!(arguments.options, arguments.pop)
62
- objects_from_response(Twitter::Tweet, :get, "/1.1/lists/statuses.json", arguments.options)
62
+ objects_from_response(Twitter::Tweet, :get, '/1.1/lists/statuses.json', arguments.options)
63
63
  end
64
64
 
65
65
  # Removes the specified member from the list
@@ -69,17 +69,17 @@ module Twitter
69
69
  # @authentication Requires user context
70
70
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
71
71
  # @return [Twitter::List] The list.
72
- # @overload remove_list_member(list, user_to_remove, options={})
72
+ # @overload remove_list_member(list, user_to_remove, options = {})
73
73
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
74
74
  # @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
75
75
  # @param options [Hash] A customizable set of options.
76
- # @overload remove_list_member(user, list, user_to_remove, options={})
76
+ # @overload remove_list_member(user, list, user_to_remove, options = {})
77
77
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
78
78
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
79
79
  # @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
80
80
  # @param options [Hash] A customizable set of options.
81
81
  def remove_list_member(*args)
82
- list_from_response_with_user(:post, "/1.1/lists/members/destroy.json", args)
82
+ list_from_response_with_user(:post, '/1.1/lists/members/destroy.json', args)
83
83
  end
84
84
  deprecate_alias :list_remove_member, :remove_list_member
85
85
 
@@ -90,17 +90,17 @@ module Twitter
90
90
  # @authentication Requires user context
91
91
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
92
92
  # @return [Twitter::Cursor]
93
- # @overload memberships(options={})
93
+ # @overload memberships(options = {})
94
94
  # @param options [Hash] A customizable set of options.
95
95
  # @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.
96
96
  # @option options [Boolean, String, Integer] :filter_to_owned_lists When set to true, t or 1, will return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.
97
- # @overload memberships(user, options={})
97
+ # @overload memberships(user, options = {})
98
98
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
99
99
  # @param options [Hash] A customizable set of options.
100
100
  # @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.
101
101
  # @option options [Boolean, String, Integer] :filter_to_owned_lists When set to true, t or 1, will return just lists the authenticating user owns, and the user represented by user_id or screen_name is a member of.
102
102
  def memberships(*args)
103
- cursor_from_response_with_user(:lists, Twitter::List, :get, "/1.1/lists/memberships.json", args)
103
+ cursor_from_response_with_user(:lists, Twitter::List, :get, '/1.1/lists/memberships.json', args)
104
104
  end
105
105
 
106
106
  # Returns the subscribers of the specified list
@@ -110,17 +110,17 @@ module Twitter
110
110
  # @authentication Requires user context
111
111
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
112
112
  # @return [Twitter::Cursor] The subscribers of the specified list.
113
- # @overload list_subscribers(list, options={})
113
+ # @overload list_subscribers(list, options = {})
114
114
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
115
115
  # @param options [Hash] A customizable set of options.
116
116
  # @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.
117
- # @overload list_subscribers(user, list, options={})
117
+ # @overload list_subscribers(user, list, options = {})
118
118
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
119
119
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
120
120
  # @param options [Hash] A customizable set of options.
121
121
  # @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.
122
122
  def list_subscribers(*args)
123
- cursor_from_response_with_list(:get, "/1.1/lists/subscribers.json", args)
123
+ cursor_from_response_with_list(:get, '/1.1/lists/subscribers.json', args)
124
124
  end
125
125
 
126
126
  # Make the authenticated user follow the specified list
@@ -130,15 +130,15 @@ module Twitter
130
130
  # @authentication Requires user context
131
131
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
132
132
  # @return [Twitter::List] The specified list.
133
- # @overload list_subscribe(list, options={})
133
+ # @overload list_subscribe(list, options = {})
134
134
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
135
135
  # @param options [Hash] A customizable set of options.
136
- # @overload list_subscribe(user, list, options={})
136
+ # @overload list_subscribe(user, list, options = {})
137
137
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
138
138
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
139
139
  # @param options [Hash] A customizable set of options.
140
140
  def list_subscribe(*args)
141
- list_from_response(:post, "/1.1/lists/subscribers/create.json", args)
141
+ list_from_response(:post, '/1.1/lists/subscribers/create.json', args)
142
142
  end
143
143
 
144
144
  # Check if a user is a subscriber of the specified list
@@ -148,18 +148,18 @@ module Twitter
148
148
  # @authentication Requires user context
149
149
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
150
150
  # @return [Boolean] true if user is a subscriber of the specified list, otherwise false.
151
- # @overload list_subscriber?(list, user_to_check, options={})
151
+ # @overload list_subscriber?(list, user_to_check, options = {})
152
152
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
153
153
  # @param user_to_check [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
154
154
  # @param options [Hash] A customizable set of options.
155
- # @overload list_subscriber?(user, list, user_to_check, options={})
155
+ # @overload list_subscriber?(user, list, user_to_check, options = {})
156
156
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
157
157
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
158
158
  # @param user_to_check [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
159
159
  # @param options [Hash] A customizable set of options.
160
160
  # @return [Boolean] true if user is a subscriber of the specified list, otherwise false.
161
161
  def list_subscriber?(*args)
162
- list_user?(:get, "/1.1/lists/subscribers/show.json", args)
162
+ list_user?(:get, '/1.1/lists/subscribers/show.json', args)
163
163
  end
164
164
 
165
165
  # Unsubscribes the authenticated user form the specified list
@@ -169,15 +169,15 @@ module Twitter
169
169
  # @authentication Requires user context
170
170
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
171
171
  # @return [Twitter::List] The specified list.
172
- # @overload list_unsubscribe(list, options={})
172
+ # @overload list_unsubscribe(list, options = {})
173
173
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
174
174
  # @param options [Hash] A customizable set of options.
175
- # @overload list_unsubscribe(user, list, options={})
175
+ # @overload list_unsubscribe(user, list, options = {})
176
176
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
177
177
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
178
178
  # @param options [Hash] A customizable set of options.
179
179
  def list_unsubscribe(*args)
180
- list_from_response(:post, "/1.1/lists/subscribers/destroy.json", args)
180
+ list_from_response(:post, '/1.1/lists/subscribers/destroy.json', args)
181
181
  end
182
182
 
183
183
  # Adds specified members to a list
@@ -188,17 +188,17 @@ module Twitter
188
188
  # @authentication Requires user context
189
189
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
190
190
  # @return [Twitter::List] The list.
191
- # @overload add_list_members(list, users, options={})
191
+ # @overload add_list_members(list, users, options = {})
192
192
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
193
193
  # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
194
194
  # @param options [Hash] A customizable set of options.
195
- # @overload add_list_members(user, list, users, options={})
195
+ # @overload add_list_members(user, list, users, options = {})
196
196
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
197
197
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
198
198
  # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
199
199
  # @param options [Hash] A customizable set of options.
200
200
  def add_list_members(*args)
201
- list_from_response_with_users(:post, "/1.1/lists/members/create_all.json", args)
201
+ list_from_response_with_users(:post, '/1.1/lists/members/create_all.json', args)
202
202
  end
203
203
  deprecate_alias :list_add_members, :add_list_members
204
204
 
@@ -209,17 +209,17 @@ module Twitter
209
209
  # @rate_limited Yes
210
210
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
211
211
  # @return [Boolean] true if user is a member of the specified list, otherwise false.
212
- # @overload list_member?(list, user_to_check, options={})
212
+ # @overload list_member?(list, user_to_check, options = {})
213
213
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
214
214
  # @param user_to_check [Integer, String] The user ID or screen name of the list member.
215
215
  # @param options [Hash] A customizable set of options.
216
- # @overload list_member?(user, list, user_to_check, options={})
216
+ # @overload list_member?(user, list, user_to_check, options = {})
217
217
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
218
218
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
219
219
  # @param user_to_check [Integer, String] The user ID or screen name of the list member.
220
220
  # @param options [Hash] A customizable set of options.
221
221
  def list_member?(*args)
222
- list_user?(:get, "/1.1/lists/members/show.json", args)
222
+ list_user?(:get, '/1.1/lists/members/show.json', args)
223
223
  end
224
224
 
225
225
  # Returns the members of the specified list
@@ -229,17 +229,17 @@ module Twitter
229
229
  # @authentication Requires user context
230
230
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
231
231
  # @return [Twitter::Cursor]
232
- # @overload list_members(list, options={})
232
+ # @overload list_members(list, options = {})
233
233
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
234
234
  # @param options [Hash] A customizable set of options.
235
235
  # @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.
236
- # @overload list_members(user, list, options={})
236
+ # @overload list_members(user, list, options = {})
237
237
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
238
238
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
239
239
  # @param options [Hash] A customizable set of options.
240
240
  # @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.
241
241
  def list_members(*args)
242
- cursor_from_response_with_list(:get, "/1.1/lists/members.json", args)
242
+ cursor_from_response_with_list(:get, '/1.1/lists/members.json', args)
243
243
  end
244
244
 
245
245
  # Add a member to a list
@@ -250,17 +250,17 @@ module Twitter
250
250
  # @authentication Requires user context
251
251
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
252
252
  # @return [Twitter::List] The list.
253
- # @overload add_list_member(list, user_to_add, options={})
253
+ # @overload add_list_member(list, user_to_add, options = {})
254
254
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
255
255
  # @param user_to_add [Integer, String] The user id or screen name to add to the list.
256
256
  # @param options [Hash] A customizable set of options.
257
- # @overload add_list_member(user, list, user_to_add, options={})
257
+ # @overload add_list_member(user, list, user_to_add, options = {})
258
258
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
259
259
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
260
260
  # @param user_to_add [Integer, String] The user id or screen name to add to the list.
261
261
  # @param options [Hash] A customizable set of options.
262
262
  def add_list_member(*args)
263
- list_from_response_with_user(:post, "/1.1/lists/members/create.json", args)
263
+ list_from_response_with_user(:post, '/1.1/lists/members/create.json', args)
264
264
  end
265
265
  deprecate_alias :list_add_member, :add_list_member
266
266
 
@@ -272,15 +272,15 @@ module Twitter
272
272
  # @authentication Requires user context
273
273
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
274
274
  # @return [Twitter::List] The deleted list.
275
- # @overload destroy_list(list, options={})
275
+ # @overload destroy_list(list, options = {})
276
276
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
277
277
  # @param options [Hash] A customizable set of options.
278
- # @overload destroy_list(user, list, options={})
278
+ # @overload destroy_list(user, list, options = {})
279
279
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
280
280
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
281
281
  # @param options [Hash] A customizable set of options.
282
282
  def destroy_list(*args)
283
- list_from_response(:post, "/1.1/lists/destroy.json", args)
283
+ list_from_response(:post, '/1.1/lists/destroy.json', args)
284
284
  end
285
285
  deprecate_alias :list_destroy, :destroy_list
286
286
 
@@ -291,19 +291,19 @@ module Twitter
291
291
  # @authentication Requires user context
292
292
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
293
293
  # @return [Twitter::List] The created list.
294
- # @overload list_update(list, options={})
294
+ # @overload list_update(list, options = {})
295
295
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
296
296
  # @param options [Hash] A customizable set of options.
297
297
  # @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
298
298
  # @option options [String] :description The description to give the list.
299
- # @overload list_update(user, list, options={})
299
+ # @overload list_update(user, list, options = {})
300
300
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
301
301
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
302
302
  # @param options [Hash] A customizable set of options.
303
303
  # @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
304
304
  # @option options [String] :description The description to give the list.
305
305
  def list_update(*args)
306
- list_from_response(:post, "/1.1/lists/update.json", args)
306
+ list_from_response(:post, '/1.1/lists/update.json', args)
307
307
  end
308
308
 
309
309
  # Creates a new list for the authenticated user
@@ -318,8 +318,8 @@ module Twitter
318
318
  # @param options [Hash] A customizable set of options.
319
319
  # @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
320
320
  # @option options [String] :description The description to give the list.
321
- def create_list(name, options={})
322
- object_from_response(Twitter::List, :post, "/1.1/lists/create.json", options.merge(:name => name))
321
+ def create_list(name, options = {})
322
+ object_from_response(Twitter::List, :post, '/1.1/lists/create.json', options.merge(:name => name))
323
323
  end
324
324
  deprecate_alias :list_create, :create_list
325
325
 
@@ -331,15 +331,15 @@ module Twitter
331
331
  # @authentication Requires user context
332
332
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
333
333
  # @return [Twitter::List] The specified list.
334
- # @overload list(list, options={})
334
+ # @overload list(list, options = {})
335
335
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
336
336
  # @param options [Hash] A customizable set of options.
337
- # @overload list(user, list, options={})
337
+ # @overload list(user, list, options = {})
338
338
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
339
339
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
340
340
  # @param options [Hash] A customizable set of options.
341
341
  def list(*args)
342
- list_from_response(:get, "/1.1/lists/show.json", args)
342
+ list_from_response(:get, '/1.1/lists/show.json', args)
343
343
  end
344
344
 
345
345
  # List the lists the specified user follows
@@ -349,15 +349,15 @@ module Twitter
349
349
  # @authentication Requires user context
350
350
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
351
351
  # @return [Twitter::Cursor]
352
- # @overload subscriptions(options={})
352
+ # @overload subscriptions(options = {})
353
353
  # @param options [Hash] A customizable set of options.
354
354
  # @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.
355
- # @overload subscriptions(user, options={})
355
+ # @overload subscriptions(user, options = {})
356
356
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
357
357
  # @param options [Hash] A customizable set of options.
358
358
  # @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.
359
359
  def subscriptions(*args)
360
- cursor_from_response_with_user(:lists, Twitter::List, :get, "/1.1/lists/subscriptions.json", args)
360
+ cursor_from_response_with_user(:lists, Twitter::List, :get, '/1.1/lists/subscriptions.json', args)
361
361
  end
362
362
 
363
363
  # Removes specified members from the list
@@ -367,17 +367,17 @@ module Twitter
367
367
  # @authentication Requires user context
368
368
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
369
369
  # @return [Twitter::List] The list.
370
- # @overload remove_list_members(list, users, options={})
370
+ # @overload remove_list_members(list, users, options = {})
371
371
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
372
372
  # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
373
373
  # @param options [Hash] A customizable set of options.
374
- # @overload remove_list_members(user, list, users, options={})
374
+ # @overload remove_list_members(user, list, users, options = {})
375
375
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
376
376
  # @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
377
377
  # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
378
378
  # @param options [Hash] A customizable set of options.
379
379
  def remove_list_members(*args)
380
- list_from_response_with_users(:post, "/1.1/lists/members/destroy_all.json", args)
380
+ list_from_response_with_users(:post, '/1.1/lists/members/destroy_all.json', args)
381
381
  end
382
382
  deprecate_alias :list_remove_members, :remove_list_members
383
383
 
@@ -388,15 +388,15 @@ module Twitter
388
388
  # @authentication Requires user context
389
389
  # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
390
390
  # @return [Array<Twitter::List>]
391
- # @overload owned_lists(options={})
391
+ # @overload owned_lists(options = {})
392
392
  # @param options [Hash] A customizable set of options.
393
393
  # @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
394
- # @overload owned_lists(user, options={})
394
+ # @overload owned_lists(user, options = {})
395
395
  # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
396
396
  # @param options [Hash] A customizable set of options.
397
397
  # @option options [Integer] :count The amount of results to return per page. Defaults to 20. No more than 1000 results will ever be returned in a single page.
398
398
  def owned_lists(*args)
399
- cursor_from_response_with_user(:lists, Twitter::List, :get, "/1.1/lists/ownerships.json", args)
399
+ cursor_from_response_with_user(:lists, Twitter::List, :get, '/1.1/lists/ownerships.json', args)
400
400
  end
401
401
  deprecate_alias :lists_ownerships, :owned_lists
402
402
  deprecate_alias :lists_owned, :owned_lists
@@ -455,20 +455,20 @@ module Twitter
455
455
  # @param hash [Hash]
456
456
  # @param list [Integer, String, URI, Twitter::List] A Twitter list ID, slug, URI, or object.
457
457
  # @return [Hash]
458
- def merge_list!(hash, list)
458
+ def merge_list!(hash, list) # rubocop:disable MethodLength
459
459
  case list
460
460
  when Integer
461
461
  hash[:list_id] = list
462
462
  when String
463
463
  if list[URI_SUBSTRING]
464
- list = list.split("/")
464
+ list = list.split('/')
465
465
  hash[:slug] = list.pop
466
466
  hash[:owner_screen_name] = list.pop
467
467
  else
468
468
  hash[:slug] = list
469
469
  end
470
470
  when URI
471
- list = list.path.split("/")
471
+ list = list.path.split('/')
472
472
  hash[:slug] = list.pop
473
473
  hash[:owner_screen_name] = list.pop
474
474
  when Twitter::List
@@ -486,12 +486,11 @@ module Twitter
486
486
  def merge_owner!(hash, user)
487
487
  unless hash[:owner_id] || hash[:owner_screen_name]
488
488
  user ||= screen_name
489
- merge_user!(hash, user, "owner")
489
+ merge_user!(hash, user, 'owner')
490
490
  hash[:owner_id] = hash.delete(:owner_user_id) unless hash[:owner_user_id].nil?
491
491
  end
492
492
  hash
493
493
  end
494
-
495
494
  end
496
495
  end
497
496
  end