twitter 5.0.0.rc.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +7 -1
- data/CONTRIBUTING.md +13 -15
- data/README.md +53 -33
- data/Rakefile +6 -0
- data/lib/twitter/arguments.rb +3 -0
- data/lib/twitter/base.rb +88 -89
- data/lib/twitter/client.rb +5 -41
- data/lib/twitter/configuration.rb +4 -5
- data/lib/twitter/core_ext/kernel.rb +5 -1
- data/lib/twitter/creatable.rb +6 -1
- data/lib/twitter/cursor.rb +16 -12
- data/lib/twitter/entity/uri.rb +2 -1
- data/lib/twitter/enumerable.rb +1 -1
- data/lib/twitter/error.rb +42 -39
- data/lib/twitter/factory.rb +12 -5
- data/lib/twitter/geo.rb +2 -7
- data/lib/twitter/geo_factory.rb +11 -7
- data/lib/twitter/geo_results.rb +12 -8
- data/lib/twitter/identity.rb +4 -12
- data/lib/twitter/list.rb +6 -3
- data/lib/twitter/media/photo.rb +5 -3
- data/lib/twitter/media_factory.rb +11 -7
- data/lib/twitter/null_object.rb +4 -3
- data/lib/twitter/place.rb +10 -16
- data/lib/twitter/profile_banner.rb +4 -5
- data/lib/twitter/rate_limit.rb +3 -0
- data/lib/twitter/relationship.rb +0 -9
- data/lib/twitter/rest/api/direct_messages.rb +9 -6
- data/lib/twitter/rest/api/favorites.rb +6 -11
- data/lib/twitter/rest/api/friends_and_followers.rb +6 -9
- data/lib/twitter/rest/api/lists.rb +27 -20
- data/lib/twitter/rest/api/oauth.rb +17 -0
- data/lib/twitter/rest/api/places_and_geo.rb +0 -18
- data/lib/twitter/rest/api/saved_searches.rb +6 -4
- data/lib/twitter/rest/api/suggested_users.rb +2 -2
- data/lib/twitter/rest/api/tweets.rb +7 -9
- data/lib/twitter/rest/api/users.rb +6 -6
- data/lib/twitter/rest/api/utils.rb +44 -17
- data/lib/twitter/rest/client.rb +25 -43
- data/lib/twitter/rest/response/parse_error_json.rb +15 -0
- data/lib/twitter/rest/response/parse_json.rb +5 -1
- data/lib/twitter/search_results.rb +12 -8
- data/lib/twitter/size.rb +2 -15
- data/lib/twitter/streaming/client.rb +23 -11
- data/lib/twitter/streaming/event.rb +35 -0
- data/lib/twitter/streaming/friend_list.rb +13 -0
- data/lib/twitter/streaming/message_parser.rb +18 -0
- data/lib/twitter/streaming/response.rb +4 -0
- data/lib/twitter/suggestion.rb +5 -10
- data/lib/twitter/token.rb +3 -1
- data/lib/twitter/trend.rb +2 -7
- data/lib/twitter/trend_results.rb +20 -14
- data/lib/twitter/tweet.rb +18 -23
- data/lib/twitter/user.rb +34 -19
- data/lib/twitter/version.rb +1 -1
- data/spec/fixtures/request_token.txt +6 -0
- data/spec/fixtures/track_streaming_user.json +5 -0
- data/spec/twitter/base_spec.rb +0 -16
- data/spec/twitter/basic_user_spec.rb +3 -3
- data/spec/twitter/cursor_spec.rb +4 -4
- data/spec/twitter/direct_message_spec.rb +9 -9
- data/spec/twitter/entity/uri_spec.rb +12 -11
- data/spec/twitter/geo/point_spec.rb +5 -5
- data/spec/twitter/geo/polygon_spec.rb +5 -5
- data/spec/twitter/geo_factory_spec.rb +2 -2
- data/spec/twitter/geo_spec.rb +6 -6
- data/spec/twitter/identifiable_spec.rb +5 -5
- data/spec/twitter/list_spec.rb +7 -7
- data/spec/twitter/media/photo_spec.rb +19 -18
- data/spec/twitter/media_factory_spec.rb +2 -2
- data/spec/twitter/null_object_spec.rb +7 -6
- data/spec/twitter/oembed_spec.rb +6 -6
- data/spec/twitter/place_spec.rb +37 -37
- data/spec/twitter/rate_limit_spec.rb +0 -17
- data/spec/twitter/relationship_spec.rb +4 -12
- data/spec/twitter/rest/api/direct_messages_spec.rb +8 -8
- data/spec/twitter/rest/api/friends_and_followers_spec.rb +50 -120
- data/spec/twitter/rest/api/geo_spec.rb +0 -14
- data/spec/twitter/rest/api/lists_spec.rb +39 -39
- data/spec/twitter/rest/api/oauth_spec.rb +15 -4
- data/spec/twitter/rest/api/saved_searches_spec.rb +6 -6
- data/spec/twitter/rest/api/tweets_spec.rb +6 -6
- data/spec/twitter/rest/api/users_spec.rb +4 -4
- data/spec/twitter/rest/client_spec.rb +9 -9
- data/spec/twitter/saved_search_spec.rb +5 -5
- data/spec/twitter/search_results_spec.rb +3 -3
- data/spec/twitter/settings_spec.rb +2 -2
- data/spec/twitter/size_spec.rb +5 -15
- data/spec/twitter/source_user_spec.rb +3 -3
- data/spec/twitter/streaming/client_spec.rb +33 -16
- data/spec/twitter/streaming/event_spec.rb +45 -0
- data/spec/twitter/suggestion_spec.rb +5 -15
- data/spec/twitter/target_user_spec.rb +3 -3
- data/spec/twitter/token_spec.rb +2 -2
- data/spec/twitter/trend_results_spec.rb +6 -6
- data/spec/twitter/trend_spec.rb +7 -17
- data/spec/twitter/tweet_spec.rb +31 -25
- data/spec/twitter/user_spec.rb +16 -16
- data/twitter.gemspec +5 -2
- metadata +67 -15
- metadata.gz.sig +0 -0
data/lib/twitter/media/photo.rb
CHANGED
@@ -4,17 +4,19 @@ module Twitter
|
|
4
4
|
module Media
|
5
5
|
class Photo < Twitter::Identity
|
6
6
|
attr_reader :indices
|
7
|
-
|
7
|
+
display_uri_attr_reader
|
8
|
+
uri_attr_reader :expanded_uri, :media_uri, :media_uri_https, :uri
|
8
9
|
|
9
10
|
# Returns an array of photo sizes
|
10
11
|
#
|
11
12
|
# @return [Array<Twitter::Size>]
|
12
13
|
def sizes
|
13
|
-
|
14
|
-
object[key] =
|
14
|
+
Array(@attrs[:sizes]).inject({}) do |object, (key, value)|
|
15
|
+
object[key] = Size.new(value)
|
15
16
|
object
|
16
17
|
end
|
17
18
|
end
|
19
|
+
memoize :sizes
|
18
20
|
|
19
21
|
end
|
20
22
|
end
|
@@ -4,13 +4,17 @@ require 'twitter/media/photo'
|
|
4
4
|
module Twitter
|
5
5
|
class MediaFactory < Twitter::Factory
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# Construct a new media object
|
10
|
+
#
|
11
|
+
# @param attrs [Hash]
|
12
|
+
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
|
13
|
+
# @return [Twitter::Media]
|
14
|
+
def new(attrs={})
|
15
|
+
super(:type, Media, attrs)
|
16
|
+
end
|
17
|
+
|
14
18
|
end
|
15
19
|
|
16
20
|
end
|
data/lib/twitter/null_object.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
require 'singleton'
|
2
|
-
|
3
1
|
module Twitter
|
4
2
|
class NullObject
|
5
|
-
include Singleton
|
6
3
|
|
4
|
+
# @return [TrueClass] This method always returns true.
|
7
5
|
def nil?
|
8
6
|
true
|
9
7
|
end
|
10
8
|
|
9
|
+
# @return [Twitter::NullObject] This method always returns self.
|
11
10
|
def method_missing(*args, &block)
|
12
11
|
self
|
13
12
|
end
|
14
13
|
|
14
|
+
# @return [TrueClass] This method always returns true.
|
15
15
|
def respond_to?(method_name, include_private=false)
|
16
16
|
true
|
17
17
|
end if RUBY_VERSION < "1.9"
|
18
18
|
|
19
|
+
# @return [TrueClass] This method always returns true.
|
19
20
|
def respond_to_missing?(method_name, include_private=false)
|
20
21
|
true
|
21
22
|
end if RUBY_VERSION >= "1.9"
|
data/lib/twitter/place.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'equalizer'
|
2
|
+
require 'twitter/base'
|
2
3
|
|
3
4
|
module Twitter
|
4
|
-
class Place < Twitter::
|
5
|
+
class Place < Twitter::Base
|
6
|
+
include Equalizer.new(:woeid)
|
5
7
|
attr_reader :attributes, :country, :full_name, :name, :woeid
|
6
8
|
alias woe_id woeid
|
7
9
|
object_attr_reader :GeoFactory, :bounding_box
|
@@ -11,29 +13,21 @@ module Twitter
|
|
11
13
|
|
12
14
|
# @return [String]
|
13
15
|
def country_code
|
14
|
-
|
15
|
-
@attrs[:country_code] || @attrs[:countryCode]
|
16
|
-
end
|
16
|
+
@attrs[:country_code] || @attrs[:countryCode]
|
17
17
|
end
|
18
|
+
memoize :country_code
|
18
19
|
|
19
20
|
# @return [Integer]
|
20
21
|
def parent_id
|
21
|
-
|
22
|
-
@attrs[:parentid]
|
23
|
-
end
|
22
|
+
@attrs[:parentid]
|
24
23
|
end
|
24
|
+
memoize :parent_id
|
25
25
|
|
26
26
|
# @return [String]
|
27
27
|
def place_type
|
28
|
-
|
29
|
-
@attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# return [Integer]
|
34
|
-
def id
|
35
|
-
@attrs[:id] || @attrs[:woeid]
|
28
|
+
@attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name]
|
36
29
|
end
|
30
|
+
memoize :place_type
|
37
31
|
|
38
32
|
end
|
39
33
|
end
|
@@ -7,13 +7,12 @@ module Twitter
|
|
7
7
|
#
|
8
8
|
# @return [Array<Twitter::Size>]
|
9
9
|
def sizes
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
object
|
14
|
-
end
|
10
|
+
Array(@attrs[:sizes]).inject({}) do |object, (key, value)|
|
11
|
+
object[key] = Size.new(value)
|
12
|
+
object
|
15
13
|
end
|
16
14
|
end
|
15
|
+
memoize :sizes
|
17
16
|
|
18
17
|
end
|
19
18
|
end
|
data/lib/twitter/rate_limit.rb
CHANGED
@@ -6,18 +6,21 @@ module Twitter
|
|
6
6
|
limit = @attrs['x-rate-limit-limit']
|
7
7
|
limit.to_i if limit
|
8
8
|
end
|
9
|
+
memoize :limit
|
9
10
|
|
10
11
|
# @return [Integer]
|
11
12
|
def remaining
|
12
13
|
remaining = @attrs['x-rate-limit-remaining']
|
13
14
|
remaining.to_i if remaining
|
14
15
|
end
|
16
|
+
memoize :remaining
|
15
17
|
|
16
18
|
# @return [Time]
|
17
19
|
def reset_at
|
18
20
|
reset = @attrs['x-rate-limit-reset']
|
19
21
|
Time.at(reset.to_i) if reset
|
20
22
|
end
|
23
|
+
memoize :reset_at
|
21
24
|
|
22
25
|
# @return [Integer]
|
23
26
|
def reset_in
|
data/lib/twitter/relationship.rb
CHANGED
@@ -13,14 +13,5 @@ module Twitter
|
|
13
13
|
@attrs = attrs[:relationship]
|
14
14
|
end
|
15
15
|
|
16
|
-
# Update the attributes of a Relationship
|
17
|
-
#
|
18
|
-
# @param attrs [Hash]
|
19
|
-
# @return [Twitter::Relationship]
|
20
|
-
def update(attrs)
|
21
|
-
@attrs.update(attrs[:relationship]) unless attrs[:relationship].nil?
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
16
|
end
|
26
17
|
end
|
@@ -102,14 +102,15 @@ module Twitter
|
|
102
102
|
# @authentication Requires user context
|
103
103
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
104
104
|
# @return [Array<Twitter::DirectMessage>] Deleted direct message.
|
105
|
-
# @overload
|
105
|
+
# @overload destroy_direct_message(*ids)
|
106
106
|
# @param ids [Enumerable<Integer>] A collection of direct message IDs.
|
107
|
-
# @overload
|
107
|
+
# @overload destroy_direct_message(*ids, options)
|
108
108
|
# @param ids [Enumerable<Integer>] A collection of direct message IDs.
|
109
109
|
# @param options [Hash] A customizable set of options.
|
110
|
-
def
|
110
|
+
def destroy_direct_message(*args)
|
111
111
|
threaded_objects_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/destroy.json", args)
|
112
112
|
end
|
113
|
+
deprecate_alias :direct_message_destroy, :destroy_direct_message
|
113
114
|
|
114
115
|
# Sends a new direct message to the specified user from the authenticating user
|
115
116
|
#
|
@@ -121,13 +122,15 @@ module Twitter
|
|
121
122
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
122
123
|
# @param text [String] The text of your direct message, up to 140 characters.
|
123
124
|
# @param options [Hash] A customizable set of options.
|
124
|
-
def
|
125
|
+
def create_direct_message(user, text, options={})
|
125
126
|
merge_user!(options, user)
|
126
127
|
options[:text] = text
|
127
128
|
object_from_response(Twitter::DirectMessage, :post, "/1.1/direct_messages/new.json", options)
|
128
129
|
end
|
129
|
-
alias d
|
130
|
-
alias m
|
130
|
+
alias d create_direct_message
|
131
|
+
alias m create_direct_message
|
132
|
+
alias dm create_direct_message
|
133
|
+
deprecate_alias :direct_message_create, :create_direct_message
|
131
134
|
|
132
135
|
end
|
133
136
|
end
|
@@ -31,12 +31,9 @@ module Twitter
|
|
31
31
|
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
|
32
32
|
def favorites(*args)
|
33
33
|
arguments = Twitter::Arguments.new(args)
|
34
|
-
|
35
|
-
merge_user!(arguments.options, user)
|
36
|
-
end
|
34
|
+
merge_user!(arguments.options, arguments.pop) if arguments.last
|
37
35
|
objects_from_response(Twitter::Tweet, :get, "/1.1/favorites/list.json", arguments.options)
|
38
36
|
end
|
39
|
-
alias favourites favorites
|
40
37
|
|
41
38
|
# Un-favorites the specified Tweets as the authenticating user
|
42
39
|
#
|
@@ -53,9 +50,8 @@ module Twitter
|
|
53
50
|
def unfavorite(*args)
|
54
51
|
threaded_objects_from_response(Twitter::Tweet, :post, "/1.1/favorites/destroy.json", args)
|
55
52
|
end
|
56
|
-
alias
|
57
|
-
|
58
|
-
alias unfavourite unfavorite
|
53
|
+
alias destroy_favorite unfavorite
|
54
|
+
deprecate_alias :favorite_destroy, :unfavorite
|
59
55
|
|
60
56
|
# Favorites the specified Tweets as the authenticating user
|
61
57
|
#
|
@@ -82,8 +78,7 @@ module Twitter
|
|
82
78
|
end
|
83
79
|
alias fav favorite
|
84
80
|
alias fave favorite
|
85
|
-
|
86
|
-
alias favourite_create favorite
|
81
|
+
deprecate_alias :favorite_create, :favorite
|
87
82
|
|
88
83
|
# Favorites the specified Tweets as the authenticating user and raises an error if one has already been favorited
|
89
84
|
#
|
@@ -109,10 +104,10 @@ module Twitter
|
|
109
104
|
end
|
110
105
|
end
|
111
106
|
end
|
107
|
+
alias create_favorite! favorite!
|
112
108
|
alias fav! favorite!
|
113
109
|
alias fave! favorite!
|
114
|
-
|
115
|
-
alias favourite_create! favorite!
|
110
|
+
deprecate_alias :favorite_create!, :favorite!
|
116
111
|
|
117
112
|
end
|
118
113
|
end
|
@@ -110,9 +110,6 @@ module Twitter
|
|
110
110
|
# @option options [Boolean] :follow (false) Enable notifications for the target user.
|
111
111
|
def follow(*args)
|
112
112
|
arguments = Twitter::Arguments.new(args)
|
113
|
-
# Twitter always turns on notifications if the "follow" option is present, even if it's set to false
|
114
|
-
# so only send follow if it's true
|
115
|
-
arguments.options[:follow] = true if !!arguments.options.delete(:follow)
|
116
113
|
existing_friends = Thread.new do
|
117
114
|
friend_ids.to_a
|
118
115
|
end
|
@@ -121,7 +118,8 @@ module Twitter
|
|
121
118
|
end
|
122
119
|
follow!(new_friends.value - existing_friends.value, arguments.options)
|
123
120
|
end
|
124
|
-
alias
|
121
|
+
alias create_friendship follow
|
122
|
+
deprecate_alias :friendship_create, :follow
|
125
123
|
|
126
124
|
# Allows the authenticating user to follow the specified users
|
127
125
|
#
|
@@ -138,9 +136,6 @@ module Twitter
|
|
138
136
|
# @option options [Boolean] :follow (false) Enable notifications for the target user.
|
139
137
|
def follow!(*args)
|
140
138
|
arguments = Twitter::Arguments.new(args)
|
141
|
-
# Twitter always turns on notifications if the "follow" option is present, even if it's set to false
|
142
|
-
# so only send follow if it's true
|
143
|
-
arguments.options[:follow] = true if !!arguments.options.delete(:follow)
|
144
139
|
arguments.flatten.threaded_map do |user|
|
145
140
|
begin
|
146
141
|
object_from_response(Twitter::User, :post, "/1.1/friendships/create.json", merge_user(arguments.options, user))
|
@@ -150,7 +145,8 @@ module Twitter
|
|
150
145
|
end
|
151
146
|
end.compact
|
152
147
|
end
|
153
|
-
alias
|
148
|
+
alias create_friendship! follow!
|
149
|
+
deprecate_alias :friendship_create!, :follow!
|
154
150
|
|
155
151
|
# Allows the authenticating user to unfollow the specified users
|
156
152
|
#
|
@@ -167,7 +163,8 @@ module Twitter
|
|
167
163
|
def unfollow(*args)
|
168
164
|
threaded_user_objects_from_response(:post, "/1.1/friendships/destroy.json", args)
|
169
165
|
end
|
170
|
-
alias
|
166
|
+
alias destroy_friendship unfollow
|
167
|
+
deprecate_alias :friendship_destroy, :unfollow
|
171
168
|
|
172
169
|
# Allows one to enable or disable retweets and device notifications from the specified user.
|
173
170
|
#
|
@@ -69,18 +69,19 @@ 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
|
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
|
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
|
-
def
|
81
|
+
def remove_list_member(*args)
|
82
82
|
list_from_response_with_user(:post, "/1.1/lists/members/destroy.json", args)
|
83
83
|
end
|
84
|
+
deprecate_alias :list_remove_member, :remove_list_member
|
84
85
|
|
85
86
|
# List the lists the specified user has been added to
|
86
87
|
#
|
@@ -187,18 +188,19 @@ module Twitter
|
|
187
188
|
# @authentication Requires user context
|
188
189
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
189
190
|
# @return [Twitter::List] The list.
|
190
|
-
# @overload
|
191
|
+
# @overload add_list_members(list, users, options={})
|
191
192
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
192
193
|
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
|
193
194
|
# @param options [Hash] A customizable set of options.
|
194
|
-
# @overload
|
195
|
+
# @overload add_list_members(user, list, users, options={})
|
195
196
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
196
197
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
197
198
|
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
|
198
199
|
# @param options [Hash] A customizable set of options.
|
199
|
-
def
|
200
|
+
def add_list_members(*args)
|
200
201
|
list_from_response_with_users(:post, "/1.1/lists/members/create_all.json", args)
|
201
202
|
end
|
203
|
+
deprecate_alias :list_add_members, :add_list_members
|
202
204
|
|
203
205
|
# Check if a user is a member of the specified list
|
204
206
|
#
|
@@ -248,18 +250,19 @@ module Twitter
|
|
248
250
|
# @authentication Requires user context
|
249
251
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
250
252
|
# @return [Twitter::List] The list.
|
251
|
-
# @overload
|
253
|
+
# @overload add_list_member(list, user_to_add, options={})
|
252
254
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
253
255
|
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
|
254
256
|
# @param options [Hash] A customizable set of options.
|
255
|
-
# @overload
|
257
|
+
# @overload add_list_member(user, list, user_to_add, options={})
|
256
258
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
257
259
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
258
260
|
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
|
259
261
|
# @param options [Hash] A customizable set of options.
|
260
|
-
def
|
262
|
+
def add_list_member(*args)
|
261
263
|
list_from_response_with_user(:post, "/1.1/lists/members/create.json", args)
|
262
264
|
end
|
265
|
+
deprecate_alias :list_add_member, :add_list_member
|
263
266
|
|
264
267
|
# Deletes the specified list
|
265
268
|
#
|
@@ -269,16 +272,17 @@ module Twitter
|
|
269
272
|
# @authentication Requires user context
|
270
273
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
271
274
|
# @return [Twitter::List] The deleted list.
|
272
|
-
# @overload
|
275
|
+
# @overload destroy_list(list, options={})
|
273
276
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
274
277
|
# @param options [Hash] A customizable set of options.
|
275
|
-
# @overload
|
278
|
+
# @overload destroy_list(user, list, options={})
|
276
279
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
277
280
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
278
281
|
# @param options [Hash] A customizable set of options.
|
279
|
-
def
|
282
|
+
def destroy_list(*args)
|
280
283
|
list_from_response(:post, "/1.1/lists/destroy.json", args)
|
281
284
|
end
|
285
|
+
deprecate_alias :list_destroy, :destroy_list
|
282
286
|
|
283
287
|
# Updates the specified list
|
284
288
|
#
|
@@ -314,9 +318,10 @@ module Twitter
|
|
314
318
|
# @param options [Hash] A customizable set of options.
|
315
319
|
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
|
316
320
|
# @option options [String] :description The description to give the list.
|
317
|
-
def
|
321
|
+
def create_list(name, options={})
|
318
322
|
object_from_response(Twitter::List, :post, "/1.1/lists/create.json", options.merge(:name => name))
|
319
323
|
end
|
324
|
+
deprecate_alias :list_create, :create_list
|
320
325
|
|
321
326
|
# Show the specified list
|
322
327
|
#
|
@@ -362,18 +367,19 @@ module Twitter
|
|
362
367
|
# @authentication Requires user context
|
363
368
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
364
369
|
# @return [Twitter::List] The list.
|
365
|
-
# @overload
|
370
|
+
# @overload remove_list_members(list, users, options={})
|
366
371
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
367
372
|
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
|
368
373
|
# @param options [Hash] A customizable set of options.
|
369
|
-
# @overload
|
374
|
+
# @overload remove_list_members(user, list, users, options={})
|
370
375
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
371
376
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
372
377
|
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
|
373
378
|
# @param options [Hash] A customizable set of options.
|
374
|
-
def
|
379
|
+
def remove_list_members(*args)
|
375
380
|
list_from_response_with_users(:post, "/1.1/lists/members/destroy_all.json", args)
|
376
381
|
end
|
382
|
+
deprecate_alias :list_remove_members, :remove_list_members
|
377
383
|
|
378
384
|
# Returns the lists owned by the specified Twitter user
|
379
385
|
#
|
@@ -382,17 +388,18 @@ module Twitter
|
|
382
388
|
# @authentication Requires user context
|
383
389
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
384
390
|
# @return [Array<Twitter::List>]
|
385
|
-
# @overload
|
391
|
+
# @overload owned_lists(options={})
|
386
392
|
# @param options [Hash] A customizable set of options.
|
387
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.
|
388
|
-
# @overload
|
394
|
+
# @overload owned_lists(user, options={})
|
389
395
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
390
396
|
# @param options [Hash] A customizable set of options.
|
391
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.
|
392
|
-
def
|
398
|
+
def owned_lists(*args)
|
393
399
|
cursor_from_response_with_user(:lists, Twitter::List, :get, "/1.1/lists/ownerships.json", args)
|
394
400
|
end
|
395
|
-
|
401
|
+
deprecate_alias :lists_ownerships, :owned_lists
|
402
|
+
deprecate_alias :lists_owned, :owned_lists
|
396
403
|
|
397
404
|
private
|
398
405
|
|