twitter 5.15.0 → 5.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -7
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE.md +1 -1
  4. data/README.md +1 -1
  5. data/lib/twitter/base.rb +6 -8
  6. data/lib/twitter/configuration.rb +2 -2
  7. data/lib/twitter/cursor.rb +3 -3
  8. data/lib/twitter/direct_message.rb +1 -1
  9. data/lib/twitter/entities.rb +2 -2
  10. data/lib/twitter/geo.rb +1 -1
  11. data/lib/twitter/geo/point.rb +3 -3
  12. data/lib/twitter/geo_results.rb +2 -2
  13. data/lib/twitter/list.rb +3 -3
  14. data/lib/twitter/place.rb +3 -3
  15. data/lib/twitter/profile.rb +10 -10
  16. data/lib/twitter/rate_limit.rb +1 -1
  17. data/lib/twitter/rest/client.rb +1 -1
  18. data/lib/twitter/rest/direct_messages.rb +3 -3
  19. data/lib/twitter/rest/favorites.rb +6 -6
  20. data/lib/twitter/rest/friends_and_followers.rb +7 -7
  21. data/lib/twitter/rest/lists.rb +2 -2
  22. data/lib/twitter/rest/media.rb +1 -1
  23. data/lib/twitter/rest/oauth.rb +1 -1
  24. data/lib/twitter/rest/places_and_geo.rb +2 -2
  25. data/lib/twitter/rest/request.rb +1 -1
  26. data/lib/twitter/rest/request/multipart_with_file.rb +1 -1
  27. data/lib/twitter/rest/timelines.rb +2 -2
  28. data/lib/twitter/rest/trends.rb +4 -4
  29. data/lib/twitter/rest/tweets.rb +1 -1
  30. data/lib/twitter/rest/users.rb +1 -1
  31. data/lib/twitter/rest/utils.rb +3 -7
  32. data/lib/twitter/search_results.rb +2 -2
  33. data/lib/twitter/settings.rb +10 -3
  34. data/lib/twitter/size.rb +2 -2
  35. data/lib/twitter/streaming/client.rb +1 -1
  36. data/lib/twitter/streaming/connection.rb +1 -1
  37. data/lib/twitter/streaming/event.rb +2 -2
  38. data/lib/twitter/token.rb +2 -2
  39. data/lib/twitter/trend.rb +1 -1
  40. data/lib/twitter/trend_results.rb +2 -2
  41. data/lib/twitter/tweet.rb +9 -9
  42. data/lib/twitter/user.rb +6 -6
  43. data/lib/twitter/version.rb +2 -2
  44. data/twitter.gemspec +1 -1
  45. metadata +135 -101
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 798135ed73e54bd85e71fc19b5dd62424f899b69
4
- data.tar.gz: d46da3dca80843f6493df263bf623c7041091f0c
5
- SHA512:
6
- metadata.gz: dc3cea1cee6614e6fd72743526d9e3fe9396ae5fbd76e137281016a724df298ee142b06b9aac9f3ea010c123c70708515ddd1c4ce6754087326eb7fb7108c8b6
7
- data.tar.gz: 09b7ce668855fa4171208d3c19b5599b19e990a9b59e9a0b789a905a0651bceedd7177fc6be12f82bea72270ddf7f2df67acc6692d41283b855abc16e71d5b0c
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c196f0dcc5339f83bec5f1ee333691352550d30a
4
+ data.tar.gz: 82960f248de8016773dc44fc0f90144e27f5c1ff
5
+ SHA512:
6
+ metadata.gz: 075f2d6c0b5f09a207f87e9d7dd45ecae57b949a2a9519cf4ba6db4d7db21215b68260d43d11b428029dda86259bb238318ee6529bf66597f702324903a29c60
7
+ data.tar.gz: 126dbaf92971a634d7b7d8875eae3d3fe5eac79e553dcab18308e7988d4242ea14c81a8362ee2505bbd5244e7dc1bef170023332f44115958acd27f31b2b9564
@@ -1,3 +1,10 @@
1
+ 5.16.0
2
+ ------
3
+ * [Add new settings to `Twitter::Settings`](https://github.com/sferik/twitter/commit/d047ce00034d26a99927076c28679ce08fd69308)
4
+ * [Add `Twitter::Trend#tweet_volume`](https://github.com/sferik/twitter/commit/e797b62e5e6a768e8aeafde6186e1f5310e6bfc6)
5
+ * [Remove the encoding of profile urls](https://github.com/sferik/twitter/commit/6d46bd689ab4a4f119d1d692488aab37e4e99893) ([@TimHaines](https://twitter.com/TimHaines))
6
+ * [Fix issue with port number in streaming connection](https://github.com/sferik/twitter/issues/709)
7
+
1
8
  5.15.0
2
9
  ------
3
10
  * [`NullObject#as_json` returns 'null'](https://github.com/sferik/twitter/commit/2979e703c09a45f012cb2c5b2d6663bf1f4d3351) ([@lukevmorris](https://twitter.com/lukevmorris))
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2015 Erik Michaels-Ober, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco
1
+ Copyright (c) 2006-2016 Erik Michaels-Ober, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -592,7 +592,7 @@ Constraint][pvc] with two digits of precision. For example:
592
592
  [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
593
593
 
594
594
  ## Copyright
595
- Copyright (c) 2006-2015 Erik Michaels-Ober, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco.
595
+ Copyright (c) 2006-2016 Erik Michaels-Ober, John Nunemaker, Wynn Netherland, Steve Richert, Steve Agalloco.
596
596
  See [LICENSE][] for details.
597
597
 
598
598
  [license]: LICENSE.md
@@ -11,8 +11,8 @@ module Twitter
11
11
  include Twitter::Utils
12
12
  # @return [Hash]
13
13
  attr_reader :attrs
14
- alias_method :to_h, :attrs
15
- alias_method :to_hash, :to_h
14
+ alias to_h attrs
15
+ alias to_hash to_h
16
16
  deprecate_alias :to_hsh, :to_hash
17
17
 
18
18
  class << self
@@ -87,13 +87,11 @@ module Twitter
87
87
  define_method(key1) do ||
88
88
  if attr_falsey_or_empty?(key1)
89
89
  NullObject.new
90
+ elsif klass.nil?
91
+ @attrs[key1]
90
92
  else
91
- if klass.nil?
92
- @attrs[key1]
93
- else
94
- attrs = attrs_for_object(key1, key2)
95
- Twitter.const_get(klass).new(attrs)
96
- end
93
+ attrs = attrs_for_object(key1, key2)
94
+ Twitter.const_get(klass).new(attrs)
97
95
  end
98
96
  end
99
97
  memoize(key1)
@@ -10,8 +10,8 @@ module Twitter
10
10
  # @return [Integer]
11
11
  attr_reader :characters_reserved_per_media, :max_media_per_upload,
12
12
  :photo_size_limit, :short_url_length, :short_url_length_https
13
- alias_method :short_uri_length, :short_url_length
14
- alias_method :short_uri_length_https, :short_url_length_https
13
+ alias short_uri_length short_url_length
14
+ alias short_uri_length_https short_url_length_https
15
15
 
16
16
  # Returns an array of photo sizes
17
17
  #
@@ -8,8 +8,8 @@ module Twitter
8
8
  include Twitter::Utils
9
9
  # @return [Hash]
10
10
  attr_reader :attrs
11
- alias_method :to_h, :attrs
12
- alias_method :to_hash, :to_h
11
+ alias to_h attrs
12
+ alias to_hash to_h
13
13
  deprecate_alias :to_hsh, :to_hash
14
14
 
15
15
  # Initializes a new Cursor
@@ -35,7 +35,7 @@ module Twitter
35
35
  def next_cursor
36
36
  @attrs[:next_cursor] || -1
37
37
  end
38
- alias_method :next, :next_cursor
38
+ alias next next_cursor
39
39
 
40
40
  # @return [Boolean]
41
41
  def last?
@@ -8,7 +8,7 @@ module Twitter
8
8
  include Twitter::Entities
9
9
  # @return [String]
10
10
  attr_reader :text
11
- alias_method :full_text, :text
11
+ alias full_text text
12
12
  object_attr_reader :User, :recipient
13
13
  object_attr_reader :User, :sender
14
14
  end
@@ -61,13 +61,13 @@ module Twitter
61
61
  entities(Entity::URI, :urls)
62
62
  end
63
63
  memoize :uris
64
- alias_method :urls, :uris
64
+ alias urls uris
65
65
 
66
66
  # @return [Boolean]
67
67
  def uris?
68
68
  uris.any?
69
69
  end
70
- alias_method :urls?, :uris?
70
+ alias urls? uris?
71
71
 
72
72
  # @note Must include entities in your request for this method to work
73
73
  # @return [Array<Twitter::Entity::UserMention>]
@@ -6,6 +6,6 @@ module Twitter
6
6
  include Equalizer.new(:coordinates)
7
7
  # @return [Array<Float>]
8
8
  attr_reader :coordinates
9
- alias_method :coords, :coordinates
9
+ alias coords coordinates
10
10
  end
11
11
  end
@@ -7,14 +7,14 @@ module Twitter
7
7
  def latitude
8
8
  coordinates[0]
9
9
  end
10
- alias_method :lat, :latitude
10
+ alias lat latitude
11
11
 
12
12
  # @return [Integer]
13
13
  def longitude
14
14
  coordinates[1]
15
15
  end
16
- alias_method :long, :longitude
17
- alias_method :lng, :longitude
16
+ alias long longitude
17
+ alias lng longitude
18
18
  end
19
19
  end
20
20
  end
@@ -7,8 +7,8 @@ module Twitter
7
7
  include Twitter::Utils
8
8
  # @return [Hash]
9
9
  attr_reader :attrs
10
- alias_method :to_h, :attrs
11
- alias_method :to_hash, :to_h
10
+ alias to_h attrs
11
+ alias to_hash to_h
12
12
  deprecate_alias :to_hsh, :to_hash
13
13
 
14
14
  # Initializes a new GeoResults object
@@ -16,21 +16,21 @@ module Twitter
16
16
  Addressable::URI.parse("#{uri}/members") if uri?
17
17
  end
18
18
  memoize :members_uri
19
- alias_method :members_url, :members_uri
19
+ alias members_url members_uri
20
20
 
21
21
  # @return [Addressable::URI] The URI to the list subscribers.
22
22
  def subscribers_uri
23
23
  Addressable::URI.parse("#{uri}/subscribers") if uri?
24
24
  end
25
25
  memoize :subscribers_uri
26
- alias_method :subscribers_url, :subscribers_uri
26
+ alias subscribers_url subscribers_uri
27
27
 
28
28
  # @return [Addressable::URI] The URI to the list.
29
29
  def uri
30
30
  Addressable::URI.parse("https://twitter.com/#{user.screen_name}/#{slug}") if slug? && user.screen_name?
31
31
  end
32
32
  memoize :uri
33
- alias_method :url, :uri
33
+ alias url uri
34
34
 
35
35
  def uri?
36
36
  !!uri
@@ -9,11 +9,11 @@ module Twitter
9
9
  attr_reader :attributes
10
10
  # @return [String]
11
11
  attr_reader :country, :full_name, :name
12
- alias_method :woe_id, :id
13
- alias_method :woeid, :id
12
+ alias woe_id id
13
+ alias woeid id
14
14
  object_attr_reader :GeoFactory, :bounding_box
15
15
  object_attr_reader :Place, :contained_within
16
- alias_method :contained?, :contained_within?
16
+ alias contained? contained_within?
17
17
  uri_attr_reader :uri
18
18
 
19
19
  # Initializes a new place
@@ -26,18 +26,18 @@ module Twitter
26
26
  # @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
27
27
  # @return [Addressable::URI]
28
28
  def profile_banner_uri(size = :web)
29
- parse_encoded_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) unless @attrs[:profile_banner_url].nil?
29
+ parse_uri(insecure_uri([@attrs[:profile_banner_url], size].join('/'))) unless @attrs[:profile_banner_url].nil?
30
30
  end
31
- alias_method :profile_banner_url, :profile_banner_uri
31
+ alias profile_banner_url profile_banner_uri
32
32
 
33
33
  # Return the secure URL to the user's profile banner image
34
34
  #
35
35
  # @param size [String, Symbol] The size of the image. Must be one of: 'mobile', 'mobile_retina', 'web', 'web_retina', 'ipad', or 'ipad_retina'
36
36
  # @return [Addressable::URI]
37
37
  def profile_banner_uri_https(size = :web)
38
- parse_encoded_uri([@attrs[:profile_banner_url], size].join('/')) unless @attrs[:profile_banner_url].nil?
38
+ parse_uri([@attrs[:profile_banner_url], size].join('/')) unless @attrs[:profile_banner_url].nil?
39
39
  end
40
- alias_method :profile_banner_url_https, :profile_banner_uri_https
40
+ alias profile_banner_url_https profile_banner_uri_https
41
41
 
42
42
  # @return [Boolean]
43
43
  def profile_banner_uri?
@@ -51,9 +51,9 @@ module Twitter
51
51
  # @param size [String, Symbol] The size of the image. Must be one of: 'mini', 'normal', 'bigger' or 'original'
52
52
  # @return [Addressable::URI]
53
53
  def profile_image_uri(size = :normal)
54
- parse_encoded_uri(insecure_uri(profile_image_uri_https(size))) unless @attrs[:profile_image_url_https].nil?
54
+ parse_uri(insecure_uri(profile_image_uri_https(size))) unless @attrs[:profile_image_url_https].nil?
55
55
  end
56
- alias_method :profile_image_url, :profile_image_uri
56
+ alias profile_image_url profile_image_uri
57
57
 
58
58
  # Return the secure URL to the user's profile image
59
59
  #
@@ -66,9 +66,9 @@ module Twitter
66
66
  # https://a0.twimg.com/profile_images/1759857427/image1326743606.png
67
67
  # https://a0.twimg.com/profile_images/1759857427/image1326743606_mini.png
68
68
  # https://a0.twimg.com/profile_images/1759857427/image1326743606_bigger.png
69
- parse_encoded_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) unless @attrs[:profile_image_url_https].nil?
69
+ parse_uri(@attrs[:profile_image_url_https].sub(PROFILE_IMAGE_SUFFIX_REGEX, profile_image_suffix(size))) unless @attrs[:profile_image_url_https].nil?
70
70
  end
71
- alias_method :profile_image_url_https, :profile_image_uri_https
71
+ alias profile_image_url_https profile_image_uri_https
72
72
 
73
73
  # @return [Boolean]
74
74
  def profile_image_uri?
@@ -79,8 +79,8 @@ module Twitter
79
79
 
80
80
  private
81
81
 
82
- def parse_encoded_uri(uri)
83
- Addressable::URI.parse(URI.encode(uri))
82
+ def parse_uri(uri)
83
+ Addressable::URI.parse(uri)
84
84
  end
85
85
 
86
86
  def insecure_uri(uri)
@@ -29,6 +29,6 @@ module Twitter
29
29
  def reset_in
30
30
  [(reset_at - Time.now).ceil, 0].max if reset_at
31
31
  end
32
- alias_method :retry_after, :reset_in
32
+ alias retry_after reset_in
33
33
  end
34
34
  end
@@ -12,7 +12,7 @@ module Twitter
12
12
  module REST
13
13
  class Client < Twitter::Client
14
14
  include Twitter::REST::API
15
- BASE_URL = 'https://api.twitter.com'
15
+ BASE_URL = 'https://api.twitter.com'.freeze
16
16
  URL_PREFIX = BASE_URL
17
17
  ENDPOINT = BASE_URL
18
18
  attr_accessor :bearer_token
@@ -128,9 +128,9 @@ module Twitter
128
128
  options[:text] = text
129
129
  perform_post_with_object('/1.1/direct_messages/new.json', options, Twitter::DirectMessage)
130
130
  end
131
- alias_method :d, :create_direct_message
132
- alias_method :m, :create_direct_message
133
- alias_method :dm, :create_direct_message
131
+ alias d create_direct_message
132
+ alias m create_direct_message
133
+ alias dm create_direct_message
134
134
  deprecate_alias :direct_message_create, :create_direct_message
135
135
  end
136
136
  end
@@ -50,7 +50,7 @@ module Twitter
50
50
  def unfavorite(*args)
51
51
  parallel_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
52
52
  end
53
- alias_method :destroy_favorite, :unfavorite
53
+ alias destroy_favorite unfavorite
54
54
  deprecate_alias :favorite_destroy, :unfavorite
55
55
 
56
56
  # Favorites the specified Tweets as the authenticating user
@@ -75,8 +75,8 @@ module Twitter
75
75
  end
76
76
  end.compact
77
77
  end
78
- alias_method :fav, :favorite
79
- alias_method :fave, :favorite
78
+ alias fav favorite
79
+ alias fave favorite
80
80
  deprecate_alias :favorite_create, :favorite
81
81
 
82
82
  # Favorites the specified Tweets as the authenticating user and raises an error if one has already been favorited
@@ -99,9 +99,9 @@ module Twitter
99
99
  perform_post_with_object('/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
100
100
  end
101
101
  end
102
- alias_method :create_favorite!, :favorite!
103
- alias_method :fav!, :favorite!
104
- alias_method :fave!, :favorite!
102
+ alias create_favorite! favorite!
103
+ alias fav! favorite!
104
+ alias fave! favorite!
105
105
  deprecate_alias :favorite_create!, :favorite!
106
106
  end
107
107
  end
@@ -113,7 +113,7 @@ module Twitter
113
113
  end
114
114
  follow!(new_friends.value - existing_friends.value, arguments.options)
115
115
  end
116
- alias_method :create_friendship, :follow
116
+ alias create_friendship follow
117
117
  deprecate_alias :friendship_create, :follow
118
118
 
119
119
  # Allows the authenticating user to follow the specified users
@@ -135,7 +135,7 @@ module Twitter
135
135
  perform_post_with_object('/1.1/friendships/create.json', merge_user(arguments.options, user), Twitter::User)
136
136
  end.compact
137
137
  end
138
- alias_method :create_friendship!, :follow!
138
+ alias create_friendship! follow!
139
139
  deprecate_alias :friendship_create!, :follow!
140
140
 
141
141
  # Allows the authenticating user to unfollow the specified users
@@ -153,7 +153,7 @@ module Twitter
153
153
  def unfollow(*args)
154
154
  parallel_users_from_response(:post, '/1.1/friendships/destroy.json', args)
155
155
  end
156
- alias_method :destroy_friendship, :unfollow
156
+ alias destroy_friendship unfollow
157
157
  deprecate_alias :friendship_destroy, :unfollow
158
158
 
159
159
  # Allows one to enable or disable retweets and device notifications from the specified user.
@@ -189,8 +189,8 @@ module Twitter
189
189
  options[:target_id] = options.delete(:target_user_id) unless options[:target_user_id].nil?
190
190
  perform_get_with_object('/1.1/friendships/show.json', options, Twitter::Relationship)
191
191
  end
192
- alias_method :friendship_show, :friendship
193
- alias_method :relationship, :friendship
192
+ alias friendship_show friendship
193
+ alias relationship friendship
194
194
 
195
195
  # Test for the existence of friendship between two users
196
196
  #
@@ -253,7 +253,7 @@ module Twitter
253
253
  def friends(*args)
254
254
  cursor_from_response_with_user(:users, Twitter::User, '/1.1/friends/list.json', args)
255
255
  end
256
- alias_method :following, :friends
256
+ alias following friends
257
257
 
258
258
  # Returns a collection of user IDs that the currently authenticated user does not want to receive retweets from.
259
259
  # @see https://dev.twitter.com/rest/reference/get/friendships/no_retweets/ids
@@ -265,7 +265,7 @@ module Twitter
265
265
  def no_retweet_ids(options = {})
266
266
  perform_get('/1.1/friendships/no_retweets/ids.json', options).collect(&:to_i)
267
267
  end
268
- alias_method :no_retweets_ids, :no_retweet_ids
268
+ alias no_retweets_ids no_retweet_ids
269
269
  end
270
270
  end
271
271
  end
@@ -14,7 +14,7 @@ module Twitter
14
14
  include Twitter::REST::Utils
15
15
  include Twitter::Utils
16
16
  MAX_USERS_PER_REQUEST = 100
17
- URI_SUBSTRING = '://'
17
+ URI_SUBSTRING = '://'.freeze
18
18
 
19
19
  # Returns all lists the authenticating or specified user subscribes to, including their own
20
20
  #
@@ -33,7 +33,7 @@ module Twitter
33
33
  def lists(*args)
34
34
  objects_from_response_with_user(Twitter::List, :get, '/1.1/lists/list.json', args)
35
35
  end
36
- alias_method :lists_subscribed_to, :lists
36
+ alias lists_subscribed_to lists
37
37
 
38
38
  # Show tweet timeline for members of the specified list
39
39
  #
@@ -22,7 +22,7 @@ module Twitter
22
22
  conn = connection.dup
23
23
  conn.url_prefix = base_url
24
24
  headers = Twitter::Headers.new(self, :post, base_url + path, options).request_headers
25
- options.merge!(:media => media)
25
+ options[:media] = media
26
26
  conn.post(path, options) { |request| request.headers.update(headers) }.env.body[:media_id]
27
27
  end
28
28
  end
@@ -28,7 +28,7 @@ module Twitter
28
28
  options[:grant_type] ||= 'client_credentials'
29
29
  perform_post_with_object('/oauth2/token', options, Twitter::Token)
30
30
  end
31
- alias_method :bearer_token, :token
31
+ alias bearer_token token
32
32
 
33
33
  # Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
34
34
  #
@@ -58,7 +58,7 @@ module Twitter
58
58
  def geo_search(options = {})
59
59
  perform_get_with_object('/1.1/geo/search.json', options, Twitter::GeoResults)
60
60
  end
61
- alias_method :places_nearby, :geo_search
61
+ alias places_nearby geo_search
62
62
 
63
63
  # Locates places near the given coordinates which are similar in name
64
64
  #
@@ -77,7 +77,7 @@ module Twitter
77
77
  def similar_places(options = {})
78
78
  perform_get_with_object('/1.1/geo/similar_places.json', options, Twitter::GeoResults)
79
79
  end
80
- alias_method :places_similar, :similar_places
80
+ alias places_similar similar_places
81
81
  end
82
82
  end
83
83
  end
@@ -11,7 +11,7 @@ module Twitter
11
11
  class Request
12
12
  attr_accessor :client, :headers, :options, :rate_limit, :request_method,
13
13
  :path, :uri
14
- alias_method :verb, :request_method
14
+ alias verb request_method
15
15
 
16
16
  # @param client [Twitter::Client]
17
17
  # @param request_method [String, Symbol]
@@ -4,7 +4,7 @@ module Twitter
4
4
  module REST
5
5
  class Request
6
6
  class MultipartWithFile < Faraday::Middleware
7
- CONTENT_TYPE = 'Content-Type'
7
+ CONTENT_TYPE = 'Content-Type'.freeze
8
8
  BMP_REGEX = /\.bmp/i
9
9
  GIF_REGEX = /\.gif$/i
10
10
  JPEG_REGEX = /\.jpe?g/i
@@ -25,7 +25,7 @@ module Twitter
25
25
  def mentions_timeline(options = {})
26
26
  perform_get_with_objects('/1.1/statuses/mentions_timeline.json', options, Twitter::Tweet)
27
27
  end
28
- alias_method :mentions, :mentions_timeline
28
+ alias mentions mentions_timeline
29
29
 
30
30
  # Returns the 20 most recent Tweets posted by the specified user
31
31
  #
@@ -70,7 +70,7 @@ module Twitter
70
70
  user_timeline(user, opts)
71
71
  end
72
72
  end
73
- alias_method :retweeted_by, :retweeted_by_user
73
+ alias retweeted_by retweeted_by_user
74
74
 
75
75
  # Returns the 20 most recent retweets posted by the authenticating user
76
76
  #
@@ -8,7 +8,7 @@ module Twitter
8
8
  module Trends
9
9
  include Twitter::REST::Utils
10
10
 
11
- # Returns the top 10 trending topics for a specific WOEID
11
+ # Returns the top 50 trending topics for a specific WOEID
12
12
  #
13
13
  # @see https://dev.twitter.com/rest/reference/get/trends/place
14
14
  # @rate_limited Yes
@@ -23,8 +23,8 @@ module Twitter
23
23
  response = perform_get('/1.1/trends/place.json', options).first
24
24
  Twitter::TrendResults.new(response)
25
25
  end
26
- alias_method :local_trends, :trends
27
- alias_method :trends_place, :trends
26
+ alias local_trends trends
27
+ alias trends_place trends
28
28
 
29
29
  # Returns the locations that Twitter has trending topic information for
30
30
  #
@@ -37,7 +37,7 @@ module Twitter
37
37
  def trends_available(options = {})
38
38
  perform_get_with_objects('/1.1/trends/available.json', options, Twitter::Place)
39
39
  end
40
- alias_method :trend_locations, :trends_available
40
+ alias trend_locations trends_available
41
41
 
42
42
  # Returns the locations that Twitter has trending topic information for, closest to a specified location.
43
43
  #
@@ -100,7 +100,7 @@ module Twitter
100
100
  perform_post_with_object("/1.1/statuses/destroy/#{extract_id(tweet)}.json", arguments.options, Twitter::Tweet)
101
101
  end
102
102
  end
103
- alias_method :destroy_tweet, :destroy_status
103
+ alias destroy_tweet destroy_status
104
104
  deprecate_alias :status_destroy, :destroy_status
105
105
  deprecate_alias :tweet_destroy, :destroy_status
106
106
 
@@ -50,7 +50,7 @@ module Twitter
50
50
  def verify_credentials(options = {})
51
51
  perform_get_with_object('/1.1/account/verify_credentials.json', options, Twitter::User)
52
52
  end
53
- alias_method :current_user, :verify_credentials
53
+ alias current_user verify_credentials
54
54
 
55
55
  # Sets which device Twitter delivers updates to for the authenticating user
56
56
  #
@@ -9,7 +9,7 @@ module Twitter
9
9
  module REST
10
10
  module Utils
11
11
  include Twitter::Utils
12
- URI_SUBSTRING = '://'
12
+ URI_SUBSTRING = '://'.freeze
13
13
  DEFAULT_CURSOR = -1
14
14
 
15
15
  private
@@ -232,7 +232,7 @@ module Twitter
232
232
  hash
233
233
  end
234
234
 
235
- def collect_user_ids_and_screen_names(users) # rubocop:disable MethodLength
235
+ def collect_user_ids_and_screen_names(users)
236
236
  user_ids = []
237
237
  screen_names = []
238
238
  users.flatten.each do |user|
@@ -240,11 +240,7 @@ module Twitter
240
240
  when Integer
241
241
  user_ids << user
242
242
  when String
243
- if user[URI_SUBSTRING]
244
- screen_names << user.split('/').last
245
- else
246
- screen_names << user
247
- end
243
+ screen_names << (user[URI_SUBSTRING] ? user.split('/').last : user)
248
244
  when URI
249
245
  screen_names << user.path.split('/').last
250
246
  when Twitter::User
@@ -10,8 +10,8 @@ module Twitter
10
10
  include Twitter::Utils
11
11
  # @return [Hash]
12
12
  attr_reader :attrs
13
- alias_method :to_h, :attrs
14
- alias_method :to_hash, :to_h
13
+ alias to_h attrs
14
+ alias to_hash to_h
15
15
  deprecate_alias :to_hsh, :to_hash
16
16
 
17
17
  # Initializes a new SearchResults object
@@ -7,9 +7,16 @@ module Twitter
7
7
  # @return [String]
8
8
  attr_reader :language, :screen_name
9
9
  object_attr_reader :Place, :trend_location
10
- predicate_attr_reader :always_use_https, :discoverable_by_email,
10
+ predicate_attr_reader :allow_contributor_request,
11
+ :allow_dm_groups_from,
12
+ :allow_dms_from,
13
+ :always_use_https,
14
+ :discoverable_by_email,
11
15
  :discoverable_by_mobile_phone,
12
- :display_sensitive_media, :geo_enabled, :protected,
13
- :show_all_inline_media, :use_cookie_personalization
16
+ :display_sensitive_media,
17
+ :geo_enabled,
18
+ :protected,
19
+ :show_all_inline_media,
20
+ :use_cookie_personalization
14
21
  end
15
22
  end
@@ -8,7 +8,7 @@ module Twitter
8
8
  attr_reader :h, :w
9
9
  # @return [String]
10
10
  attr_reader :resize
11
- alias_method :height, :h
12
- alias_method :width, :w
11
+ alias height h
12
+ alias width w
13
13
  end
14
14
  end
@@ -110,7 +110,7 @@ module Twitter
110
110
  before_request.call
111
111
  authorization = Twitter::Headers.new(self, method, uri, params).oauth_auth_header.to_s
112
112
  headers = default_headers.merge(:authorization => authorization)
113
- request = HTTP::Request.new(method, uri + '?' + to_url_params(params), headers)
113
+ request = HTTP::Request.new(:verb => method, :uri => uri + '?' + to_url_params(params), :headers => headers)
114
114
  response = Streaming::Response.new do |data|
115
115
  if item = Streaming::MessageParser.parse(data) # rubocop:disable AssignmentInCondition
116
116
  yield(item)
@@ -13,7 +13,7 @@ module Twitter
13
13
 
14
14
  def stream(request, response)
15
15
  client_context = OpenSSL::SSL::SSLContext.new
16
- client = @tcp_socket_class.new(Resolv.getaddress(request.uri.host), request.uri.port)
16
+ client = @tcp_socket_class.new(Resolv.getaddress(request.socket_host), request.socket_port)
17
17
  ssl_client = @ssl_socket_class.new(client, client_context)
18
18
 
19
19
  ssl_client.connect
@@ -5,11 +5,11 @@ module Twitter
5
5
  :list_created, :list_destroyed, :list_updated, :list_member_added,
6
6
  :list_member_added, :list_member_removed, :list_user_subscribed,
7
7
  :list_user_subscribed, :list_user_unsubscribed, :list_user_unsubscribed
8
- ]
8
+ ].freeze
9
9
 
10
10
  TWEET_EVENTS = [
11
11
  :favorite, :unfavorite
12
- ]
12
+ ].freeze
13
13
 
14
14
  attr_reader :name, :source, :target, :target_object
15
15
 
@@ -7,9 +7,9 @@ module Twitter
7
7
 
8
8
  # @return [String]
9
9
  attr_reader :access_token, :token_type
10
- alias_method :to_s, :access_token
10
+ alias to_s access_token
11
11
 
12
- BEARER_TYPE = 'bearer'
12
+ BEARER_TYPE = 'bearer'.freeze
13
13
 
14
14
  # @return [Boolean]
15
15
  def bearer?
@@ -5,7 +5,7 @@ module Twitter
5
5
  class Trend < Twitter::Base
6
6
  include Equalizer.new(:name)
7
7
  # @return [String]
8
- attr_reader :events, :name, :query
8
+ attr_reader :events, :name, :query, :tweet_volume
9
9
  predicate_attr_reader :promoted_content
10
10
  uri_attr_reader :uri
11
11
  end
@@ -12,8 +12,8 @@ module Twitter
12
12
  include Memoizable
13
13
  # @return [Hash]
14
14
  attr_reader :attrs
15
- alias_method :to_h, :attrs
16
- alias_method :to_hash, :to_h
15
+ alias to_h attrs
16
+ alias to_hash to_h
17
17
  deprecate_alias :to_hsh, :to_hash
18
18
 
19
19
  # Initializes a new TrendResults object
@@ -13,20 +13,20 @@ module Twitter
13
13
  :retweet_count
14
14
  deprecate_alias :favorites_count, :favorite_count
15
15
  deprecate_alias :favoriters_count, :favorite_count
16
- alias_method :in_reply_to_tweet_id, :in_reply_to_status_id
17
- alias_method :reply?, :in_reply_to_user_id?
16
+ alias in_reply_to_tweet_id in_reply_to_status_id
17
+ alias reply? in_reply_to_user_id?
18
18
  deprecate_alias :retweeters_count, :retweet_count
19
19
  object_attr_reader :GeoFactory, :geo
20
20
  object_attr_reader :Metadata, :metadata
21
21
  object_attr_reader :Place, :place
22
22
  object_attr_reader :Tweet, :retweeted_status
23
23
  object_attr_reader :Tweet, :quoted_status
24
- alias_method :retweeted_tweet, :retweeted_status
25
- alias_method :retweet?, :retweeted_status?
26
- alias_method :retweeted_tweet?, :retweeted_status?
27
- alias_method :quoted_tweet, :quoted_status
28
- alias_method :quote?, :quoted_status?
29
- alias_method :quoted_tweet?, :quoted_status?
24
+ alias retweeted_tweet retweeted_status
25
+ alias retweet? retweeted_status?
26
+ alias retweeted_tweet? retweeted_status?
27
+ alias quoted_tweet quoted_status
28
+ alias quote? quoted_status?
29
+ alias quoted_tweet? quoted_status?
30
30
  object_attr_reader :User, :user, :status
31
31
  predicate_attr_reader :favorited, :possibly_sensitive, :retweeted,
32
32
  :truncated
@@ -48,7 +48,7 @@ module Twitter
48
48
  Addressable::URI.parse("https://twitter.com/#{user.screen_name}/status/#{id}") if user?
49
49
  end
50
50
  memoize :uri
51
- alias_method :url, :uri
51
+ alias url uri
52
52
  end
53
53
  Status = Tweet
54
54
  end
@@ -20,12 +20,12 @@ module Twitter
20
20
  :profile_background_color, :profile_link_color,
21
21
  :profile_sidebar_border_color, :profile_sidebar_fill_color,
22
22
  :profile_text_color, :time_zone
23
- alias_method :favorites_count, :favourites_count
24
- alias_method :tweets_count, :statuses_count
23
+ alias favorites_count favourites_count
24
+ alias tweets_count statuses_count
25
25
  object_attr_reader :Tweet, :status, :user
26
- alias_method :tweet, :status
27
- alias_method :tweet?, :status?
28
- alias_method :tweeted?, :status?
26
+ alias tweet status
27
+ alias tweet? status?
28
+ alias tweeted? status?
29
29
  predicate_attr_reader :contributors_enabled, :default_profile,
30
30
  :default_profile_image, :follow_request_sent,
31
31
  :geo_enabled, :muting, :needs_phone_verification,
@@ -84,7 +84,7 @@ module Twitter
84
84
  Addressable::URI.parse("https://twitter.com/#{screen_name}") if screen_name?
85
85
  end
86
86
  memoize :uri
87
- alias_method :url, :uri
87
+ alias url uri
88
88
 
89
89
  # @return [Addressable::URI] The URL to the user's website.
90
90
  def website
@@ -9,7 +9,7 @@ module Twitter
9
9
 
10
10
  # @return [Integer]
11
11
  def minor
12
- 15
12
+ 16
13
13
  end
14
14
 
15
15
  # @return [Integer]
@@ -34,7 +34,7 @@ module Twitter
34
34
 
35
35
  # @return [Array]
36
36
  def to_a
37
- to_h.values.compact
37
+ [major, minor, patch, pre].compact
38
38
  end
39
39
 
40
40
  # @return [String]
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.add_dependency 'buftok', '~> 0.2.0'
8
8
  spec.add_dependency 'equalizer', '0.0.10'
9
9
  spec.add_dependency 'faraday', '~> 0.9.0'
10
- spec.add_dependency 'http', ['>= 0.4', '< 0.10']
10
+ spec.add_dependency 'http', '~> 1.0'
11
11
  spec.add_dependency 'http_parser.rb', '~> 0.6.0'
12
12
  spec.add_dependency 'json', '~> 1.8'
13
13
  spec.add_dependency 'memoizable', '~> 0.4.0'
metadata CHANGED
@@ -1,9 +1,9 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: twitter
3
- version: !ruby/object:Gem::Version
4
- version: 5.15.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 5.16.0
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Erik Michaels-Ober
8
8
  - John Nunemaker
9
9
  - Wynn Netherland
@@ -12,132 +12,170 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
-
16
- date: 2015-09-06 00:00:00 Z
17
- dependencies:
18
- - !ruby/object:Gem::Dependency
19
- prerelease: false
15
+ date: 2016-01-24 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
20
18
  name: addressable
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ~>
24
- - !ruby/object:Gem::Version
25
- version: "2.3"
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "~>"
22
+ - !ruby/object:Gem::Version
23
+ version: '2.3'
26
24
  type: :runtime
27
- requirement: *id001
28
- - !ruby/object:Gem::Dependency
29
25
  prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '2.3'
31
+ - !ruby/object:Gem::Dependency
30
32
  name: buftok
31
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ~>
34
- - !ruby/object:Gem::Version
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - "~>"
36
+ - !ruby/object:Gem::Version
35
37
  version: 0.2.0
36
38
  type: :runtime
37
- requirement: *id002
38
- - !ruby/object:Gem::Dependency
39
39
  prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - "~>"
43
+ - !ruby/object:Gem::Version
44
+ version: 0.2.0
45
+ - !ruby/object:Gem::Dependency
40
46
  name: equalizer
41
- version_requirements: &id003 !ruby/object:Gem::Requirement
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - '='
50
+ - !ruby/object:Gem::Version
45
51
  version: 0.0.10
46
52
  type: :runtime
47
- requirement: *id003
48
- - !ruby/object:Gem::Dependency
49
53
  prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '='
57
+ - !ruby/object:Gem::Version
58
+ version: 0.0.10
59
+ - !ruby/object:Gem::Dependency
50
60
  name: faraday
51
- version_requirements: &id004 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ~>
54
- - !ruby/object:Gem::Version
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - "~>"
64
+ - !ruby/object:Gem::Version
55
65
  version: 0.9.0
56
66
  type: :runtime
57
- requirement: *id004
58
- - !ruby/object:Gem::Dependency
59
67
  prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: 0.9.0
73
+ - !ruby/object:Gem::Dependency
60
74
  name: http
61
- version_requirements: &id005 !ruby/object:Gem::Requirement
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: "0.4"
66
- - - <
67
- - !ruby/object:Gem::Version
68
- version: "0.10"
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '1.0'
69
80
  type: :runtime
70
- requirement: *id005
71
- - !ruby/object:Gem::Dependency
72
81
  prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - "~>"
85
+ - !ruby/object:Gem::Version
86
+ version: '1.0'
87
+ - !ruby/object:Gem::Dependency
73
88
  name: http_parser.rb
74
- version_requirements: &id006 !ruby/object:Gem::Requirement
75
- requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
78
93
  version: 0.6.0
79
94
  type: :runtime
80
- requirement: *id006
81
- - !ruby/object:Gem::Dependency
82
95
  prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: 0.6.0
101
+ - !ruby/object:Gem::Dependency
83
102
  name: json
84
- version_requirements: &id007 !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ~>
87
- - !ruby/object:Gem::Version
88
- version: "1.8"
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '1.8'
89
108
  type: :runtime
90
- requirement: *id007
91
- - !ruby/object:Gem::Dependency
92
109
  prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: '1.8'
115
+ - !ruby/object:Gem::Dependency
93
116
  name: memoizable
94
- version_requirements: &id008 !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ~>
97
- - !ruby/object:Gem::Version
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
98
121
  version: 0.4.0
99
122
  type: :runtime
100
- requirement: *id008
101
- - !ruby/object:Gem::Dependency
102
123
  prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: 0.4.0
129
+ - !ruby/object:Gem::Dependency
103
130
  name: naught
104
- version_requirements: &id009 !ruby/object:Gem::Requirement
105
- requirements:
106
- - - ~>
107
- - &id011 !ruby/object:Gem::Version
108
- version: "1.0"
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '1.0'
109
136
  type: :runtime
110
- requirement: *id009
111
- - !ruby/object:Gem::Dependency
112
137
  prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - "~>"
141
+ - !ruby/object:Gem::Version
142
+ version: '1.0'
143
+ - !ruby/object:Gem::Dependency
113
144
  name: simple_oauth
114
- version_requirements: &id010 !ruby/object:Gem::Requirement
115
- requirements:
116
- - - ~>
117
- - !ruby/object:Gem::Version
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
118
149
  version: 0.3.0
119
150
  type: :runtime
120
- requirement: *id010
121
- - !ruby/object:Gem::Dependency
122
151
  prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - "~>"
155
+ - !ruby/object:Gem::Version
156
+ version: 0.3.0
157
+ - !ruby/object:Gem::Dependency
123
158
  name: bundler
124
- version_requirements: &id012 !ruby/object:Gem::Requirement
125
- requirements:
126
- - - ~>
127
- - *id011
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - "~>"
162
+ - !ruby/object:Gem::Version
163
+ version: '1.0'
128
164
  type: :development
129
- requirement: *id012
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - "~>"
169
+ - !ruby/object:Gem::Version
170
+ version: '1.0'
130
171
  description: A Ruby interface to the Twitter API.
131
- email:
172
+ email:
132
173
  - sferik@gmail.com
133
174
  executables: []
134
-
135
175
  extensions: []
136
-
137
176
  extra_rdoc_files: []
138
-
139
- files:
140
- - .yardopts
177
+ files:
178
+ - ".yardopts"
141
179
  - CHANGELOG.md
142
180
  - CONTRIBUTING.md
143
181
  - LICENSE.md
@@ -232,32 +270,28 @@ files:
232
270
  - lib/twitter/version.rb
233
271
  - twitter.gemspec
234
272
  homepage: http://sferik.github.com/twitter/
235
- licenses:
273
+ licenses:
236
274
  - MIT
237
275
  metadata: {}
238
-
239
276
  post_install_message:
240
277
  rdoc_options: []
241
-
242
- require_paths:
278
+ require_paths:
243
279
  - lib
244
- required_ruby_version: !ruby/object:Gem::Requirement
245
- requirements:
280
+ required_ruby_version: !ruby/object:Gem::Requirement
281
+ requirements:
246
282
  - - ">="
247
- - !ruby/object:Gem::Version
248
- version: "0"
249
- required_rubygems_version: !ruby/object:Gem::Requirement
250
- requirements:
283
+ - !ruby/object:Gem::Version
284
+ version: '0'
285
+ required_rubygems_version: !ruby/object:Gem::Requirement
286
+ requirements:
251
287
  - - ">="
252
- - !ruby/object:Gem::Version
288
+ - !ruby/object:Gem::Version
253
289
  version: 1.3.5
254
290
  requirements: []
255
-
256
291
  rubyforge_project:
257
- rubygems_version: 2.4.8
292
+ rubygems_version: 2.5.1
258
293
  signing_key:
259
294
  specification_version: 4
260
295
  summary: A Ruby interface to the Twitter API.
261
296
  test_files: []
262
-
263
297
  has_rdoc: