twitter 8.3.0 → 8.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/twitter/base.rb +1 -1
- data/lib/twitter/error.rb +18 -18
- data/lib/twitter/geo_results.rb +1 -1
- data/lib/twitter/premium_search_results.rb +1 -1
- data/lib/twitter/profile.rb +1 -1
- data/lib/twitter/rest/direct_messages.rb +3 -3
- data/lib/twitter/rest/favorites.rb +1 -1
- data/lib/twitter/rest/form_encoder.rb +1 -1
- data/lib/twitter/rest/lists.rb +3 -2
- data/lib/twitter/rest/oauth.rb +2 -2
- data/lib/twitter/rest/premium_search.rb +3 -3
- data/lib/twitter/rest/request.rb +6 -6
- data/lib/twitter/rest/suggested_users.rb +1 -1
- data/lib/twitter/rest/timelines.rb +1 -1
- data/lib/twitter/rest/trends.rb +1 -1
- data/lib/twitter/rest/tweets.rb +2 -1
- data/lib/twitter/rest/undocumented.rb +1 -1
- data/lib/twitter/rest/upload_utils.rb +3 -3
- data/lib/twitter/rest/users.rb +3 -3
- data/lib/twitter/search_results.rb +4 -1
- data/lib/twitter/streaming/client.rb +1 -1
- data/lib/twitter/streaming/connection.rb +5 -4
- data/lib/twitter/streaming/response.rb +1 -1
- data/lib/twitter/user.rb +2 -2
- data/lib/twitter/version.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 515100c67d800e3f45b6ecd5945d9882c95c7716fd00da9bd453c5dfff53d4e9
|
|
4
|
+
data.tar.gz: 9d59b130ab6b9e9991111be19f1fc786ff07d3e459d63d085bd0ff73597037d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e9fe1d3d3079a8655957e58571e425e722d4d171f80d71df2f9cf1daffb3537ca540e0b4dfb49591f37a8fc76a4ce0d10939b2381cb40108a95262839c785c1
|
|
7
|
+
data.tar.gz: 8b8256bdbc961118a7ce8b89dc62462ccaaee8dea498777d5f520eeb781d07ccf6bc8c389b9a99ff00b24052fb4011f7634270fa399d2759d6e7f433610ca9d7
|
data/lib/twitter/base.rb
CHANGED
|
@@ -165,7 +165,7 @@ module Twitter
|
|
|
165
165
|
# @param method [String, Symbol] Message to send to the object
|
|
166
166
|
# @return [Object, nil]
|
|
167
167
|
def [](method)
|
|
168
|
-
location = caller_locations(1, 1)
|
|
168
|
+
location, = caller_locations(1, 1)
|
|
169
169
|
warn "#{location&.path}:#{location&.lineno}: [DEPRECATION] #[#{method.inspect}] is deprecated. Use ##{method} to fetch the value."
|
|
170
170
|
public_send(method.to_sym)
|
|
171
171
|
rescue NoMethodError
|
data/lib/twitter/error.rb
CHANGED
|
@@ -24,81 +24,81 @@ module Twitter
|
|
|
24
24
|
|
|
25
25
|
# Raised when Twitter returns the HTTP status code 400
|
|
26
26
|
class BadRequest < ClientError
|
|
27
|
-
end
|
|
27
|
+
end
|
|
28
28
|
|
|
29
29
|
# Raised when Twitter returns the HTTP status code 401
|
|
30
30
|
class Unauthorized < ClientError
|
|
31
|
-
end
|
|
31
|
+
end
|
|
32
32
|
|
|
33
33
|
# Raised when Twitter returns the HTTP status code 403
|
|
34
34
|
class Forbidden < ClientError
|
|
35
|
-
end
|
|
35
|
+
end
|
|
36
36
|
|
|
37
37
|
# Raised when Twitter returns the HTTP status code 413
|
|
38
38
|
class RequestEntityTooLarge < ClientError
|
|
39
|
-
end
|
|
39
|
+
end
|
|
40
40
|
|
|
41
41
|
# Raised when a Tweet has already been favorited
|
|
42
42
|
class AlreadyFavorited < Forbidden
|
|
43
|
-
end
|
|
43
|
+
end
|
|
44
44
|
|
|
45
45
|
# Raised when a Tweet has already been retweeted
|
|
46
46
|
class AlreadyRetweeted < Forbidden
|
|
47
|
-
end
|
|
47
|
+
end
|
|
48
48
|
|
|
49
49
|
# Raised when a Tweet has already been posted
|
|
50
50
|
class DuplicateStatus < Forbidden
|
|
51
|
-
end
|
|
51
|
+
end
|
|
52
52
|
|
|
53
53
|
# Raised when Twitter returns the HTTP status code 404
|
|
54
54
|
class NotFound < ClientError
|
|
55
|
-
end
|
|
55
|
+
end
|
|
56
56
|
|
|
57
57
|
# Raised when Twitter returns the HTTP status code 406
|
|
58
58
|
class NotAcceptable < ClientError
|
|
59
|
-
end
|
|
59
|
+
end
|
|
60
60
|
|
|
61
61
|
# Raised when Twitter returns the HTTP status code 422
|
|
62
62
|
class UnprocessableEntity < ClientError
|
|
63
|
-
end
|
|
63
|
+
end
|
|
64
64
|
|
|
65
65
|
# Raised when Twitter returns the HTTP status code 429
|
|
66
66
|
class TooManyRequests < ClientError
|
|
67
|
-
end
|
|
67
|
+
end
|
|
68
68
|
|
|
69
69
|
# Raised when Twitter returns a 5xx HTTP status code
|
|
70
70
|
ServerError = Class.new(self) # steep:ignore IncompatibleAssignment
|
|
71
71
|
|
|
72
72
|
# Raised when Twitter returns the HTTP status code 500
|
|
73
73
|
class InternalServerError < ServerError
|
|
74
|
-
end
|
|
74
|
+
end
|
|
75
75
|
|
|
76
76
|
# Raised when Twitter returns the HTTP status code 502
|
|
77
77
|
class BadGateway < ServerError
|
|
78
|
-
end
|
|
78
|
+
end
|
|
79
79
|
|
|
80
80
|
# Raised when Twitter returns the HTTP status code 503
|
|
81
81
|
class ServiceUnavailable < ServerError
|
|
82
|
-
end
|
|
82
|
+
end
|
|
83
83
|
|
|
84
84
|
# Raised when Twitter returns the HTTP status code 504
|
|
85
85
|
class GatewayTimeout < ServerError
|
|
86
|
-
end
|
|
86
|
+
end
|
|
87
87
|
|
|
88
88
|
# Raised when Twitter returns a media related error
|
|
89
89
|
MediaError = Class.new(self) # steep:ignore IncompatibleAssignment
|
|
90
90
|
|
|
91
91
|
# Raised when Twitter returns an InvalidMedia error
|
|
92
92
|
class InvalidMedia < MediaError
|
|
93
|
-
end
|
|
93
|
+
end
|
|
94
94
|
|
|
95
95
|
# Raised when Twitter returns a media InternalError error
|
|
96
96
|
class MediaInternalError < MediaError
|
|
97
|
-
end
|
|
97
|
+
end
|
|
98
98
|
|
|
99
99
|
# Raised when Twitter returns an UnsupportedMedia error
|
|
100
100
|
class UnsupportedMedia < MediaError
|
|
101
|
-
end
|
|
101
|
+
end
|
|
102
102
|
|
|
103
103
|
# Raised when an operation subject to timeout takes too long
|
|
104
104
|
TimeoutError = Class.new(self) # steep:ignore IncompatibleAssignment
|
data/lib/twitter/geo_results.rb
CHANGED
|
@@ -42,7 +42,7 @@ module Twitter
|
|
|
42
42
|
@attrs = attrs || {}
|
|
43
43
|
empty_hash = {} # : Hash[Symbol, untyped]
|
|
44
44
|
empty_array = [] # : Array[untyped]
|
|
45
|
-
@collection = @attrs.fetch(:result, empty_hash).fetch(:places, empty_array).collect do |place|
|
|
45
|
+
@collection = @attrs.fetch(:result, empty_hash).fetch(:places, empty_array).collect do |place|
|
|
46
46
|
Place.new(place)
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -86,7 +86,7 @@ module Twitter
|
|
|
86
86
|
# @api private
|
|
87
87
|
# @return [Hash]
|
|
88
88
|
def fetch_next_page
|
|
89
|
-
request = @client.premium_search(search_query, next_page_options, @request_config)
|
|
89
|
+
request = @client.premium_search(search_query, next_page_options, @request_config)
|
|
90
90
|
|
|
91
91
|
self.attrs = request.attrs
|
|
92
92
|
end
|
data/lib/twitter/profile.rb
CHANGED
|
@@ -68,7 +68,7 @@ module Twitter
|
|
|
68
68
|
# @return [Array<Twitter::DirectMessage>] Direct messages received
|
|
69
69
|
def direct_messages_received(options = {})
|
|
70
70
|
limit = options.fetch(:count, 20)
|
|
71
|
-
direct_messages_list(options).select { |dm| dm.recipient_id
|
|
71
|
+
direct_messages_list(options).select { |dm| dm.recipient_id.eql?(user_id) }.first(limit)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# Returns Direct Messages sent by the authenticated user
|
|
@@ -87,7 +87,7 @@ module Twitter
|
|
|
87
87
|
# @return [Array<Twitter::DirectMessage>] Direct messages sent
|
|
88
88
|
def direct_messages_sent(options = {})
|
|
89
89
|
limit = options.fetch(:count, 20)
|
|
90
|
-
direct_messages_list(options).select { |dm| dm.sender_id
|
|
90
|
+
direct_messages_list(options).select { |dm| dm.sender_id.eql?(user_id) }.first(limit)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
# Returns a direct message
|
|
@@ -241,7 +241,7 @@ module Twitter
|
|
|
241
241
|
def create_direct_message_event(*args)
|
|
242
242
|
arguments = Arguments.new(args)
|
|
243
243
|
options = arguments.options
|
|
244
|
-
options[:event] = {type: "message_create", message_create: {target: {recipient_id: extract_id(arguments.fetch(0))}, message_data: {text: arguments.fetch(1)}}} if arguments.length
|
|
244
|
+
options[:event] = {type: "message_create", message_create: {target: {recipient_id: extract_id(arguments.fetch(0))}, message_data: {text: arguments.fetch(1)}}} if arguments.length.eql?(2)
|
|
245
245
|
response = Request.new(self, :json_post, "/1.1/direct_messages/events/new.json", options).perform
|
|
246
246
|
DirectMessageEvent.new(response)
|
|
247
247
|
end
|
|
@@ -37,7 +37,7 @@ module Twitter
|
|
|
37
37
|
# @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
|
|
38
38
|
def favorites(*args)
|
|
39
39
|
arguments = Arguments.new(args)
|
|
40
|
-
merge_user!(arguments.options, arguments.pop) if arguments.
|
|
40
|
+
merge_user!(arguments.options, arguments.pop) if arguments.any?
|
|
41
41
|
perform_get_with_objects("/1.1/favorites/list.json", arguments.options, Tweet)
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -58,7 +58,7 @@ module Twitter
|
|
|
58
58
|
# @param value [Object] The value to escape
|
|
59
59
|
# @return [String]
|
|
60
60
|
def self.escape(value)
|
|
61
|
-
URI::DEFAULT_PARSER.escape(value.to_s, UNESCAPED_CHARS)
|
|
61
|
+
URI::DEFAULT_PARSER.escape(value.to_s, UNESCAPED_CHARS)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
private_class_method :encode_pair, :encode_array, :encode_array_item, :escape
|
data/lib/twitter/rest/lists.rb
CHANGED
|
@@ -526,9 +526,10 @@ module Twitter
|
|
|
526
526
|
members = arguments.pop
|
|
527
527
|
merge_list!(options, arguments.pop)
|
|
528
528
|
merge_owner!(options, arguments.pop)
|
|
529
|
-
pmap(members.each_slice(MAX_USERS_PER_REQUEST)) do |users|
|
|
529
|
+
*, result = pmap(members.each_slice(MAX_USERS_PER_REQUEST)) do |users|
|
|
530
530
|
perform_post_with_object(path, merge_users(options, users), List)
|
|
531
|
-
end
|
|
531
|
+
end
|
|
532
|
+
result
|
|
532
533
|
end
|
|
533
534
|
|
|
534
535
|
# Take a list and merge it into the hash with the correct key
|
data/lib/twitter/rest/oauth.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Twitter
|
|
|
24
24
|
options[:grant_type] ||= "client_credentials"
|
|
25
25
|
url = "https://api.twitter.com/oauth2/token"
|
|
26
26
|
headers = ::Twitter::Headers.new(self, :post, url, options).request_headers # steep:ignore ArgumentTypeMismatch
|
|
27
|
-
response = HTTP.headers(headers).post(url, form: options)
|
|
27
|
+
response = HTTP.headers(headers).post(url, form: options)
|
|
28
28
|
response.parse.fetch("access_token")
|
|
29
29
|
end
|
|
30
30
|
# @!method bearer_token
|
|
@@ -64,7 +64,7 @@ module Twitter
|
|
|
64
64
|
options = {x_auth_mode: "reverse_auth"}
|
|
65
65
|
url = "https://api.twitter.com/oauth/request_token"
|
|
66
66
|
auth_header = ::Twitter::Headers.new(self, :post, url, options).oauth_auth_header.to_s # steep:ignore ArgumentTypeMismatch
|
|
67
|
-
HTTP.headers(authorization: auth_header).post(url, params: options).to_s
|
|
67
|
+
HTTP.headers(authorization: auth_header).post(url, params: options).to_s
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -27,11 +27,11 @@ module Twitter
|
|
|
27
27
|
# @return [Twitter::PremiumSearchResults] Tweets matching the query.
|
|
28
28
|
def premium_search(query, options = {}, request_config = {})
|
|
29
29
|
options = options.clone
|
|
30
|
-
options[:maxResults] ||= MAX_TWEETS_PER_REQUEST
|
|
31
|
-
request_config[:request_method] = :json_post if request_config[:request_method].nil? || request_config.fetch(:request_method)
|
|
30
|
+
options[:maxResults] ||= MAX_TWEETS_PER_REQUEST
|
|
31
|
+
request_config[:request_method] = :json_post if request_config[:request_method].nil? || request_config.fetch(:request_method).eql?(:post)
|
|
32
32
|
request_config[:product] ||= "30day"
|
|
33
33
|
path = "/1.1/tweets/search/#{request_config.fetch(:product)}/#{dev_environment}.json" # steep:ignore NoMethod
|
|
34
|
-
request = Request.new(self, request_config.fetch(:request_method), path, options.merge(query:))
|
|
34
|
+
request = Request.new(self, request_config.fetch(:request_method), path, options.merge(query:))
|
|
35
35
|
PremiumSearchResults.new(request, request_config)
|
|
36
36
|
end
|
|
37
37
|
end
|
data/lib/twitter/rest/request.rb
CHANGED
|
@@ -124,7 +124,7 @@ module Twitter
|
|
|
124
124
|
# @api private
|
|
125
125
|
# @return [Hash]
|
|
126
126
|
def request_options
|
|
127
|
-
options = if @options_key
|
|
127
|
+
options = if @options_key.eql?(:form)
|
|
128
128
|
{form: HTTP::FormData.create(@options, encoder: FormEncoder.public_method(:encode))}
|
|
129
129
|
else
|
|
130
130
|
{@options_key => @options}
|
|
@@ -158,10 +158,10 @@ module Twitter
|
|
|
158
158
|
# @return [void]
|
|
159
159
|
def set_multipart_options!(request_method, options)
|
|
160
160
|
if %i[multipart_post json_post].include?(request_method)
|
|
161
|
-
merge_multipart_file!(options) if request_method
|
|
161
|
+
merge_multipart_file!(options) if request_method.eql?(:multipart_post)
|
|
162
162
|
options = {} # : Hash[Symbol, untyped]
|
|
163
163
|
@request_method = :post
|
|
164
|
-
elsif request_method
|
|
164
|
+
elsif request_method.eql?(:json_put)
|
|
165
165
|
@request_method = :put
|
|
166
166
|
else
|
|
167
167
|
@request_method = request_method
|
|
@@ -212,7 +212,7 @@ module Twitter
|
|
|
212
212
|
# @return [Twitter::Error, nil]
|
|
213
213
|
def error(code, body, response)
|
|
214
214
|
klass = Error::ERRORS[code]
|
|
215
|
-
if klass
|
|
215
|
+
if klass.eql?(Error::Forbidden)
|
|
216
216
|
forbidden_error(body, response)
|
|
217
217
|
elsif !klass.nil?
|
|
218
218
|
klass.from_response(body, response)
|
|
@@ -267,8 +267,8 @@ module Twitter
|
|
|
267
267
|
# @api private
|
|
268
268
|
# @return [HTTP::Session, HTTP]
|
|
269
269
|
def http_client
|
|
270
|
-
client = @client.proxy ? HTTP.via(*proxy) : HTTP
|
|
271
|
-
client = client.timeout(connect: @client.timeouts.fetch(:connect), read: @client.timeouts.fetch(:read), write: @client.timeouts.fetch(:write)) if timeout_keys_defined?
|
|
270
|
+
client = @client.proxy ? HTTP.via(*proxy) : HTTP
|
|
271
|
+
client = client.timeout(connect: @client.timeouts.fetch(:connect), read: @client.timeouts.fetch(:read), write: @client.timeouts.fetch(:write)) if timeout_keys_defined?
|
|
272
272
|
client
|
|
273
273
|
end
|
|
274
274
|
|
|
@@ -31,7 +31,7 @@ module Twitter
|
|
|
31
31
|
# @param options [Hash] A customizable set of options.
|
|
32
32
|
def suggestions(*args)
|
|
33
33
|
arguments = Arguments.new(args)
|
|
34
|
-
if arguments.
|
|
34
|
+
if arguments.any?
|
|
35
35
|
perform_get_with_object("/1.1/users/suggestions/#{arguments.pop}.json", arguments.options, Suggestion)
|
|
36
36
|
else
|
|
37
37
|
perform_get_with_objects("/1.1/users/suggestions.json", arguments.options, Suggestion)
|
|
@@ -230,7 +230,7 @@ module Twitter
|
|
|
230
230
|
return collection if tweets.nil?
|
|
231
231
|
|
|
232
232
|
collection += tweets
|
|
233
|
-
tweets.empty? ? collection : collect_with_max_id(collection, tweets.last.id - 1, &)
|
|
233
|
+
tweets.empty? ? collection : collect_with_max_id(collection, tweets.last.id - 1, &)
|
|
234
234
|
end
|
|
235
235
|
end
|
|
236
236
|
end
|
data/lib/twitter/rest/trends.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Twitter
|
|
|
25
25
|
def trends(id = 1, options = {})
|
|
26
26
|
options = options.dup
|
|
27
27
|
options[:id] = id
|
|
28
|
-
response = perform_get("/1.1/trends/place.json", options)
|
|
28
|
+
response, = perform_get("/1.1/trends/place.json", options)
|
|
29
29
|
TrendResults.new(response)
|
|
30
30
|
end
|
|
31
31
|
# @!method local_trends
|
data/lib/twitter/rest/tweets.rb
CHANGED
|
@@ -335,7 +335,8 @@ module Twitter
|
|
|
335
335
|
# @param options [Hash] A customizable set of options.
|
|
336
336
|
def retweeters_ids(*args)
|
|
337
337
|
arguments = Arguments.new(args)
|
|
338
|
-
|
|
338
|
+
id, = arguments
|
|
339
|
+
arguments.options[:id] ||= extract_id(id)
|
|
339
340
|
perform_get_with_cursor("/1.1/statuses/retweeters/ids.json", arguments.options, :ids)
|
|
340
341
|
end
|
|
341
342
|
|
|
@@ -45,7 +45,7 @@ module Twitter
|
|
|
45
45
|
# @param url [String, URI] A URL.
|
|
46
46
|
# @param options [Hash] A customizable set of options.
|
|
47
47
|
def tweet_count(url, options = {})
|
|
48
|
-
HTTP.get("https://cdn.api.twitter.com/1/urls/count.json", params: options.merge(url: url.to_s)).parse["count"]
|
|
48
|
+
HTTP.get("https://cdn.api.twitter.com/1/urls/count.json", params: options.merge(url: url.to_s)).parse["count"]
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -15,9 +15,9 @@ module Twitter
|
|
|
15
15
|
# @return [Hash]
|
|
16
16
|
def upload(media, media_category_prefix: "tweet")
|
|
17
17
|
ext = File.extname(media)
|
|
18
|
-
return chunk_upload(media, "video/mp4", "#{media_category_prefix}_video") if ext
|
|
19
|
-
return chunk_upload(media, "video/quicktime", "#{media_category_prefix}_video") if ext
|
|
20
|
-
return chunk_upload(media, "image/gif", "#{media_category_prefix}_gif") if ext
|
|
18
|
+
return chunk_upload(media, "video/mp4", "#{media_category_prefix}_video") if ext.eql?(".mp4")
|
|
19
|
+
return chunk_upload(media, "video/quicktime", "#{media_category_prefix}_video") if ext.eql?(".mov")
|
|
20
|
+
return chunk_upload(media, "image/gif", "#{media_category_prefix}_gif") if ext.eql?(".gif") && File.size(media) > 5_000_000
|
|
21
21
|
|
|
22
22
|
Request.new(self, :multipart_post, "https://upload.twitter.com/1.1/media/upload.json", key: :media, file: media).perform
|
|
23
23
|
end
|
data/lib/twitter/rest/users.rb
CHANGED
|
@@ -40,8 +40,8 @@ module Twitter
|
|
|
40
40
|
request_method = options.empty? ? :get : :post
|
|
41
41
|
response = perform_request(request_method, "/1.1/account/settings.json", options)
|
|
42
42
|
# https://dev.twitter.com/issues/59
|
|
43
|
-
|
|
44
|
-
response[:trend_location] =
|
|
43
|
+
trend_location, = response[:trend_location]
|
|
44
|
+
response[:trend_location] = trend_location
|
|
45
45
|
Settings.new(response)
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -272,7 +272,7 @@ module Twitter
|
|
|
272
272
|
# @option options [Boolean, String, Integer] :skip_status Do not include user's Tweets when set to true, 't' or 1.
|
|
273
273
|
def user(*args)
|
|
274
274
|
arguments = Arguments.new(args)
|
|
275
|
-
if arguments.
|
|
275
|
+
if arguments.any? || user_id?
|
|
276
276
|
merge_user!(arguments.options, arguments.pop || user_id)
|
|
277
277
|
perform_get_with_object("/1.1/users/show.json", arguments.options, User)
|
|
278
278
|
else
|
|
@@ -116,7 +116,10 @@ module Twitter
|
|
|
116
116
|
return {} if parsed_query.nil?
|
|
117
117
|
|
|
118
118
|
query = CGI.parse(parsed_query)
|
|
119
|
-
query.to_h
|
|
119
|
+
query.to_h do |key, values|
|
|
120
|
+
value, = values
|
|
121
|
+
[key.to_sym, value]
|
|
122
|
+
end
|
|
120
123
|
end
|
|
121
124
|
end
|
|
122
125
|
end
|
|
@@ -164,7 +164,7 @@ module Twitter
|
|
|
164
164
|
def request(method, uri, params)
|
|
165
165
|
before_request.call
|
|
166
166
|
headers = Twitter::Headers.new(self, method, uri, params).request_headers
|
|
167
|
-
request = HTTP::Request.new(verb: method, uri: "#{uri}?#{to_url_params(params)}", headers:, proxy:)
|
|
167
|
+
request = HTTP::Request.new(verb: method, uri: "#{uri}?#{to_url_params(params)}", headers:, proxy: proxy || {})
|
|
168
168
|
response = Streaming::Response.new do |data|
|
|
169
169
|
if item = Streaming::MessageParser.parse(data) # rubocop:disable Lint/AssignmentInCondition
|
|
170
170
|
yield(item)
|
|
@@ -30,8 +30,8 @@ module Twitter
|
|
|
30
30
|
# @param options [Hash] A customizable set of options.
|
|
31
31
|
# @return [Twitter::Streaming::Connection]
|
|
32
32
|
def initialize(options = {})
|
|
33
|
-
@tcp_socket_class = options.fetch(:tcp_socket_class) { TCPSocket }
|
|
34
|
-
@ssl_socket_class = options.fetch(:ssl_socket_class) { OpenSSL::SSL::SSLSocket }
|
|
33
|
+
@tcp_socket_class = options.fetch(:tcp_socket_class) { TCPSocket }
|
|
34
|
+
@ssl_socket_class = options.fetch(:ssl_socket_class) { OpenSSL::SSL::SSLSocket }
|
|
35
35
|
@using_ssl = options.fetch(:using_ssl, false)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -49,7 +49,8 @@ module Twitter
|
|
|
49
49
|
read_pipe, @write_pipe = IO.pipe
|
|
50
50
|
loop do
|
|
51
51
|
read_ios, _write_ios, _exception_ios = IO.select([read_pipe, client])
|
|
52
|
-
|
|
52
|
+
first_io, = read_ios
|
|
53
|
+
case first_io
|
|
53
54
|
when client
|
|
54
55
|
response << client.readpartial(1024)
|
|
55
56
|
when read_pipe
|
|
@@ -70,7 +71,7 @@ module Twitter
|
|
|
70
71
|
client = new_tcp_socket(request.socket_host, request.socket_port)
|
|
71
72
|
return client if !@using_ssl && request.using_proxy?
|
|
72
73
|
|
|
73
|
-
client_context = OpenSSL::SSL::SSLContext.new
|
|
74
|
+
client_context = OpenSSL::SSL::SSLContext.new
|
|
74
75
|
ssl_client = @ssl_socket_class.new(client, client_context)
|
|
75
76
|
ssl_client.connect
|
|
76
77
|
end
|
|
@@ -17,7 +17,7 @@ module Twitter
|
|
|
17
17
|
# @return [Twitter::Streaming::Response]
|
|
18
18
|
def initialize(&block)
|
|
19
19
|
@block = block
|
|
20
|
-
@parser = LLHttp::Parser.new(self, type: :response)
|
|
20
|
+
@parser = LLHttp::Parser.new(self, type: :response)
|
|
21
21
|
@tokenizer = BufferedTokenizer.new("\r\n") # steep:ignore UnknownConstant
|
|
22
22
|
end
|
|
23
23
|
|
data/lib/twitter/user.rb
CHANGED
|
@@ -204,7 +204,7 @@ module Twitter
|
|
|
204
204
|
def description_uris
|
|
205
205
|
empty_hash = {} # : Hash[Symbol, untyped]
|
|
206
206
|
empty_array = [] # : Array[untyped]
|
|
207
|
-
@attrs.fetch(:entities, empty_hash).fetch(:description, empty_hash).fetch(:urls, empty_array).collect do |url|
|
|
207
|
+
@attrs.fetch(:entities, empty_hash).fetch(:description, empty_hash).fetch(:urls, empty_array).collect do |url|
|
|
208
208
|
Entity::URI.new(url)
|
|
209
209
|
end
|
|
210
210
|
end
|
|
@@ -246,7 +246,7 @@ module Twitter
|
|
|
246
246
|
def website_uris
|
|
247
247
|
empty_hash = {} # : Hash[Symbol, untyped]
|
|
248
248
|
empty_array = [] # : Array[untyped]
|
|
249
|
-
@attrs.fetch(:entities, empty_hash).fetch(:url, empty_hash).fetch(:urls, empty_array).collect do |url|
|
|
249
|
+
@attrs.fetch(:entities, empty_hash).fetch(:url, empty_hash).fetch(:urls, empty_array).collect do |url|
|
|
250
250
|
Entity::URI.new(url)
|
|
251
251
|
end
|
|
252
252
|
end
|
data/lib/twitter/version.rb
CHANGED
|
@@ -28,10 +28,10 @@ module Twitter
|
|
|
28
28
|
#
|
|
29
29
|
# @api private
|
|
30
30
|
# @example
|
|
31
|
-
# Twitter::Version.patch # =>
|
|
31
|
+
# Twitter::Version.patch # => 1
|
|
32
32
|
# @return [Integer]
|
|
33
33
|
def patch
|
|
34
|
-
|
|
34
|
+
1
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
# The pre-release version identifier
|
|
@@ -47,7 +47,7 @@ module Twitter
|
|
|
47
47
|
#
|
|
48
48
|
# @api private
|
|
49
49
|
# @example
|
|
50
|
-
# Twitter::Version.to_h # => {major: 8, minor: 3, patch:
|
|
50
|
+
# Twitter::Version.to_h # => {major: 8, minor: 3, patch: 1, pre: nil}
|
|
51
51
|
# @return [Hash]
|
|
52
52
|
def to_h
|
|
53
53
|
{major:, minor:, patch:, pre: nil}
|
|
@@ -57,7 +57,7 @@ module Twitter
|
|
|
57
57
|
#
|
|
58
58
|
# @api private
|
|
59
59
|
# @example
|
|
60
|
-
# Twitter::Version.to_a # => [8, 3,
|
|
60
|
+
# Twitter::Version.to_a # => [8, 3, 1]
|
|
61
61
|
# @return [Array]
|
|
62
62
|
def to_a
|
|
63
63
|
[major, minor, patch]
|
|
@@ -67,7 +67,7 @@ module Twitter
|
|
|
67
67
|
#
|
|
68
68
|
# @api private
|
|
69
69
|
# @example
|
|
70
|
-
# Twitter::Version.to_s # => "8.3.
|
|
70
|
+
# Twitter::Version.to_s # => "8.3.1"
|
|
71
71
|
# @return [String]
|
|
72
72
|
def to_s
|
|
73
73
|
to_a.join(".")
|
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: 8.3.
|
|
4
|
+
version: 8.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Erik Berlin
|
|
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
252
252
|
- !ruby/object:Gem::Version
|
|
253
253
|
version: '0'
|
|
254
254
|
requirements: []
|
|
255
|
-
rubygems_version: 4.0.
|
|
255
|
+
rubygems_version: 4.0.11
|
|
256
256
|
specification_version: 4
|
|
257
257
|
summary: A Ruby interface to the Twitter API.
|
|
258
258
|
test_files: []
|