twitter 5.1.1 → 5.2.0
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.
- data.tar.gz.sig +0 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +10 -1
- data/CONTRIBUTING.md +2 -2
- data/README.md +30 -20
- data/Rakefile +26 -5
- data/lib/twitter/arguments.rb +0 -1
- data/lib/twitter/base.rb +13 -16
- data/lib/twitter/basic_user.rb +3 -3
- data/lib/twitter/client.rb +7 -8
- data/lib/twitter/configuration.rb +5 -5
- data/lib/twitter/core_ext/enumerable.rb +0 -2
- data/lib/twitter/core_ext/kernel.rb +0 -2
- data/lib/twitter/creatable.rb +0 -1
- data/lib/twitter/cursor.rb +7 -10
- data/lib/twitter/direct_message.rb +1 -1
- data/lib/twitter/entity/uri.rb +2 -2
- data/lib/twitter/enumerable.rb +1 -2
- data/lib/twitter/error.rb +4 -6
- data/lib/twitter/error/already_favorited.rb +1 -1
- data/lib/twitter/error/already_posted.rb +1 -1
- data/lib/twitter/error/already_retweeted.rb +1 -1
- data/lib/twitter/error/too_many_requests.rb +2 -2
- data/lib/twitter/factory.rb +2 -6
- data/lib/twitter/geo.rb +1 -1
- data/lib/twitter/geo/point.rb +3 -5
- data/lib/twitter/geo_factory.rb +1 -5
- data/lib/twitter/geo_results.rb +5 -8
- data/lib/twitter/identity.rb +1 -2
- data/lib/twitter/list.rb +4 -5
- data/lib/twitter/media/photo.rb +1 -2
- data/lib/twitter/media_factory.rb +1 -5
- data/lib/twitter/null_object.rb +4 -6
- data/lib/twitter/oembed.rb +1 -1
- data/lib/twitter/place.rb +4 -5
- data/lib/twitter/profile_banner.rb +1 -3
- data/lib/twitter/rate_limit.rb +1 -3
- data/lib/twitter/relationship.rb +1 -2
- data/lib/twitter/rest/api/direct_messages.rb +13 -14
- data/lib/twitter/rest/api/favorites.rb +10 -11
- data/lib/twitter/rest/api/friends_and_followers.rb +36 -36
- data/lib/twitter/rest/api/help.rb +8 -9
- data/lib/twitter/rest/api/lists.rb +62 -63
- data/lib/twitter/rest/api/oauth.rb +3 -4
- data/lib/twitter/rest/api/places_and_geo.rb +9 -10
- data/lib/twitter/rest/api/saved_searches.rb +5 -6
- data/lib/twitter/rest/api/search.rb +2 -3
- data/lib/twitter/rest/api/spam_reporting.rb +1 -2
- data/lib/twitter/rest/api/suggested_users.rb +4 -5
- data/lib/twitter/rest/api/timelines.rb +17 -18
- data/lib/twitter/rest/api/trends.rb +10 -11
- data/lib/twitter/rest/api/tweets.rb +15 -16
- data/lib/twitter/rest/api/undocumented.rb +6 -7
- data/lib/twitter/rest/api/users.rb +51 -52
- data/lib/twitter/rest/api/utils.rb +23 -30
- data/lib/twitter/rest/client.rb +8 -9
- data/lib/twitter/rest/request/multipart_with_file.rb +0 -1
- data/lib/twitter/rest/response/parse_error_json.rb +0 -2
- data/lib/twitter/rest/response/parse_json.rb +0 -2
- data/lib/twitter/rest/response/raise_error.rb +1 -3
- data/lib/twitter/search_results.rb +12 -15
- data/lib/twitter/settings.rb +2 -2
- data/lib/twitter/size.rb +2 -2
- data/lib/twitter/source_user.rb +1 -1
- data/lib/twitter/streaming/client.rb +71 -18
- data/lib/twitter/streaming/connection.rb +1 -3
- data/lib/twitter/streaming/deleted_tweet.rb +8 -0
- data/lib/twitter/streaming/event.rb +8 -8
- data/lib/twitter/streaming/friend_list.rb +2 -9
- data/lib/twitter/streaming/message_parser.rb +13 -7
- data/lib/twitter/streaming/response.rb +0 -2
- data/lib/twitter/streaming/stall_warning.rb +7 -0
- data/lib/twitter/suggestion.rb +0 -1
- data/lib/twitter/token.rb +2 -3
- data/lib/twitter/trend_results.rb +5 -8
- data/lib/twitter/tweet.rb +16 -24
- data/lib/twitter/user.rb +30 -32
- data/lib/twitter/version.rb +2 -5
- data/spec/fixtures/track_streaming_user.json +2 -1
- data/spec/helper.rb +6 -2
- data/spec/twitter/base_spec.rb +9 -9
- data/spec/twitter/basic_user_spec.rb +6 -6
- data/spec/twitter/configuration_spec.rb +4 -4
- data/spec/twitter/cursor_spec.rb +27 -27
- data/spec/twitter/direct_message_spec.rb +36 -36
- data/spec/twitter/entity/uri_spec.rb +27 -27
- data/spec/twitter/error_spec.rb +21 -21
- data/spec/twitter/geo/point_spec.rb +9 -9
- data/spec/twitter/geo/polygon_spec.rb +5 -5
- data/spec/twitter/geo_factory_spec.rb +7 -7
- data/spec/twitter/geo_results_spec.rb +11 -11
- data/spec/twitter/geo_spec.rb +5 -5
- data/spec/twitter/identifiable_spec.rb +9 -9
- data/spec/twitter/list_spec.rb +38 -38
- data/spec/twitter/media/photo_spec.rb +54 -54
- data/spec/twitter/media_factory_spec.rb +5 -5
- data/spec/twitter/null_object_spec.rb +6 -6
- data/spec/twitter/oembed_spec.rb +65 -65
- data/spec/twitter/place_spec.rb +89 -60
- data/spec/twitter/profile_banner_spec.rb +3 -3
- data/spec/twitter/rate_limit_spec.rb +18 -18
- data/spec/twitter/relationship_spec.rb +16 -16
- data/spec/twitter/rest/api/direct_messages_spec.rb +61 -61
- data/spec/twitter/rest/api/favorites_spec.rb +93 -93
- data/spec/twitter/rest/api/friends_and_followers_spec.rb +349 -349
- data/spec/twitter/rest/api/geo_spec.rb +33 -33
- data/spec/twitter/rest/api/help_spec.rb +24 -24
- data/spec/twitter/rest/api/lists_spec.rb +487 -487
- data/spec/twitter/rest/api/oauth_spec.rb +30 -30
- data/spec/twitter/rest/api/saved_searches_spec.rb +40 -40
- data/spec/twitter/rest/api/search_spec.rb +16 -16
- data/spec/twitter/rest/api/spam_reporting_spec.rb +9 -9
- data/spec/twitter/rest/api/suggested_users_spec.rb +23 -23
- data/spec/twitter/rest/api/timelines_spec.rb +58 -58
- data/spec/twitter/rest/api/trends_spec.rb +26 -26
- data/spec/twitter/rest/api/tweets_spec.rb +284 -284
- data/spec/twitter/rest/api/undocumented_spec.rb +51 -51
- data/spec/twitter/rest/api/users_spec.rb +360 -360
- data/spec/twitter/rest/client_spec.rb +99 -103
- data/spec/twitter/saved_search_spec.rb +16 -16
- data/spec/twitter/search_results_spec.rb +44 -44
- data/spec/twitter/settings_spec.rb +8 -8
- data/spec/twitter/size_spec.rb +5 -5
- data/spec/twitter/source_user_spec.rb +6 -6
- data/spec/twitter/streaming/client_spec.rb +53 -49
- data/spec/twitter/streaming/deleted_tweet_spec.rb +23 -0
- data/spec/twitter/streaming/event_spec.rb +20 -22
- data/spec/twitter/streaming/friend_list_spec.rb +11 -0
- data/spec/twitter/streaming/message_parser_spec.rb +54 -0
- data/spec/twitter/suggestion_spec.rb +11 -11
- data/spec/twitter/target_user_spec.rb +6 -6
- data/spec/twitter/token_spec.rb +4 -4
- data/spec/twitter/trend_results_spec.rb +30 -30
- data/spec/twitter/trend_spec.rb +20 -20
- data/spec/twitter/tweet_spec.rb +170 -173
- data/spec/twitter/user_spec.rb +179 -179
- data/twitter.gemspec +2 -2
- metadata +21 -4
- metadata.gz.sig +2 -1
data/lib/twitter/entity/uri.rb
CHANGED
data/lib/twitter/enumerable.rb
CHANGED
|
@@ -3,13 +3,12 @@ module Twitter
|
|
|
3
3
|
include ::Enumerable
|
|
4
4
|
|
|
5
5
|
# @return [Enumerator]
|
|
6
|
-
def each(start=0, &block)
|
|
6
|
+
def each(start = 0, &block)
|
|
7
7
|
return to_enum(:each) unless block_given?
|
|
8
8
|
Array(@collection[start..-1]).each do |element|
|
|
9
9
|
yield element
|
|
10
10
|
end
|
|
11
11
|
self
|
|
12
12
|
end
|
|
13
|
-
|
|
14
13
|
end
|
|
15
14
|
end
|
data/lib/twitter/error.rb
CHANGED
|
@@ -20,6 +20,7 @@ module Twitter
|
|
|
20
20
|
OAUTH_TIMESTAMP_OUT_OF_RANGE = 135
|
|
21
21
|
FOLLOW_LIMIT_EXCEEDED = 161
|
|
22
22
|
PROTECTED_STATUS = 179
|
|
23
|
+
OVER_UPDATE_LIMIT = 185
|
|
23
24
|
DUPLICATE_STATUS = 187
|
|
24
25
|
BAD_AUTHENTICATION_DATA = 215
|
|
25
26
|
LOGIN_VERIFICATION_NEEDED = 231
|
|
@@ -27,19 +28,18 @@ module Twitter
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
class << self
|
|
30
|
-
|
|
31
31
|
# Create a new error from an HTTP response
|
|
32
32
|
#
|
|
33
33
|
# @param response [Hash]
|
|
34
34
|
# @return [Twitter::Error]
|
|
35
|
-
def from_response(response={})
|
|
35
|
+
def from_response(response = {})
|
|
36
36
|
error, code = parse_error(response[:body])
|
|
37
37
|
new(error, response[:response_headers], code)
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
# @return [Hash]
|
|
41
41
|
def errors
|
|
42
|
-
@errors ||= descendants.
|
|
42
|
+
@errors ||= descendants.reduce({}) do |hash, klass|
|
|
43
43
|
hash[klass::HTTP_STATUS_CODE] = klass
|
|
44
44
|
hash
|
|
45
45
|
end
|
|
@@ -65,7 +65,6 @@ module Twitter
|
|
|
65
65
|
[first.chomp, nil]
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
|
-
|
|
69
68
|
end
|
|
70
69
|
|
|
71
70
|
# Initializes a new Error object
|
|
@@ -74,12 +73,11 @@ module Twitter
|
|
|
74
73
|
# @param response_headers [Hash]
|
|
75
74
|
# @param code [Integer]
|
|
76
75
|
# @return [Twitter::Error]
|
|
77
|
-
def initialize(exception
|
|
76
|
+
def initialize(exception = $ERROR_INFO, response_headers = {}, code = nil) # rubocop:disable MethodLength
|
|
78
77
|
@rate_limit = RateLimit.new(response_headers)
|
|
79
78
|
@wrapped_exception = exception
|
|
80
79
|
@code = code
|
|
81
80
|
exception.respond_to?(:message) ? super(exception.message) : super(exception.to_s)
|
|
82
81
|
end
|
|
83
|
-
|
|
84
82
|
end
|
|
85
83
|
end
|
|
@@ -4,7 +4,7 @@ module Twitter
|
|
|
4
4
|
class Error
|
|
5
5
|
# Raised when a Tweet has already been retweeted
|
|
6
6
|
class AlreadyRetweeted < Twitter::Error::Forbidden
|
|
7
|
-
MESSAGE =
|
|
7
|
+
MESSAGE = 'sharing is not permissible for this status (Share validations failed)'
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -6,7 +6,7 @@ module Twitter
|
|
|
6
6
|
class TooManyRequests < Twitter::Error
|
|
7
7
|
HTTP_STATUS_CODE = 429
|
|
8
8
|
end
|
|
9
|
-
EnhanceYourCalm = TooManyRequests
|
|
10
|
-
RateLimited = TooManyRequests
|
|
9
|
+
EnhanceYourCalm = TooManyRequests # rubocop:disable ConstantName
|
|
10
|
+
RateLimited = TooManyRequests # rubocop:disable ConstantName
|
|
11
11
|
end
|
|
12
12
|
end
|
data/lib/twitter/factory.rb
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
module Twitter
|
|
2
2
|
class Factory
|
|
3
|
-
|
|
4
3
|
class << self
|
|
5
|
-
|
|
6
4
|
# Construct a new object
|
|
7
5
|
#
|
|
8
6
|
# @param method [Symbol]
|
|
@@ -10,13 +8,11 @@ module Twitter
|
|
|
10
8
|
# @param attrs [Hash]
|
|
11
9
|
# @raise [IndexError] Error raised when supplied argument is missing a key.
|
|
12
10
|
# @return [Twitter::Base]
|
|
13
|
-
def new(method, klass, attrs={})
|
|
11
|
+
def new(method, klass, attrs = {})
|
|
14
12
|
type = attrs.fetch(method.to_sym)
|
|
15
|
-
const_name = type.gsub(/\/(.?)/){"::#{
|
|
13
|
+
const_name = type.gsub(/\/(.?)/) { "::#{Regexp.last_match[1].upcase}" }.gsub(/(?:^|_)(.)/) { Regexp.last_match[1].upcase }
|
|
16
14
|
klass.const_get(const_name.to_sym).new(attrs)
|
|
17
15
|
end
|
|
18
|
-
|
|
19
16
|
end
|
|
20
|
-
|
|
21
17
|
end
|
|
22
18
|
end
|
data/lib/twitter/geo.rb
CHANGED
data/lib/twitter/geo/point.rb
CHANGED
|
@@ -3,20 +3,18 @@ require 'twitter/geo'
|
|
|
3
3
|
module Twitter
|
|
4
4
|
class Geo
|
|
5
5
|
class Point < Twitter::Geo
|
|
6
|
-
|
|
7
6
|
# @return [Integer]
|
|
8
7
|
def latitude
|
|
9
8
|
coordinates[0]
|
|
10
9
|
end
|
|
11
|
-
|
|
10
|
+
alias_method :lat, :latitude
|
|
12
11
|
|
|
13
12
|
# @return [Integer]
|
|
14
13
|
def longitude
|
|
15
14
|
coordinates[1]
|
|
16
15
|
end
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
alias_method :long, :longitude
|
|
17
|
+
alias_method :lng, :longitude
|
|
20
18
|
end
|
|
21
19
|
end
|
|
22
20
|
end
|
data/lib/twitter/geo_factory.rb
CHANGED
|
@@ -4,19 +4,15 @@ require 'twitter/geo/polygon'
|
|
|
4
4
|
|
|
5
5
|
module Twitter
|
|
6
6
|
class GeoFactory < Twitter::Factory
|
|
7
|
-
|
|
8
7
|
class << self
|
|
9
|
-
|
|
10
8
|
# Construct a new geo object
|
|
11
9
|
#
|
|
12
10
|
# @param attrs [Hash]
|
|
13
11
|
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
|
|
14
12
|
# @return [Twitter::Geo]
|
|
15
|
-
def new(attrs={})
|
|
13
|
+
def new(attrs = {})
|
|
16
14
|
super(:type, Geo, attrs)
|
|
17
15
|
end
|
|
18
|
-
|
|
19
16
|
end
|
|
20
|
-
|
|
21
17
|
end
|
|
22
18
|
end
|
data/lib/twitter/geo_results.rb
CHANGED
|
@@ -4,27 +4,25 @@ module Twitter
|
|
|
4
4
|
class GeoResults
|
|
5
5
|
include Twitter::Enumerable
|
|
6
6
|
attr_reader :attrs
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
alias_method :to_h, :attrs
|
|
8
|
+
alias_method :to_hash, :attrs
|
|
9
|
+
alias_method :to_hsh, :attrs
|
|
10
10
|
|
|
11
11
|
class << self
|
|
12
|
-
|
|
13
12
|
# Construct a new GeoResults object from a response hash
|
|
14
13
|
#
|
|
15
14
|
# @param response [Hash]
|
|
16
15
|
# @return [Twitter::Base]
|
|
17
|
-
def from_response(response={})
|
|
16
|
+
def from_response(response = {})
|
|
18
17
|
new(response[:body])
|
|
19
18
|
end
|
|
20
|
-
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
# Initializes a new GeoResults object
|
|
24
22
|
#
|
|
25
23
|
# @param attrs [Hash]
|
|
26
24
|
# @return [Twitter::GeoResults]
|
|
27
|
-
def initialize(attrs={})
|
|
25
|
+
def initialize(attrs = {})
|
|
28
26
|
@attrs = attrs
|
|
29
27
|
@collection = Array(@attrs[:result][:places]).map do |place|
|
|
30
28
|
Place.new(place)
|
|
@@ -35,6 +33,5 @@ module Twitter
|
|
|
35
33
|
def token
|
|
36
34
|
@attrs[:token]
|
|
37
35
|
end
|
|
38
|
-
|
|
39
36
|
end
|
|
40
37
|
end
|
data/lib/twitter/identity.rb
CHANGED
|
@@ -11,10 +11,9 @@ module Twitter
|
|
|
11
11
|
# @param attrs [Hash]
|
|
12
12
|
# @raise [ArgumentError] Error raised when supplied argument is missing an :id key.
|
|
13
13
|
# @return [Twitter::Identity]
|
|
14
|
-
def initialize(attrs={})
|
|
14
|
+
def initialize(attrs = {})
|
|
15
15
|
attrs.fetch(:id)
|
|
16
16
|
super
|
|
17
17
|
end
|
|
18
|
-
|
|
19
18
|
end
|
|
20
19
|
end
|
data/lib/twitter/list.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Twitter
|
|
|
5
5
|
class List < Twitter::Identity
|
|
6
6
|
include Twitter::Creatable
|
|
7
7
|
attr_reader :description, :following, :full_name, :member_count,
|
|
8
|
-
|
|
8
|
+
:mode, :name, :slug, :subscriber_count
|
|
9
9
|
object_attr_reader :User, :user
|
|
10
10
|
|
|
11
11
|
# @return [Addressable::URI] The URI to the list members.
|
|
@@ -13,21 +13,20 @@ module Twitter
|
|
|
13
13
|
Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}/members")
|
|
14
14
|
end
|
|
15
15
|
memoize :members_uri
|
|
16
|
-
|
|
16
|
+
alias_method :members_url, :members_uri
|
|
17
17
|
|
|
18
18
|
# @return [Addressable::URI] The URI to the list subscribers.
|
|
19
19
|
def subscribers_uri
|
|
20
20
|
Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}/subscribers")
|
|
21
21
|
end
|
|
22
22
|
memoize :subscribers_uri
|
|
23
|
-
|
|
23
|
+
alias_method :subscribers_url, :subscribers_uri
|
|
24
24
|
|
|
25
25
|
# @return [Addressable::URI] The URI to the list.
|
|
26
26
|
def uri
|
|
27
27
|
Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}")
|
|
28
28
|
end
|
|
29
29
|
memoize :uri
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
alias_method :url, :uri
|
|
32
31
|
end
|
|
33
32
|
end
|
data/lib/twitter/media/photo.rb
CHANGED
|
@@ -11,13 +11,12 @@ module Twitter
|
|
|
11
11
|
#
|
|
12
12
|
# @return [Array<Twitter::Size>]
|
|
13
13
|
def sizes
|
|
14
|
-
Array(@attrs[:sizes]).
|
|
14
|
+
Array(@attrs[:sizes]).reduce({}) do |object, (key, value)|
|
|
15
15
|
object[key] = Size.new(value)
|
|
16
16
|
object
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
memoize :sizes
|
|
20
|
-
|
|
21
20
|
end
|
|
22
21
|
end
|
|
23
22
|
end
|
|
@@ -3,19 +3,15 @@ require 'twitter/media/photo'
|
|
|
3
3
|
|
|
4
4
|
module Twitter
|
|
5
5
|
class MediaFactory < Twitter::Factory
|
|
6
|
-
|
|
7
6
|
class << self
|
|
8
|
-
|
|
9
7
|
# Construct a new media object
|
|
10
8
|
#
|
|
11
9
|
# @param attrs [Hash]
|
|
12
10
|
# @raise [IndexError] Error raised when supplied argument is missing a :type key.
|
|
13
11
|
# @return [Twitter::Media]
|
|
14
|
-
def new(attrs={})
|
|
12
|
+
def new(attrs = {})
|
|
15
13
|
super(:type, Media, attrs)
|
|
16
14
|
end
|
|
17
|
-
|
|
18
15
|
end
|
|
19
|
-
|
|
20
16
|
end
|
|
21
17
|
end
|
data/lib/twitter/null_object.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module Twitter
|
|
2
2
|
class NullObject
|
|
3
|
-
|
|
4
3
|
# @return [TrueClass] This method always returns true.
|
|
5
4
|
def nil?
|
|
6
5
|
true
|
|
@@ -12,14 +11,13 @@ module Twitter
|
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
# @return [TrueClass] This method always returns true.
|
|
15
|
-
def respond_to?(method_name, include_private=false)
|
|
14
|
+
def respond_to?(method_name, include_private = false)
|
|
16
15
|
true
|
|
17
|
-
end if RUBY_VERSION <
|
|
16
|
+
end if RUBY_VERSION < '1.9'
|
|
18
17
|
|
|
19
18
|
# @return [TrueClass] This method always returns true.
|
|
20
|
-
def respond_to_missing?(method_name, include_private=false)
|
|
19
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
21
20
|
true
|
|
22
|
-
end if RUBY_VERSION >=
|
|
23
|
-
|
|
21
|
+
end if RUBY_VERSION >= '1.9'
|
|
24
22
|
end
|
|
25
23
|
end
|
data/lib/twitter/oembed.rb
CHANGED
data/lib/twitter/place.rb
CHANGED
|
@@ -4,10 +4,10 @@ require 'twitter/base'
|
|
|
4
4
|
module Twitter
|
|
5
5
|
class Place < Twitter::Base
|
|
6
6
|
attr_reader :attributes, :country, :full_name, :name, :woeid
|
|
7
|
-
|
|
7
|
+
alias_method :woe_id, :woeid
|
|
8
8
|
object_attr_reader :GeoFactory, :bounding_box
|
|
9
9
|
object_attr_reader :Place, :contained_within
|
|
10
|
-
|
|
10
|
+
alias_method :contained?, :contained_within?
|
|
11
11
|
uri_attr_reader :uri
|
|
12
12
|
|
|
13
13
|
# @param other [Twitter::Place]
|
|
@@ -25,7 +25,7 @@ module Twitter
|
|
|
25
25
|
|
|
26
26
|
# @return [String]
|
|
27
27
|
def country_code
|
|
28
|
-
@attrs[:country_code] || @attrs[:countryCode]
|
|
28
|
+
@attrs[:country_code] || @attrs[:countryCode] # rubocop:disable SymbolName
|
|
29
29
|
end
|
|
30
30
|
memoize :country_code
|
|
31
31
|
|
|
@@ -37,9 +37,8 @@ module Twitter
|
|
|
37
37
|
|
|
38
38
|
# @return [String]
|
|
39
39
|
def place_type
|
|
40
|
-
@attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name]
|
|
40
|
+
@attrs[:place_type] || @attrs[:placeType] && @attrs[:placeType][:name] # rubocop:disable SymbolName
|
|
41
41
|
end
|
|
42
42
|
memoize :place_type
|
|
43
|
-
|
|
44
43
|
end
|
|
45
44
|
end
|
|
@@ -2,17 +2,15 @@ require 'twitter/base'
|
|
|
2
2
|
|
|
3
3
|
module Twitter
|
|
4
4
|
class ProfileBanner < Twitter::Base
|
|
5
|
-
|
|
6
5
|
# Returns an array of photo sizes
|
|
7
6
|
#
|
|
8
7
|
# @return [Array<Twitter::Size>]
|
|
9
8
|
def sizes
|
|
10
|
-
Array(@attrs[:sizes]).
|
|
9
|
+
Array(@attrs[:sizes]).reduce({}) do |object, (key, value)|
|
|
11
10
|
object[key] = Size.new(value)
|
|
12
11
|
object
|
|
13
12
|
end
|
|
14
13
|
end
|
|
15
14
|
memoize :sizes
|
|
16
|
-
|
|
17
15
|
end
|
|
18
16
|
end
|
data/lib/twitter/rate_limit.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
module Twitter
|
|
2
2
|
class RateLimit < Twitter::Base
|
|
3
|
-
|
|
4
3
|
# @return [Integer]
|
|
5
4
|
def limit
|
|
6
5
|
limit = @attrs['x-rate-limit-limit']
|
|
@@ -26,7 +25,6 @@ module Twitter
|
|
|
26
25
|
def reset_in
|
|
27
26
|
[(reset_at - Time.now).ceil, 0].max if reset_at
|
|
28
27
|
end
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
alias_method :retry_after, :reset_in
|
|
31
29
|
end
|
|
32
30
|
end
|