twitter 5.11.0 → 5.12.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 +11 -1
- data/README.md +7 -5
- data/lib/twitter/arguments.rb +1 -0
- data/lib/twitter/base.rb +4 -5
- data/lib/twitter/basic_user.rb +1 -0
- data/lib/twitter/client.rb +10 -9
- data/lib/twitter/configuration.rb +4 -2
- data/lib/twitter/cursor.rb +3 -2
- data/lib/twitter/direct_message.rb +1 -0
- data/lib/twitter/entity.rb +1 -0
- data/lib/twitter/entity/hashtag.rb +1 -0
- data/lib/twitter/entity/symbol.rb +1 -0
- data/lib/twitter/entity/user_mention.rb +4 -1
- data/lib/twitter/error.rb +22 -19
- data/lib/twitter/geo.rb +1 -0
- data/lib/twitter/geo_results.rb +3 -2
- data/lib/twitter/identity.rb +1 -0
- data/lib/twitter/language.rb +1 -0
- data/lib/twitter/list.rb +12 -5
- data/lib/twitter/media/photo.rb +1 -0
- data/lib/twitter/metadata.rb +1 -0
- data/lib/twitter/null_object.rb +22 -0
- data/lib/twitter/oembed.rb +5 -2
- data/lib/twitter/place.rb +4 -1
- data/lib/twitter/profile.rb +1 -1
- data/lib/twitter/rest/client.rb +4 -4
- data/lib/twitter/rest/favorites.rb +4 -3
- data/lib/twitter/rest/lists.rb +18 -3
- data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
- data/lib/twitter/rest/response/parse_json.rb +1 -1
- data/lib/twitter/rest/response/raise_error.rb +4 -5
- data/lib/twitter/rest/tweets.rb +2 -1
- data/lib/twitter/rest/users.rb +10 -7
- data/lib/twitter/saved_search.rb +1 -0
- data/lib/twitter/search_results.rb +3 -2
- data/lib/twitter/settings.rb +7 -3
- data/lib/twitter/size.rb +4 -1
- data/lib/twitter/streaming/deleted_tweet.rb +1 -0
- data/lib/twitter/streaming/event.rb +2 -2
- data/lib/twitter/streaming/message_parser.rb +1 -1
- data/lib/twitter/suggestion.rb +4 -1
- data/lib/twitter/token.rb +1 -0
- data/lib/twitter/trend.rb +1 -0
- data/lib/twitter/trend_results.rb +3 -2
- data/lib/twitter/tweet.rb +9 -6
- data/lib/twitter/user.rb +15 -13
- data/lib/twitter/utils.rb +2 -6
- data/lib/twitter/version.rb +1 -1
- data/twitter.gemspec +6 -9
- metadata +6 -259
- data/Rakefile +0 -37
- data/spec/fixtures/already_favorited.json +0 -1
- data/spec/fixtures/already_posted.json +0 -1
- data/spec/fixtures/already_retweeted.json +0 -1
- data/spec/fixtures/bearer_token.json +0 -1
- data/spec/fixtures/category.json +0 -1
- data/spec/fixtures/configuration.json +0 -1
- data/spec/fixtures/contributees.json +0 -1
- data/spec/fixtures/count.json +0 -1
- data/spec/fixtures/direct_message.json +0 -1
- data/spec/fixtures/direct_messages.json +0 -1
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/followers_list.json +0 -1
- data/spec/fixtures/followers_list2.json +0 -1
- data/spec/fixtures/following.json +0 -1
- data/spec/fixtures/forbidden.json +0 -1
- data/spec/fixtures/friends_list.json +0 -1
- data/spec/fixtures/friends_list2.json +0 -1
- data/spec/fixtures/friendships.json +0 -1
- data/spec/fixtures/ids.json +0 -1
- data/spec/fixtures/ids_list.json +0 -1
- data/spec/fixtures/ids_list2.json +0 -1
- data/spec/fixtures/languages.json +0 -1
- data/spec/fixtures/list.json +0 -1
- data/spec/fixtures/lists.json +0 -1
- data/spec/fixtures/locations.json +0 -1
- data/spec/fixtures/matching_trends.json +0 -1
- data/spec/fixtures/me.jpeg +0 -0
- data/spec/fixtures/members.json +0 -1
- data/spec/fixtures/memberships.json +0 -1
- data/spec/fixtures/memberships2.json +0 -1
- data/spec/fixtures/not_following.json +0 -1
- data/spec/fixtures/not_found.json +0 -1
- data/spec/fixtures/oembed.json +0 -1
- data/spec/fixtures/ownerships.json +0 -1
- data/spec/fixtures/pbjt.gif +0 -0
- data/spec/fixtures/pengwynn.json +0 -1
- data/spec/fixtures/place.json +0 -1
- data/spec/fixtures/places.json +0 -1
- data/spec/fixtures/privacy.json +0 -1
- data/spec/fixtures/profile_banner.json +0 -1
- data/spec/fixtures/request_token.txt +0 -6
- data/spec/fixtures/retweet.json +0 -1
- data/spec/fixtures/retweets.json +0 -1
- data/spec/fixtures/saved_search.json +0 -1
- data/spec/fixtures/saved_searches.json +0 -1
- data/spec/fixtures/search.json +0 -1
- data/spec/fixtures/search2.json +0 -1
- data/spec/fixtures/search_malformed.json +0 -1
- data/spec/fixtures/settings.json +0 -1
- data/spec/fixtures/sferik.json +0 -1
- data/spec/fixtures/status.json +0 -1
- data/spec/fixtures/statuses.json +0 -1
- data/spec/fixtures/subscriptions.json +0 -1
- data/spec/fixtures/subscriptions2.json +0 -1
- data/spec/fixtures/suggestions.json +0 -1
- data/spec/fixtures/tos.json +0 -1
- data/spec/fixtures/track_streaming.json +0 -3
- data/spec/fixtures/track_streaming_user.json +0 -6
- data/spec/fixtures/upload.json +0 -1
- data/spec/fixtures/user_search.json +0 -1
- data/spec/fixtures/user_timeline.json +0 -1
- data/spec/fixtures/users.json +0 -1
- data/spec/fixtures/users_list.json +0 -1
- data/spec/fixtures/users_list2.json +0 -1
- data/spec/fixtures/we_concept_bg2.png +0 -0
- data/spec/fixtures/wildcomet2.jpe +0 -0
- data/spec/helper.rb +0 -68
- data/spec/twitter/base_spec.rb +0 -39
- data/spec/twitter/basic_user_spec.rb +0 -23
- data/spec/twitter/configuration_spec.rb +0 -17
- data/spec/twitter/cursor_spec.rb +0 -30
- data/spec/twitter/direct_message_spec.rb +0 -232
- data/spec/twitter/entity/uri_spec.rb +0 -75
- data/spec/twitter/error_spec.rb +0 -52
- data/spec/twitter/geo/point_spec.rb +0 -41
- data/spec/twitter/geo/polygon_spec.rb +0 -29
- data/spec/twitter/geo_factory_spec.rb +0 -19
- data/spec/twitter/geo_results_spec.rb +0 -35
- data/spec/twitter/geo_spec.rb +0 -29
- data/spec/twitter/identifiable_spec.rb +0 -29
- data/spec/twitter/list_spec.rb +0 -88
- data/spec/twitter/media/photo_spec.rb +0 -151
- data/spec/twitter/media_factory_spec.rb +0 -15
- data/spec/twitter/oembed_spec.rb +0 -170
- data/spec/twitter/place_spec.rb +0 -168
- data/spec/twitter/profile_banner_spec.rb +0 -13
- data/spec/twitter/rate_limit_spec.rb +0 -59
- data/spec/twitter/relationship_spec.rb +0 -49
- data/spec/twitter/rest/client_spec.rb +0 -217
- data/spec/twitter/rest/direct_messages_spec.rb +0 -133
- data/spec/twitter/rest/favorites_spec.rb +0 -188
- data/spec/twitter/rest/friends_and_followers_spec.rb +0 -667
- data/spec/twitter/rest/geo_spec.rb +0 -68
- data/spec/twitter/rest/help_spec.rb +0 -68
- data/spec/twitter/rest/lists_spec.rb +0 -910
- data/spec/twitter/rest/media_spec.rb +0 -54
- data/spec/twitter/rest/oauth_spec.rb +0 -63
- data/spec/twitter/rest/saved_searches_spec.rb +0 -98
- data/spec/twitter/rest/search_spec.rb +0 -42
- data/spec/twitter/rest/spam_reporting_spec.rb +0 -25
- data/spec/twitter/rest/suggested_users_spec.rb +0 -59
- data/spec/twitter/rest/timelines_spec.rb +0 -138
- data/spec/twitter/rest/trends_spec.rb +0 -68
- data/spec/twitter/rest/tweets_spec.rb +0 -614
- data/spec/twitter/rest/undocumented_spec.rb +0 -103
- data/spec/twitter/rest/users_spec.rb +0 -797
- data/spec/twitter/saved_search_spec.rb +0 -45
- data/spec/twitter/search_results_spec.rb +0 -30
- data/spec/twitter/settings_spec.rb +0 -27
- data/spec/twitter/size_spec.rb +0 -28
- data/spec/twitter/source_user_spec.rb +0 -23
- data/spec/twitter/streaming/client_spec.rb +0 -123
- data/spec/twitter/streaming/connection_spec.rb +0 -32
- data/spec/twitter/streaming/deleted_tweet_spec.rb +0 -23
- data/spec/twitter/streaming/event_spec.rb +0 -43
- data/spec/twitter/streaming/friend_list_spec.rb +0 -11
- data/spec/twitter/streaming/message_parser_spec.rb +0 -54
- data/spec/twitter/streaming/response_spec.rb +0 -21
- data/spec/twitter/suggestion_spec.rb +0 -40
- data/spec/twitter/target_user_spec.rb +0 -23
- data/spec/twitter/token_spec.rb +0 -16
- data/spec/twitter/trend_results_spec.rb +0 -89
- data/spec/twitter/trend_spec.rb +0 -51
- data/spec/twitter/tweet_spec.rb +0 -456
- data/spec/twitter/user_spec.rb +0 -447
- data/spec/twitter/utils_spec.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69ccaef447a3e10493acddb98166dad97ec1990b
|
4
|
+
data.tar.gz: ad5737355498861cb59dd1f2e71473ab49e8b410
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1a43cafd0ef568132eef7f2dc1be2f6417424ed8d82445310116c45addb104979f0914f3a95ac45cb05cf67bb5ce5ddd5abd68e1891765155f61ab168be446b
|
7
|
+
data.tar.gz: 765dfdb2699c5e12a1181fe59cda9629d714fd71b0fd7ae89e579a5fe030f31472e71d9be1ab8b6cff4425f47fdc6a8e9e6c64b3bddf9add8e94f56cd63748d6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
5.12.0
|
2
|
+
------
|
3
|
+
* [Rescue `Twitter::Error::NotFound` for safe `#favorite` and `#retweet`](https://github.com/sferik/twitter/commit/5e6223df20217fd6b0ac78b44b0defdb46d1e018)
|
4
|
+
* [Make `Twitter::User#profile_background_image_uri` methods return a URI](https://github.com/sferik/twitter/commit/d96194c0c3b17076e48faed1b05cd48d043a6778)
|
5
|
+
* [Un-deprecate `Twitter::Base#to_hash`](https://github.com/sferik/twitter/commit/f45ce597408ab2bae2b55db6456543bf6d9ea081)
|
6
|
+
* [Add `Twitter::Tweet#possibly_sensitive?`](https://github.com/sferik/twitter/commit/917e8f14f7707eb646e8057827ed0ba9d1766eeb)
|
7
|
+
* [Namespace registered Faraday middleware](https://github.com/sferik/twitter/commit/a96931171e32c142f36318547f2cffa6ccd5c199) ([@godfoca](https://twitter.com/godfoca))
|
8
|
+
* [Fix test failures on Ruby 2.2.0-preview1](https://github.com/sferik/twitter/commit/74fb2e676f5882c62a6d4f07d7bbf8ca1f469fe2)
|
9
|
+
* [Make Twitter::NullObject Comparable](https://github.com/sferik/twitter/commit/9635db5128708525f3368800f11c519d6b14b1e4)
|
10
|
+
|
1
11
|
5.11.0
|
2
12
|
------
|
3
13
|
* [Return a Twitter::NullObject for empty attributes](https://github.com/sferik/twitter/commit/bca179eefb1c157f19b882a88ba608f6817b76bb)
|
@@ -54,7 +64,7 @@
|
|
54
64
|
* [Remove unused methods `#put` and `#delete` in `Twitter::REST::Client`](https://github.com/sferik/twitter/commit/eaaf234b84a6e2e1f7695f73befaf11f30664f4a)
|
55
65
|
* [Deprecate `retweeters_count` in favor of `retweet_count`](https://github.com/sferik/twitter/commit/ea39bd013364dc24f02e9a1eb25b4b48b99a5480)
|
56
66
|
* [Deprecate `favorites_count`/`favoriters_count` in favor of `favorite_count`](https://github.com/sferik/twitter/commit/ea39bd013364dc24f02e9a1eb25b4b48b99a5480)
|
57
|
-
* [Deprecate `
|
67
|
+
* [Deprecate `to_hsh` in favor of `to_hash` or `attrs`](https://github.com/sferik/twitter/commit/63e2cdd693aece2912564988d06786cd23a2cad5)
|
58
68
|
* [Deprecate `oauth_token` and `oauth_token_secret` accessors](https://github.com/sferik/twitter/commit/ac246717557ea02565a1d93b3f9a975e7fd39874)
|
59
69
|
|
60
70
|
5.5.1
|
data/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
[![Dependency Status](http://img.shields.io/gemnasium/sferik/twitter.svg)][gemnasium]
|
6
6
|
[![Code Climate](http://img.shields.io/codeclimate/github/sferik/twitter.svg)][codeclimate]
|
7
7
|
[![Coverage Status](http://img.shields.io/coveralls/sferik/twitter.svg)][coveralls]
|
8
|
-
[![Gittip](http://img.shields.io/gittip/gems.svg)][gittip]
|
9
8
|
[![Inline docs](http://inch-ci.org/github/sferik/twitter.png)][inchpages]
|
10
9
|
|
11
10
|
[gem]: https://rubygems.org/gems/twitter
|
@@ -13,7 +12,6 @@
|
|
13
12
|
[gemnasium]: https://gemnasium.com/sferik/twitter
|
14
13
|
[codeclimate]: https://codeclimate.com/github/sferik/twitter
|
15
14
|
[coveralls]: https://coveralls.io/r/sferik/twitter
|
16
|
-
[gittip]: https://www.gittip.com/gems/
|
17
15
|
[inchpages]: http://inch-ci.org/github/sferik/twitter
|
18
16
|
|
19
17
|
A Ruby interface to the Twitter API.
|
@@ -195,7 +193,7 @@ simplicity and performance.
|
|
195
193
|
</tr>
|
196
194
|
<tr>
|
197
195
|
<td>
|
198
|
-
Return your most recent
|
196
|
+
Return your most recent friend.
|
199
197
|
</td>
|
200
198
|
<td>
|
201
199
|
<pre><code>client.friends.users.first</code></pre>
|
@@ -460,6 +458,10 @@ After configuration, requests can be made like so:
|
|
460
458
|
client.update("I'm tweeting with @gem!")
|
461
459
|
```
|
462
460
|
|
461
|
+
**Performance/DNS settings issue**
|
462
|
+
|
463
|
+
When you are using the gem in production (running for example in a DigitalOcean VPS) be aware that DNS settings on the server can affect outbound traffic performance with `Twitter::Error::RequestTimeout` as a result. Don't use the public Google DNS services (4.4.4.4 / 8.8.8.8) they are rate-limited and have very bad response times. Use a DNS service close to your data-center.
|
464
|
+
|
463
465
|
## Usage Examples
|
464
466
|
All examples require an authenticated Twitter client. See the section on <a
|
465
467
|
href="#configuration">configuration</a>.
|
@@ -555,10 +557,10 @@ This library aims to support and is [tested against][travis] the following Ruby
|
|
555
557
|
versions:
|
556
558
|
|
557
559
|
* Ruby 1.8.7
|
558
|
-
* Ruby 1.9.2
|
559
560
|
* Ruby 1.9.3
|
560
561
|
* Ruby 2.0.0
|
561
|
-
* Ruby 2.1
|
562
|
+
* Ruby 2.1
|
563
|
+
* JRuby 1.7 (Both 1.9 mode and 1.8 mode)
|
562
564
|
|
563
565
|
If something doesn't work on one of these versions, it's a bug.
|
564
566
|
|
data/lib/twitter/arguments.rb
CHANGED
data/lib/twitter/base.rb
CHANGED
@@ -9,10 +9,11 @@ module Twitter
|
|
9
9
|
extend Forwardable
|
10
10
|
include Memoizable
|
11
11
|
include Twitter::Utils
|
12
|
+
# @return [Hash]
|
12
13
|
attr_reader :attrs
|
13
14
|
alias_method :to_h, :attrs
|
14
|
-
|
15
|
-
deprecate_alias :to_hsh, :
|
15
|
+
alias_method :to_hash, :to_h
|
16
|
+
deprecate_alias :to_hsh, :to_hash
|
16
17
|
|
17
18
|
class << self
|
18
19
|
# Define methods that retrieve the value from attributes
|
@@ -72,7 +73,7 @@ module Twitter
|
|
72
73
|
# @param key2 [Symbol]
|
73
74
|
def define_uri_method(key1, key2)
|
74
75
|
define_method(key1) do ||
|
75
|
-
Addressable::URI.parse(@attrs[key2]) unless @attrs[key2].nil?
|
76
|
+
Addressable::URI.parse(@attrs[key2].chomp('#')) unless @attrs[key2].nil?
|
76
77
|
end
|
77
78
|
memoize(key1)
|
78
79
|
end
|
@@ -98,8 +99,6 @@ module Twitter
|
|
98
99
|
memoize(key1)
|
99
100
|
end
|
100
101
|
|
101
|
-
# Dynamically define a method for an attribute
|
102
|
-
#
|
103
102
|
# @param key [Symbol]
|
104
103
|
def deprecate_attribute_method(key)
|
105
104
|
define_method(key) do ||
|
data/lib/twitter/basic_user.rb
CHANGED
data/lib/twitter/client.rb
CHANGED
@@ -20,7 +20,7 @@ module Twitter
|
|
20
20
|
# @return [Twitter::Client]
|
21
21
|
def initialize(options = {})
|
22
22
|
options.each do |key, value|
|
23
|
-
|
23
|
+
instance_variable_set("@#{key}", value)
|
24
24
|
end
|
25
25
|
yield(self) if block_given?
|
26
26
|
validate_credential_type!
|
@@ -39,10 +39,11 @@ module Twitter
|
|
39
39
|
# @return [Hash]
|
40
40
|
def credentials
|
41
41
|
{
|
42
|
-
:consumer_key
|
43
|
-
:consumer_secret
|
44
|
-
:token
|
45
|
-
:token_secret
|
42
|
+
:consumer_key => consumer_key,
|
43
|
+
:consumer_secret => consumer_secret,
|
44
|
+
:token => access_token,
|
45
|
+
:token_secret => access_token_secret,
|
46
|
+
:ignore_extra_keys => true,
|
46
47
|
}
|
47
48
|
end
|
48
49
|
|
@@ -54,14 +55,14 @@ module Twitter
|
|
54
55
|
private
|
55
56
|
|
56
57
|
# Ensures that all credentials set during configuration are of a
|
57
|
-
# valid type. Valid types are String and
|
58
|
+
# valid type. Valid types are String and Boolean.
|
58
59
|
#
|
59
60
|
# @raise [Twitter::Error::ConfigurationError] Error is raised when
|
60
|
-
# supplied twitter credentials are not a String or
|
61
|
+
# supplied twitter credentials are not a String or Boolean.
|
61
62
|
def validate_credential_type!
|
62
63
|
credentials.each do |credential, value|
|
63
|
-
next if value.nil?
|
64
|
-
fail(Twitter::Error::ConfigurationError.new("Invalid #{credential} specified: #{value.inspect} must be a string
|
64
|
+
next if value.nil? || value == true || value == false || value.is_a?(String)
|
65
|
+
fail(Twitter::Error::ConfigurationError.new("Invalid #{credential} specified: #{value.inspect} must be a string."))
|
65
66
|
end
|
66
67
|
end
|
67
68
|
|
@@ -2,9 +2,11 @@ require 'twitter/base'
|
|
2
2
|
|
3
3
|
module Twitter
|
4
4
|
class Configuration < Twitter::Base
|
5
|
+
# @return [Array<String>]
|
6
|
+
attr_reader :non_username_paths
|
7
|
+
# @return [Integer]
|
5
8
|
attr_reader :characters_reserved_per_media, :max_media_per_upload,
|
6
|
-
:
|
7
|
-
:short_url_length_https
|
9
|
+
:photo_size_limit, :short_url_length, :short_url_length_https
|
8
10
|
alias_method :short_uri_length, :short_url_length
|
9
11
|
alias_method :short_uri_length_https, :short_url_length_https
|
10
12
|
|
data/lib/twitter/cursor.rb
CHANGED
@@ -5,10 +5,11 @@ module Twitter
|
|
5
5
|
class Cursor
|
6
6
|
include Twitter::Enumerable
|
7
7
|
include Twitter::Utils
|
8
|
+
# @return [Hash]
|
8
9
|
attr_reader :attrs
|
9
10
|
alias_method :to_h, :attrs
|
10
|
-
|
11
|
-
deprecate_alias :to_hsh, :
|
11
|
+
alias_method :to_hash, :to_h
|
12
|
+
deprecate_alias :to_hsh, :to_hash
|
12
13
|
|
13
14
|
# Initializes a new Cursor
|
14
15
|
#
|
data/lib/twitter/entity.rb
CHANGED
data/lib/twitter/error.rb
CHANGED
@@ -3,7 +3,10 @@ require 'twitter/rate_limit'
|
|
3
3
|
module Twitter
|
4
4
|
# Custom error class for rescuing from all Twitter errors
|
5
5
|
class Error < StandardError
|
6
|
-
|
6
|
+
# @return [Integer]
|
7
|
+
attr_reader :code
|
8
|
+
# @return [Twitter::RateLimit]
|
9
|
+
attr_reader :rate_limit
|
7
10
|
|
8
11
|
# If error code is missing see https://dev.twitter.com/docs/error-codes-responses
|
9
12
|
module Code
|
@@ -101,7 +104,7 @@ module Twitter
|
|
101
104
|
@code = code
|
102
105
|
end
|
103
106
|
|
104
|
-
|
107
|
+
ConfigurationError = Class.new(::ArgumentError)
|
105
108
|
|
106
109
|
# Raised when a Tweet includes media that doesn't have a to_io method
|
107
110
|
class UnacceptableIO < StandardError
|
@@ -111,57 +114,57 @@ module Twitter
|
|
111
114
|
end
|
112
115
|
|
113
116
|
# Raised when Twitter returns a 4xx HTTP status code
|
114
|
-
|
117
|
+
ClientError = Class.new(self)
|
115
118
|
|
116
119
|
# Raised when Twitter returns the HTTP status code 400
|
117
|
-
|
120
|
+
BadRequest = Class.new(ClientError)
|
118
121
|
|
119
122
|
# Raised when Twitter returns the HTTP status code 401
|
120
|
-
|
123
|
+
Unauthorized = Class.new(ClientError)
|
121
124
|
|
122
125
|
# Raised when Twitter returns the HTTP status code 403
|
123
|
-
|
126
|
+
Forbidden = Class.new(ClientError)
|
124
127
|
|
125
128
|
# Raised when a Tweet has already been favorited
|
126
|
-
|
129
|
+
AlreadyFavorited = Class.new(Forbidden)
|
127
130
|
|
128
131
|
# Raised when a Tweet has already been retweeted
|
129
|
-
|
132
|
+
AlreadyRetweeted = Class.new(Forbidden)
|
130
133
|
|
131
134
|
# Raised when a Tweet has already been posted
|
132
|
-
|
135
|
+
DuplicateStatus = Class.new(Forbidden)
|
133
136
|
AlreadyPosted = DuplicateStatus # rubocop:disable ConstantName
|
134
137
|
|
135
138
|
# Raised when Twitter returns the HTTP status code 404
|
136
|
-
|
139
|
+
NotFound = Class.new(ClientError)
|
137
140
|
|
138
141
|
# Raised when Twitter returns the HTTP status code 406
|
139
|
-
|
142
|
+
NotAcceptable = Class.new(ClientError)
|
140
143
|
|
141
144
|
# Raised when Twitter returns the HTTP status code 408
|
142
|
-
|
145
|
+
RequestTimeout = Class.new(ClientError)
|
143
146
|
|
144
147
|
# Raised when Twitter returns the HTTP status code 422
|
145
|
-
|
148
|
+
UnprocessableEntity = Class.new(ClientError)
|
146
149
|
|
147
150
|
# Raised when Twitter returns the HTTP status code 429
|
148
|
-
|
151
|
+
TooManyRequests = Class.new(ClientError)
|
149
152
|
EnhanceYourCalm = TooManyRequests # rubocop:disable ConstantName
|
150
153
|
RateLimited = TooManyRequests # rubocop:disable ConstantName
|
151
154
|
|
152
155
|
# Raised when Twitter returns a 5xx HTTP status code
|
153
|
-
|
156
|
+
ServerError = Class.new(self)
|
154
157
|
|
155
158
|
# Raised when Twitter returns the HTTP status code 500
|
156
|
-
|
159
|
+
InternalServerError = Class.new(ServerError)
|
157
160
|
|
158
161
|
# Raised when Twitter returns the HTTP status code 502
|
159
|
-
|
162
|
+
BadGateway = Class.new(ServerError)
|
160
163
|
|
161
164
|
# Raised when Twitter returns the HTTP status code 503
|
162
|
-
|
165
|
+
ServiceUnavailable = Class.new(ServerError)
|
163
166
|
|
164
167
|
# Raised when Twitter returns the HTTP status code 504
|
165
|
-
|
168
|
+
GatewayTimeout = Class.new(ServerError)
|
166
169
|
end
|
167
170
|
end
|
data/lib/twitter/geo.rb
CHANGED
data/lib/twitter/geo_results.rb
CHANGED
@@ -5,10 +5,11 @@ module Twitter
|
|
5
5
|
class GeoResults
|
6
6
|
include Twitter::Enumerable
|
7
7
|
include Twitter::Utils
|
8
|
+
# @return [Hash]
|
8
9
|
attr_reader :attrs
|
9
10
|
alias_method :to_h, :attrs
|
10
|
-
|
11
|
-
deprecate_alias :to_hsh, :
|
11
|
+
alias_method :to_hash, :to_h
|
12
|
+
deprecate_alias :to_hsh, :to_hash
|
12
13
|
|
13
14
|
# Initializes a new GeoResults object
|
14
15
|
#
|
data/lib/twitter/identity.rb
CHANGED
data/lib/twitter/language.rb
CHANGED
data/lib/twitter/list.rb
CHANGED
@@ -4,30 +4,37 @@ require 'twitter/identity'
|
|
4
4
|
module Twitter
|
5
5
|
class List < Twitter::Identity
|
6
6
|
include Twitter::Creatable
|
7
|
-
|
8
|
-
|
7
|
+
# @return [Integer]
|
8
|
+
attr_reader :member_count, :subscriber_count
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :description, :full_name, :mode, :name, :slug
|
9
11
|
object_attr_reader :User, :user
|
10
12
|
predicate_attr_reader :following
|
11
13
|
|
12
14
|
# @return [Addressable::URI] The URI to the list members.
|
13
15
|
def members_uri
|
14
|
-
Addressable::URI.parse("
|
16
|
+
Addressable::URI.parse("#{uri}/members") if uri?
|
15
17
|
end
|
16
18
|
memoize :members_uri
|
17
19
|
alias_method :members_url, :members_uri
|
18
20
|
|
19
21
|
# @return [Addressable::URI] The URI to the list subscribers.
|
20
22
|
def subscribers_uri
|
21
|
-
Addressable::URI.parse("
|
23
|
+
Addressable::URI.parse("#{uri}/subscribers") if uri?
|
22
24
|
end
|
23
25
|
memoize :subscribers_uri
|
24
26
|
alias_method :subscribers_url, :subscribers_uri
|
25
27
|
|
26
28
|
# @return [Addressable::URI] The URI to the list.
|
27
29
|
def uri
|
28
|
-
Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}")
|
30
|
+
Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}") if slug? && user.screen_name?
|
29
31
|
end
|
30
32
|
memoize :uri
|
31
33
|
alias_method :url, :uri
|
34
|
+
|
35
|
+
def uri?
|
36
|
+
!!uri
|
37
|
+
end
|
38
|
+
memoize :uri?
|
32
39
|
end
|
33
40
|
end
|
data/lib/twitter/media/photo.rb
CHANGED