twitter 5.12.0 → 5.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/twitter/base.rb +6 -2
- data/lib/twitter/client.rb +4 -11
- data/lib/twitter/cursor.rb +5 -5
- data/lib/twitter/headers.rb +62 -0
- data/lib/twitter/null_object.rb +5 -0
- data/lib/twitter/rest/api.rb +2 -0
- data/lib/twitter/rest/client.rb +14 -69
- data/lib/twitter/rest/direct_messages.rb +4 -5
- data/lib/twitter/rest/favorites.rb +3 -4
- data/lib/twitter/rest/friends_and_followers.rb +12 -12
- data/lib/twitter/rest/help.rb +5 -5
- data/lib/twitter/rest/lists.rb +21 -21
- data/lib/twitter/rest/media.rb +4 -3
- data/lib/twitter/rest/oauth.rb +4 -4
- data/lib/twitter/rest/places_and_geo.rb +4 -5
- data/lib/twitter/rest/request.rb +44 -0
- data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
- data/lib/twitter/rest/saved_searches.rb +4 -5
- data/lib/twitter/rest/search.rb +3 -4
- data/lib/twitter/rest/spam_reporting.rb +0 -1
- data/lib/twitter/rest/suggested_users.rb +3 -4
- data/lib/twitter/rest/timelines.rb +3 -4
- data/lib/twitter/rest/trends.rb +4 -4
- data/lib/twitter/rest/tweets.rb +10 -12
- data/lib/twitter/rest/undocumented.rb +2 -2
- data/lib/twitter/rest/users.rb +19 -21
- data/lib/twitter/rest/utils.rb +66 -17
- data/lib/twitter/search_results.rb +5 -5
- data/lib/twitter/streaming/client.rb +4 -2
- data/lib/twitter/user.rb +0 -1
- data/lib/twitter/version.rb +1 -1
- metadata +4 -3
- data/lib/twitter/request.rb +0 -47
data/lib/twitter/rest/help.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'twitter/configuration'
|
2
2
|
require 'twitter/language'
|
3
|
-
require 'twitter/request'
|
3
|
+
require 'twitter/rest/request'
|
4
4
|
require 'twitter/rest/utils'
|
5
5
|
|
6
6
|
module Twitter
|
@@ -16,7 +16,7 @@ module Twitter
|
|
16
16
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
17
17
|
# @return [Twitter::Configuration] Twitter's configuration.
|
18
18
|
def configuration(options = {})
|
19
|
-
|
19
|
+
perform_get_with_object('/1.1/help/configuration.json', options, Twitter::Configuration)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Returns the list of languages supported by Twitter
|
@@ -27,7 +27,7 @@ module Twitter
|
|
27
27
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
28
28
|
# @return [Array<Twitter::Language>]
|
29
29
|
def languages(options = {})
|
30
|
-
|
30
|
+
perform_get_with_objects('/1.1/help/languages.json', options, Twitter::Language)
|
31
31
|
end
|
32
32
|
|
33
33
|
# Returns {https://twitter.com/privacy Twitter's Privacy Policy}
|
@@ -38,7 +38,7 @@ module Twitter
|
|
38
38
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
39
39
|
# @return [String]
|
40
40
|
def privacy(options = {})
|
41
|
-
|
41
|
+
perform_get('/1.1/help/privacy.json', options)[:privacy]
|
42
42
|
end
|
43
43
|
|
44
44
|
# Returns {https://twitter.com/tos Twitter's Terms of Service}
|
@@ -49,7 +49,7 @@ module Twitter
|
|
49
49
|
# @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
50
50
|
# @return [String]
|
51
51
|
def tos(options = {})
|
52
|
-
|
52
|
+
perform_get('/1.1/help/tos.json', options)[:tos]
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/twitter/rest/lists.rb
CHANGED
@@ -2,7 +2,7 @@ require 'twitter/arguments'
|
|
2
2
|
require 'twitter/cursor'
|
3
3
|
require 'twitter/error'
|
4
4
|
require 'twitter/list'
|
5
|
-
require 'twitter/request'
|
5
|
+
require 'twitter/rest/request'
|
6
6
|
require 'twitter/rest/utils'
|
7
7
|
require 'twitter/tweet'
|
8
8
|
require 'twitter/user'
|
@@ -60,7 +60,7 @@ module Twitter
|
|
60
60
|
arguments = Twitter::Arguments.new(args)
|
61
61
|
merge_list!(arguments.options, arguments.pop)
|
62
62
|
merge_owner!(arguments.options, arguments.pop)
|
63
|
-
|
63
|
+
perform_get_with_objects('/1.1/lists/statuses.json', arguments.options, Twitter::Tweet)
|
64
64
|
end
|
65
65
|
|
66
66
|
# Removes the specified member from the list
|
@@ -81,7 +81,7 @@ module Twitter
|
|
81
81
|
# @param user_to_remove [Integer, String] The user id or screen name of the list member to remove.
|
82
82
|
# @param options [Hash] A customizable set of options.
|
83
83
|
def remove_list_member(*args)
|
84
|
-
list_from_response_with_user(
|
84
|
+
list_from_response_with_user('/1.1/lists/members/destroy.json', args)
|
85
85
|
end
|
86
86
|
deprecate_alias :list_remove_member, :remove_list_member
|
87
87
|
|
@@ -102,7 +102,7 @@ module Twitter
|
|
102
102
|
# @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.
|
103
103
|
# @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.
|
104
104
|
def memberships(*args)
|
105
|
-
cursor_from_response_with_user(:lists, Twitter::List,
|
105
|
+
cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/memberships.json', args)
|
106
106
|
end
|
107
107
|
|
108
108
|
# Returns the subscribers of the specified list
|
@@ -121,7 +121,7 @@ module Twitter
|
|
121
121
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
122
122
|
# @param options [Hash] A customizable set of options.
|
123
123
|
def list_subscribers(*args)
|
124
|
-
cursor_from_response_with_list(
|
124
|
+
cursor_from_response_with_list('/1.1/lists/subscribers.json', args)
|
125
125
|
end
|
126
126
|
|
127
127
|
# Make the authenticated user follow the specified list
|
@@ -204,7 +204,7 @@ module Twitter
|
|
204
204
|
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
|
205
205
|
# @param options [Hash] A customizable set of options.
|
206
206
|
def add_list_members(*args)
|
207
|
-
list_from_response_with_users(
|
207
|
+
list_from_response_with_users('/1.1/lists/members/create_all.json', args)
|
208
208
|
end
|
209
209
|
deprecate_alias :list_add_members, :add_list_members
|
210
210
|
|
@@ -245,7 +245,7 @@ module Twitter
|
|
245
245
|
# @param list [Integer, String, Twitter::List] A Twitter list ID, slug, URI, or object.
|
246
246
|
# @param options [Hash] A customizable set of options.
|
247
247
|
def list_members(*args)
|
248
|
-
cursor_from_response_with_list(
|
248
|
+
cursor_from_response_with_list('/1.1/lists/members.json', args)
|
249
249
|
end
|
250
250
|
|
251
251
|
# Add a member to a list
|
@@ -267,7 +267,7 @@ module Twitter
|
|
267
267
|
# @param user_to_add [Integer, String] The user id or screen name to add to the list.
|
268
268
|
# @param options [Hash] A customizable set of options.
|
269
269
|
def add_list_member(*args)
|
270
|
-
list_from_response_with_user(
|
270
|
+
list_from_response_with_user('/1.1/lists/members/create.json', args)
|
271
271
|
end
|
272
272
|
deprecate_alias :list_add_member, :add_list_member
|
273
273
|
|
@@ -328,7 +328,7 @@ module Twitter
|
|
328
328
|
# @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
|
329
329
|
# @option options [String] :description The description to give the list.
|
330
330
|
def create_list(name, options = {})
|
331
|
-
|
331
|
+
perform_post_with_object('/1.1/lists/create.json', options.merge(:name => name), Twitter::List)
|
332
332
|
end
|
333
333
|
deprecate_alias :list_create, :create_list
|
334
334
|
|
@@ -365,7 +365,7 @@ module Twitter
|
|
365
365
|
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
366
366
|
# @param options [Hash] A customizable set of options.
|
367
367
|
def subscriptions(*args)
|
368
|
-
cursor_from_response_with_user(:lists, Twitter::List,
|
368
|
+
cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/subscriptions.json', args)
|
369
369
|
end
|
370
370
|
|
371
371
|
# Removes specified members from the list
|
@@ -386,7 +386,7 @@ module Twitter
|
|
386
386
|
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
|
387
387
|
# @param options [Hash] A customizable set of options.
|
388
388
|
def remove_list_members(*args)
|
389
|
-
list_from_response_with_users(
|
389
|
+
list_from_response_with_users('/1.1/lists/members/destroy_all.json', args)
|
390
390
|
end
|
391
391
|
deprecate_alias :list_remove_members, :remove_list_members
|
392
392
|
|
@@ -405,7 +405,7 @@ module Twitter
|
|
405
405
|
# @param options [Hash] A customizable set of options.
|
406
406
|
# @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.
|
407
407
|
def owned_lists(*args)
|
408
|
-
cursor_from_response_with_user(:lists, Twitter::List,
|
408
|
+
cursor_from_response_with_user(:lists, Twitter::List, '/1.1/lists/ownerships.json', args)
|
409
409
|
end
|
410
410
|
deprecate_alias :lists_ownerships, :owned_lists
|
411
411
|
deprecate_alias :lists_owned, :owned_lists
|
@@ -420,14 +420,14 @@ module Twitter
|
|
420
420
|
arguments = Twitter::Arguments.new(args)
|
421
421
|
merge_list!(arguments.options, arguments.pop)
|
422
422
|
merge_owner!(arguments.options, arguments.pop)
|
423
|
-
|
423
|
+
perform_request_with_object(request_method, path, arguments.options, Twitter::List)
|
424
424
|
end
|
425
425
|
|
426
|
-
def cursor_from_response_with_list(
|
426
|
+
def cursor_from_response_with_list(path, args)
|
427
427
|
arguments = Twitter::Arguments.new(args)
|
428
428
|
merge_list!(arguments.options, arguments.pop)
|
429
429
|
merge_owner!(arguments.options, arguments.pop)
|
430
|
-
|
430
|
+
perform_get_with_cursor(path, arguments.options, :users, Twitter::User)
|
431
431
|
end
|
432
432
|
|
433
433
|
def list_user?(request_method, path, args)
|
@@ -435,28 +435,28 @@ module Twitter
|
|
435
435
|
merge_user!(arguments.options, arguments.pop)
|
436
436
|
merge_list!(arguments.options, arguments.pop)
|
437
437
|
merge_owner!(arguments.options, arguments.pop)
|
438
|
-
|
438
|
+
perform_request(request_method.to_sym, path, arguments.options)
|
439
439
|
true
|
440
440
|
rescue Twitter::Error::Forbidden, Twitter::Error::NotFound
|
441
441
|
false
|
442
442
|
end
|
443
443
|
|
444
|
-
def list_from_response_with_user(
|
444
|
+
def list_from_response_with_user(path, args)
|
445
445
|
arguments = Twitter::Arguments.new(args)
|
446
446
|
merge_user!(arguments.options, arguments.pop)
|
447
447
|
merge_list!(arguments.options, arguments.pop)
|
448
448
|
merge_owner!(arguments.options, arguments.pop)
|
449
|
-
|
449
|
+
perform_post_with_object(path, arguments.options, Twitter::List)
|
450
450
|
end
|
451
451
|
|
452
|
-
def list_from_response_with_users(
|
452
|
+
def list_from_response_with_users(path, args)
|
453
453
|
arguments = args.dup
|
454
454
|
options = arguments.last.is_a?(::Hash) ? arguments.pop : {}
|
455
455
|
members = arguments.pop
|
456
456
|
merge_list!(options, arguments.pop)
|
457
457
|
merge_owner!(options, arguments.pop)
|
458
|
-
pmap(members.
|
459
|
-
|
458
|
+
pmap(members.each_slice(MAX_USERS_PER_REQUEST)) do |users|
|
459
|
+
perform_post_with_object(path, merge_users(options, users), Twitter::List)
|
460
460
|
end.last
|
461
461
|
end
|
462
462
|
|
data/lib/twitter/rest/media.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'twitter/error'
|
2
|
+
require 'twitter/headers'
|
2
3
|
require 'twitter/rest/utils'
|
3
4
|
|
4
5
|
module Twitter
|
@@ -16,11 +17,11 @@ module Twitter
|
|
16
17
|
# @param options [Hash] A customizable set of options.
|
17
18
|
def upload(media, options = {})
|
18
19
|
fail(Twitter::Error::UnacceptableIO.new) unless media.respond_to?(:to_io)
|
19
|
-
|
20
|
+
base_url = 'https://upload.twitter.com'
|
20
21
|
path = '/1.1/media/upload.json'
|
21
22
|
conn = connection.dup
|
22
|
-
conn.url_prefix =
|
23
|
-
headers =
|
23
|
+
conn.url_prefix = base_url
|
24
|
+
headers = Twitter::Headers.new(self, :post, base_url + path, options).request_headers
|
24
25
|
options.merge!(:media => media)
|
25
26
|
conn.post(path, options) { |request| request.headers.update(headers) }.env.body[:media_id]
|
26
27
|
end
|
data/lib/twitter/rest/oauth.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'twitter/
|
1
|
+
require 'twitter/headers'
|
2
2
|
require 'twitter/rest/utils'
|
3
3
|
require 'twitter/rest/response/parse_error_json'
|
4
4
|
require 'twitter/token'
|
@@ -26,7 +26,7 @@ module Twitter
|
|
26
26
|
def token(options = {})
|
27
27
|
options[:bearer_token_request] = true
|
28
28
|
options[:grant_type] ||= 'client_credentials'
|
29
|
-
|
29
|
+
perform_post_with_object('/oauth2/token', options, Twitter::Token)
|
30
30
|
end
|
31
31
|
alias_method :bearer_token, :token
|
32
32
|
|
@@ -42,7 +42,7 @@ module Twitter
|
|
42
42
|
def invalidate_token(access_token, options = {})
|
43
43
|
access_token = access_token.access_token if access_token.is_a?(Twitter::Token)
|
44
44
|
options[:access_token] = access_token
|
45
|
-
|
45
|
+
perform_post_with_object('/oauth2/invalidate_token', options, Twitter::Token)
|
46
46
|
end
|
47
47
|
|
48
48
|
# Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
|
@@ -56,7 +56,7 @@ module Twitter
|
|
56
56
|
conn = connection.dup
|
57
57
|
conn.builder.swap(4, Twitter::REST::Response::ParseErrorJson)
|
58
58
|
response = conn.post('/oauth/request_token?x_auth_mode=reverse_auth') do |request|
|
59
|
-
request.headers[:authorization] =
|
59
|
+
request.headers[:authorization] = Twitter::Headers.new(self, :post, 'https://api.twitter.com/oauth/request_token', :x_auth_mode => 'reverse_auth').oauth_auth_header.to_s
|
60
60
|
end
|
61
61
|
response.body
|
62
62
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'twitter/geo_results'
|
2
2
|
require 'twitter/place'
|
3
|
-
require 'twitter/request'
|
4
3
|
require 'twitter/rest/utils'
|
5
4
|
|
6
5
|
module Twitter
|
@@ -18,7 +17,7 @@ module Twitter
|
|
18
17
|
# @param options [Hash] A customizable set of options.
|
19
18
|
# @return [Twitter::Place] The requested place.
|
20
19
|
def place(place_id, options = {})
|
21
|
-
|
20
|
+
perform_get_with_object("/1.1/geo/id/#{place_id}.json", options, Twitter::Place)
|
22
21
|
end
|
23
22
|
|
24
23
|
# Searches for up to 20 places that can be used as a place_id
|
@@ -36,7 +35,7 @@ module Twitter
|
|
36
35
|
# @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
36
|
# @return [Array<Twitter::Place>]
|
38
37
|
def reverse_geocode(options = {})
|
39
|
-
|
38
|
+
perform_get_with_object('/1.1/geo/reverse_geocode.json', options, Twitter::GeoResults)
|
40
39
|
end
|
41
40
|
|
42
41
|
# Search for places that can be attached to a {Twitter::REST::Tweets#update}
|
@@ -57,7 +56,7 @@ module Twitter
|
|
57
56
|
# @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
57
|
# @return [Array<Twitter::Place>]
|
59
58
|
def geo_search(options = {})
|
60
|
-
|
59
|
+
perform_get_with_object('/1.1/geo/search.json', options, Twitter::GeoResults)
|
61
60
|
end
|
62
61
|
alias_method :places_nearby, :geo_search
|
63
62
|
|
@@ -76,7 +75,7 @@ module Twitter
|
|
76
75
|
# @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
76
|
# @return [Array<Twitter::Place>]
|
78
77
|
def similar_places(options = {})
|
79
|
-
|
78
|
+
perform_get_with_object('/1.1/geo/similar_places.json', options, Twitter::GeoResults)
|
80
79
|
end
|
81
80
|
alias_method :places_similar, :similar_places
|
82
81
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
require 'faraday'
|
3
|
+
require 'json'
|
4
|
+
require 'timeout'
|
5
|
+
require 'twitter/error'
|
6
|
+
require 'twitter/headers'
|
7
|
+
require 'twitter/rate_limit'
|
8
|
+
|
9
|
+
module Twitter
|
10
|
+
module REST
|
11
|
+
class Request
|
12
|
+
attr_accessor :client, :headers, :options, :rate_limit, :request_method,
|
13
|
+
:path, :uri
|
14
|
+
alias_method :verb, :request_method
|
15
|
+
|
16
|
+
# @param client [Twitter::Client]
|
17
|
+
# @param request_method [String, Symbol]
|
18
|
+
# @param path [String]
|
19
|
+
# @param options [Hash]
|
20
|
+
# @return [Twitter::REST::Request]
|
21
|
+
def initialize(client, request_method, path, options = {})
|
22
|
+
@client = client
|
23
|
+
@request_method = request_method.to_sym
|
24
|
+
@path = path
|
25
|
+
@uri = Addressable::URI.parse(client.connection.url_prefix + path)
|
26
|
+
@options = options
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Array, Hash]
|
30
|
+
def perform
|
31
|
+
@headers = Twitter::Headers.new(@client, @request_method, @uri.to_s, @options).request_headers
|
32
|
+
begin
|
33
|
+
response = @client.connection.send(@request_method, @path, @options) { |request| request.headers.update(@headers) }.env
|
34
|
+
rescue Faraday::Error::TimeoutError, Timeout::Error => error
|
35
|
+
raise(Twitter::Error::RequestTimeout.new(error))
|
36
|
+
rescue Faraday::Error::ClientError, JSON::ParserError => error
|
37
|
+
raise(Twitter::Error.new(error))
|
38
|
+
end
|
39
|
+
@rate_limit = Twitter::RateLimit.new(response.response_headers)
|
40
|
+
response.body
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'twitter/arguments'
|
2
|
-
require 'twitter/request'
|
3
2
|
require 'twitter/rest/utils'
|
4
3
|
require 'twitter/saved_search'
|
5
4
|
require 'twitter/utils'
|
@@ -33,7 +32,7 @@ module Twitter
|
|
33
32
|
def saved_searches(*args)
|
34
33
|
arguments = Twitter::Arguments.new(args)
|
35
34
|
if arguments.empty?
|
36
|
-
|
35
|
+
perform_get_with_objects('/1.1/saved_searches/list.json', arguments.options, Twitter::SavedSearch)
|
37
36
|
else
|
38
37
|
pmap(arguments) do |id|
|
39
38
|
saved_search(id, arguments.options)
|
@@ -51,7 +50,7 @@ module Twitter
|
|
51
50
|
# @param id [Integer] The ID of the saved search.
|
52
51
|
# @param options [Hash] A customizable set of options.
|
53
52
|
def saved_search(id, options = {})
|
54
|
-
|
53
|
+
perform_get_with_object("/1.1/saved_searches/show/#{id}.json", options, Twitter::SavedSearch)
|
55
54
|
end
|
56
55
|
|
57
56
|
# Creates a saved search for the authenticated user
|
@@ -64,7 +63,7 @@ module Twitter
|
|
64
63
|
# @param query [String] The query of the search the user would like to save.
|
65
64
|
# @param options [Hash] A customizable set of options.
|
66
65
|
def create_saved_search(query, options = {})
|
67
|
-
|
66
|
+
perform_post_with_object('/1.1/saved_searches/create.json', options.merge(:query => query), Twitter::SavedSearch)
|
68
67
|
end
|
69
68
|
deprecate_alias :saved_search_create, :create_saved_search
|
70
69
|
|
@@ -84,7 +83,7 @@ module Twitter
|
|
84
83
|
def destroy_saved_search(*args)
|
85
84
|
arguments = Twitter::Arguments.new(args)
|
86
85
|
pmap(arguments) do |id|
|
87
|
-
|
86
|
+
perform_post_with_object("/1.1/saved_searches/destroy/#{id}.json", arguments.options, Twitter::SavedSearch)
|
88
87
|
end
|
89
88
|
end
|
90
89
|
deprecate_alias :saved_search_destroy, :destroy_saved_search
|
data/lib/twitter/rest/search.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'twitter/request'
|
1
|
+
require 'twitter/rest/request'
|
2
2
|
require 'twitter/search_results'
|
3
3
|
|
4
4
|
module Twitter
|
@@ -27,9 +27,8 @@ module Twitter
|
|
27
27
|
# @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
|
28
28
|
def search(q, options = {})
|
29
29
|
options[:count] ||= MAX_TWEETS_PER_REQUEST
|
30
|
-
request = Twitter::Request.new(self, :get, '/1.1/search/tweets.json', options.merge(:q => q))
|
31
|
-
|
32
|
-
Twitter::SearchResults.new(response, request)
|
30
|
+
request = Twitter::REST::Request.new(self, :get, '/1.1/search/tweets.json', options.merge(:q => q))
|
31
|
+
Twitter::SearchResults.new(request)
|
33
32
|
end
|
34
33
|
end
|
35
34
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'twitter/arguments'
|
2
|
-
require 'twitter/request'
|
3
2
|
require 'twitter/rest/utils'
|
4
3
|
require 'twitter/suggestion'
|
5
4
|
require 'twitter/user'
|
@@ -27,9 +26,9 @@ module Twitter
|
|
27
26
|
def suggestions(*args)
|
28
27
|
arguments = Twitter::Arguments.new(args)
|
29
28
|
if arguments.last
|
30
|
-
|
29
|
+
perform_get_with_object("/1.1/users/suggestions/#{arguments.pop}.json", arguments.options, Twitter::Suggestion)
|
31
30
|
else
|
32
|
-
|
31
|
+
perform_get_with_objects('/1.1/users/suggestions.json', arguments.options, Twitter::Suggestion)
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
@@ -42,7 +41,7 @@ module Twitter
|
|
42
41
|
# @param options [Hash] A customizable set of options.
|
43
42
|
# @return [Array<Twitter::User>]
|
44
43
|
def suggest_users(slug, options = {})
|
45
|
-
|
44
|
+
perform_get_with_objects("/1.1/users/suggestions/#{slug}/members.json", options, Twitter::User)
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'twitter/request'
|
2
1
|
require 'twitter/rest/utils'
|
3
2
|
require 'twitter/tweet'
|
4
3
|
require 'twitter/user'
|
@@ -24,7 +23,7 @@ module Twitter
|
|
24
23
|
# @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
|
25
24
|
# @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
25
|
def mentions_timeline(options = {})
|
27
|
-
|
26
|
+
perform_get_with_objects('/1.1/statuses/mentions_timeline.json', options, Twitter::Tweet)
|
28
27
|
end
|
29
28
|
alias_method :mentions, :mentions_timeline
|
30
29
|
|
@@ -111,7 +110,7 @@ module Twitter
|
|
111
110
|
# @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
111
|
# @option options [Boolean, String, Integer] :contributor_details Specifies that the contributors element should be enhanced to include the screen_name of the contributor.
|
113
112
|
def home_timeline(options = {})
|
114
|
-
|
113
|
+
perform_get_with_objects('/1.1/statuses/home_timeline.json', options, Twitter::Tweet)
|
115
114
|
end
|
116
115
|
|
117
116
|
# Returns the 20 most recent retweets posted by users the authenticating user follow.
|
@@ -149,7 +148,7 @@ module Twitter
|
|
149
148
|
# @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.
|
150
149
|
# @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false.
|
151
150
|
def retweets_of_me(options = {})
|
152
|
-
|
151
|
+
perform_get_with_objects('/1.1/statuses/retweets_of_me.json', options, Twitter::Tweet)
|
153
152
|
end
|
154
153
|
|
155
154
|
private
|