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
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'cgi'
|
2
2
|
require 'twitter/enumerable'
|
3
|
+
require 'twitter/rest/request'
|
3
4
|
require 'twitter/utils'
|
4
5
|
require 'uri'
|
5
6
|
|
@@ -15,16 +16,15 @@ module Twitter
|
|
15
16
|
|
16
17
|
# Initializes a new SearchResults object
|
17
18
|
#
|
18
|
-
# @param
|
19
|
-
# @param request [Twitter::Request]
|
19
|
+
# @param request [Twitter::REST::Request]
|
20
20
|
# @return [Twitter::SearchResults]
|
21
|
-
def initialize(
|
21
|
+
def initialize(request)
|
22
22
|
@client = request.client
|
23
23
|
@request_method = request.verb
|
24
24
|
@path = request.path
|
25
25
|
@options = request.options
|
26
26
|
@collection = []
|
27
|
-
self.attrs =
|
27
|
+
self.attrs = request.perform
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
@@ -49,7 +49,7 @@ module Twitter
|
|
49
49
|
|
50
50
|
# @return [Hash]
|
51
51
|
def fetch_next_page
|
52
|
-
response =
|
52
|
+
response = Twitter::REST::Request.new(@client, @request_method, @path, next_page).perform
|
53
53
|
self.attrs = response
|
54
54
|
end
|
55
55
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'http/request'
|
2
2
|
require 'twitter/arguments'
|
3
3
|
require 'twitter/client'
|
4
|
+
require 'twitter/headers'
|
4
5
|
require 'twitter/streaming/connection'
|
5
6
|
require 'twitter/streaming/response'
|
6
7
|
require 'twitter/streaming/message_parser'
|
@@ -106,8 +107,9 @@ module Twitter
|
|
106
107
|
|
107
108
|
def request(method, uri, params)
|
108
109
|
before_request.call
|
109
|
-
|
110
|
-
|
110
|
+
authorization = Twitter::Headers.new(self, method, uri, params).oauth_auth_header.to_s
|
111
|
+
headers = default_headers.merge(:authorization => authorization)
|
112
|
+
request = HTTP::Request.new(method, uri + '?' + to_url_params(params), headers)
|
111
113
|
response = Streaming::Response.new do |data|
|
112
114
|
if item = Streaming::MessageParser.parse(data) # rubocop:disable AssignmentInCondition, IfUnlessModifier
|
113
115
|
yield(item)
|
data/lib/twitter/user.rb
CHANGED
@@ -21,7 +21,6 @@ module Twitter
|
|
21
21
|
:profile_sidebar_border_color, :profile_sidebar_fill_color,
|
22
22
|
:profile_text_color, :time_zone
|
23
23
|
alias_method :favorites_count, :favourites_count
|
24
|
-
remove_method :favourites_count
|
25
24
|
alias_method :tweets_count, :statuses_count
|
26
25
|
object_attr_reader :Tweet, :status, :user
|
27
26
|
alias_method :tweet, :status
|
data/lib/twitter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-11-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: addressable
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- lib/twitter/geo/polygon.rb
|
204
204
|
- lib/twitter/geo_factory.rb
|
205
205
|
- lib/twitter/geo_results.rb
|
206
|
+
- lib/twitter/headers.rb
|
206
207
|
- lib/twitter/identity.rb
|
207
208
|
- lib/twitter/language.rb
|
208
209
|
- lib/twitter/list.rb
|
@@ -216,7 +217,6 @@ files:
|
|
216
217
|
- lib/twitter/profile_banner.rb
|
217
218
|
- lib/twitter/rate_limit.rb
|
218
219
|
- lib/twitter/relationship.rb
|
219
|
-
- lib/twitter/request.rb
|
220
220
|
- lib/twitter/rest/api.rb
|
221
221
|
- lib/twitter/rest/client.rb
|
222
222
|
- lib/twitter/rest/direct_messages.rb
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/twitter/rest/media.rb
|
228
228
|
- lib/twitter/rest/oauth.rb
|
229
229
|
- lib/twitter/rest/places_and_geo.rb
|
230
|
+
- lib/twitter/rest/request.rb
|
230
231
|
- lib/twitter/rest/request/multipart_with_file.rb
|
231
232
|
- lib/twitter/rest/response/parse_error_json.rb
|
232
233
|
- lib/twitter/rest/response/parse_json.rb
|
data/lib/twitter/request.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'twitter/cursor'
|
2
|
-
|
3
|
-
module Twitter
|
4
|
-
class Request
|
5
|
-
attr_accessor :client, :request_method, :path, :options
|
6
|
-
alias_method :verb, :request_method
|
7
|
-
|
8
|
-
# @param client [Twitter::Client]
|
9
|
-
# @param request_method [String, Symbol]
|
10
|
-
# @param path [String]
|
11
|
-
# @param options [Hash]
|
12
|
-
# @return [Twitter::Request]
|
13
|
-
def initialize(client, request_method, path, options = {})
|
14
|
-
@client = client
|
15
|
-
@request_method = request_method.to_sym
|
16
|
-
@path = path
|
17
|
-
@options = options
|
18
|
-
end
|
19
|
-
|
20
|
-
# @return [Hash]
|
21
|
-
def perform
|
22
|
-
@client.send(@request_method, @path, @options).body
|
23
|
-
end
|
24
|
-
|
25
|
-
# @param klass [Class]
|
26
|
-
# @param request [Twitter::Request]
|
27
|
-
# @return [Object]
|
28
|
-
def perform_with_object(klass)
|
29
|
-
klass.new(perform)
|
30
|
-
end
|
31
|
-
|
32
|
-
# @param collection_name [Symbol]
|
33
|
-
# @param klass [Class]
|
34
|
-
# @return [Twitter::Cursor]
|
35
|
-
def perform_with_cursor(collection_name, klass = nil)
|
36
|
-
Twitter::Cursor.new(perform, collection_name.to_sym, klass, self)
|
37
|
-
end
|
38
|
-
|
39
|
-
# @param klass [Class]
|
40
|
-
# @return [Array]
|
41
|
-
def perform_with_objects(klass)
|
42
|
-
perform.collect do |element|
|
43
|
-
klass.new(element)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|