twitter 5.6.0 → 5.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +8 -0
  4. data/README.md +3 -3
  5. data/Rakefile +1 -1
  6. data/lib/twitter/base.rb +0 -8
  7. data/lib/twitter/client.rb +2 -1
  8. data/lib/twitter/cursor.rb +2 -15
  9. data/lib/twitter/error.rb +90 -18
  10. data/lib/twitter/geo_results.rb +0 -10
  11. data/lib/twitter/request.rb +4 -4
  12. data/lib/twitter/rest/api.rb +43 -0
  13. data/lib/twitter/rest/client.rb +10 -44
  14. data/lib/twitter/rest/direct_messages.rb +138 -0
  15. data/lib/twitter/rest/favorites.rb +108 -0
  16. data/lib/twitter/rest/friends_and_followers.rb +281 -0
  17. data/lib/twitter/rest/help.rb +56 -0
  18. data/lib/twitter/rest/lists.rb +497 -0
  19. data/lib/twitter/rest/oauth.rb +65 -0
  20. data/lib/twitter/rest/places_and_geo.rb +84 -0
  21. data/lib/twitter/rest/request/multipart_with_file.rb +5 -5
  22. data/lib/twitter/rest/response/parse_json.rb +2 -4
  23. data/lib/twitter/rest/response/raise_error.rb +24 -15
  24. data/lib/twitter/rest/saved_searches.rb +93 -0
  25. data/lib/twitter/rest/search.rb +37 -0
  26. data/lib/twitter/rest/spam_reporting.rb +27 -0
  27. data/lib/twitter/rest/suggested_users.rb +49 -0
  28. data/lib/twitter/rest/timelines.rb +200 -0
  29. data/lib/twitter/rest/trends.rb +57 -0
  30. data/lib/twitter/rest/tweets.rb +309 -0
  31. data/lib/twitter/rest/undocumented.rb +49 -0
  32. data/lib/twitter/rest/users.rb +383 -0
  33. data/lib/twitter/rest/utils.rb +205 -0
  34. data/lib/twitter/search_results.rb +2 -13
  35. data/lib/twitter/trend_results.rb +0 -10
  36. data/lib/twitter/version.rb +1 -1
  37. data/spec/helper.rb +1 -1
  38. data/spec/twitter/error_spec.rb +26 -42
  39. data/spec/twitter/rest/{api/direct_messages_spec.rb → direct_messages_spec.rb} +1 -1
  40. data/spec/twitter/rest/{api/favorites_spec.rb → favorites_spec.rb} +1 -1
  41. data/spec/twitter/rest/{api/friends_and_followers_spec.rb → friends_and_followers_spec.rb} +1 -1
  42. data/spec/twitter/rest/{api/geo_spec.rb → geo_spec.rb} +1 -1
  43. data/spec/twitter/rest/{api/help_spec.rb → help_spec.rb} +1 -1
  44. data/spec/twitter/rest/{api/lists_spec.rb → lists_spec.rb} +1 -1
  45. data/spec/twitter/rest/{api/oauth_spec.rb → oauth_spec.rb} +4 -8
  46. data/spec/twitter/rest/{api/saved_searches_spec.rb → saved_searches_spec.rb} +1 -1
  47. data/spec/twitter/rest/{api/search_spec.rb → search_spec.rb} +1 -1
  48. data/spec/twitter/rest/{api/spam_reporting_spec.rb → spam_reporting_spec.rb} +1 -1
  49. data/spec/twitter/rest/{api/suggested_users_spec.rb → suggested_users_spec.rb} +1 -1
  50. data/spec/twitter/rest/{api/timelines_spec.rb → timelines_spec.rb} +1 -1
  51. data/spec/twitter/rest/{api/trends_spec.rb → trends_spec.rb} +1 -1
  52. data/spec/twitter/rest/{api/tweets_spec.rb → tweets_spec.rb} +74 -5
  53. data/spec/twitter/rest/{api/undocumented_spec.rb → undocumented_spec.rb} +1 -1
  54. data/spec/twitter/rest/{api/users_spec.rb → users_spec.rb} +5 -5
  55. data/spec/twitter/tweet_spec.rb +1 -1
  56. data/twitter.gemspec +0 -1
  57. metadata +247 -237
  58. metadata.gz.sig +0 -0
  59. checksums.yaml +0 -7
  60. checksums.yaml.gz.sig +0 -0
  61. data/lib/twitter/error/already_favorited.rb +0 -10
  62. data/lib/twitter/error/already_posted.rb +0 -10
  63. data/lib/twitter/error/already_retweeted.rb +0 -10
  64. data/lib/twitter/error/bad_gateway.rb +0 -10
  65. data/lib/twitter/error/bad_request.rb +0 -10
  66. data/lib/twitter/error/configuration_error.rb +0 -8
  67. data/lib/twitter/error/forbidden.rb +0 -10
  68. data/lib/twitter/error/gateway_timeout.rb +0 -10
  69. data/lib/twitter/error/internal_server_error.rb +0 -10
  70. data/lib/twitter/error/not_acceptable.rb +0 -10
  71. data/lib/twitter/error/not_found.rb +0 -10
  72. data/lib/twitter/error/request_timeout.rb +0 -10
  73. data/lib/twitter/error/service_unavailable.rb +0 -10
  74. data/lib/twitter/error/too_many_requests.rb +0 -12
  75. data/lib/twitter/error/unauthorized.rb +0 -10
  76. data/lib/twitter/error/unprocessable_entity.rb +0 -10
  77. data/lib/twitter/rest/api/direct_messages.rb +0 -140
  78. data/lib/twitter/rest/api/favorites.rb +0 -115
  79. data/lib/twitter/rest/api/friends_and_followers.rb +0 -284
  80. data/lib/twitter/rest/api/help.rb +0 -58
  81. data/lib/twitter/rest/api/lists.rb +0 -500
  82. data/lib/twitter/rest/api/oauth.rb +0 -67
  83. data/lib/twitter/rest/api/places_and_geo.rb +0 -86
  84. data/lib/twitter/rest/api/saved_searches.rb +0 -95
  85. data/lib/twitter/rest/api/search.rb +0 -39
  86. data/lib/twitter/rest/api/spam_reporting.rb +0 -29
  87. data/lib/twitter/rest/api/suggested_users.rb +0 -51
  88. data/lib/twitter/rest/api/timelines.rb +0 -202
  89. data/lib/twitter/rest/api/trends.rb +0 -58
  90. data/lib/twitter/rest/api/tweets.rb +0 -297
  91. data/lib/twitter/rest/api/undocumented.rb +0 -51
  92. data/lib/twitter/rest/api/users.rb +0 -383
  93. data/lib/twitter/rest/api/utils.rb +0 -212
metadata.gz.sig CHANGED
Binary file
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: dda8dd395f86366d6a6afb036d588f96fee8d48a
4
- data.tar.gz: 2d90bbbeef08919eea3c8274800a9086eb72fab1
5
- SHA512:
6
- metadata.gz: 1c5cdf8e00944217c80803067e3dc46b547a448943b1ffab6fd7636bfb2e039b18e791e487865fd1d86d97b14abab7537407e9ccffb385c30996748cdf93bc6f
7
- data.tar.gz: 0d20f6820ee2d37ae35a28ede0123fb7a27ef090217cbff427e4df86f447323b63c013017a08b55a6c955a36050cbef185bda2df902f45ab778dc3d9bd080cc2
Binary file
@@ -1,10 +0,0 @@
1
- require 'twitter/error/forbidden'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when a Tweet has already been favorited
6
- class AlreadyFavorited < Twitter::Error::Forbidden
7
- MESSAGE = 'You have already favorited this status.'
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error/forbidden'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when a Tweet has already been posted
6
- class AlreadyPosted < Twitter::Error::Forbidden
7
- MESSAGE = 'Status is a duplicate.'
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error/forbidden'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when a Tweet has already been retweeted
6
- class AlreadyRetweeted < Twitter::Error::Forbidden
7
- MESSAGE = 'sharing is not permissible for this status (Share validations failed)'
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 502
6
- class BadGateway < Twitter::Error
7
- HTTP_STATUS_CODE = 502
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 400
6
- class BadRequest < Twitter::Error
7
- HTTP_STATUS_CODE = 400
8
- end
9
- end
10
- end
@@ -1,8 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- class ConfigurationError < ::ArgumentError
6
- end
7
- end
8
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 403
6
- class Forbidden < Twitter::Error
7
- HTTP_STATUS_CODE = 403
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 504
6
- class GatewayTimeout < Twitter::Error
7
- HTTP_STATUS_CODE = 504
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 500
6
- class InternalServerError < Twitter::Error
7
- HTTP_STATUS_CODE = 500
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 406
6
- class NotAcceptable < Twitter::Error
7
- HTTP_STATUS_CODE = 406
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 404
6
- class NotFound < Twitter::Error
7
- HTTP_STATUS_CODE = 404
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when the Faraday connection times out
6
- class RequestTimeout < Twitter::Error
7
- HTTP_STATUS_CODE = 408
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 503
6
- class ServiceUnavailable < Twitter::Error
7
- HTTP_STATUS_CODE = 503
8
- end
9
- end
10
- end
@@ -1,12 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 429
6
- class TooManyRequests < Twitter::Error
7
- HTTP_STATUS_CODE = 429
8
- end
9
- EnhanceYourCalm = TooManyRequests # rubocop:disable ConstantName
10
- RateLimited = TooManyRequests # rubocop:disable ConstantName
11
- end
12
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 401
6
- class Unauthorized < Twitter::Error
7
- HTTP_STATUS_CODE = 401
8
- end
9
- end
10
- end
@@ -1,10 +0,0 @@
1
- require 'twitter/error'
2
-
3
- module Twitter
4
- class Error
5
- # Raised when Twitter returns the HTTP status code 422
6
- class UnprocessableEntity < Twitter::Error
7
- HTTP_STATUS_CODE = 422
8
- end
9
- end
10
- end
@@ -1,140 +0,0 @@
1
- require 'twitter/arguments'
2
- require 'twitter/direct_message'
3
- require 'twitter/request'
4
- require 'twitter/rest/api/utils'
5
- require 'twitter/user'
6
- require 'twitter/utils'
7
-
8
- module Twitter
9
- module REST
10
- module API
11
- module DirectMessages
12
- include Twitter::REST::API::Utils
13
- include Twitter::Utils
14
-
15
- # Returns the 20 most recent direct messages sent to the authenticating user
16
- #
17
- # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages
18
- # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
19
- # @rate_limited Yes
20
- # @authentication Requires user context
21
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
22
- # @return [Array<Twitter::DirectMessage>] Direct messages sent to the authenticating user.
23
- # @param options [Hash] A customizable set of options.
24
- # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
25
- # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
26
- # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
27
- # @option options [Integer] :page Specifies the page of results to retrieve.
28
- def direct_messages_received(options = {})
29
- perform_with_objects(:get, '/1.1/direct_messages.json', options, Twitter::DirectMessage)
30
- end
31
-
32
- # Returns the 20 most recent direct messages sent by the authenticating user
33
- #
34
- # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/sent
35
- # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
36
- # @rate_limited Yes
37
- # @authentication Requires user context
38
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
39
- # @return [Array<Twitter::DirectMessage>] Direct messages sent by the authenticating user.
40
- # @param options [Hash] A customizable set of options.
41
- # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
42
- # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
43
- # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
44
- # @option options [Integer] :page Specifies the page of results to retrieve.
45
- def direct_messages_sent(options = {})
46
- perform_with_objects(:get, '/1.1/direct_messages/sent.json', options, Twitter::DirectMessage)
47
- end
48
-
49
- # Returns a direct message
50
- #
51
- # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/show
52
- # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
53
- # @rate_limited Yes
54
- # @authentication Requires user context
55
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
56
- # @return [Twitter::DirectMessage] The requested messages.
57
- # @param id [Integer] A direct message ID.
58
- # @param options [Hash] A customizable set of options.
59
- def direct_message(id, options = {})
60
- options[:id] = id
61
- perform_with_object(:get, '/1.1/direct_messages/show.json', options, Twitter::DirectMessage)
62
- end
63
-
64
- # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
65
- # @rate_limited Yes
66
- # @authentication Requires user context
67
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
68
- # @return [Array<Twitter::DirectMessage>] The requested messages.
69
- # @overload direct_messages(options = {})
70
- # Returns the 20 most recent direct messages sent to the authenticating user
71
- #
72
- # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages
73
- # @param options [Hash] A customizable set of options.
74
- # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
75
- # @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
76
- # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
77
- # @option options [Integer] :page Specifies the page of results to retrieve.
78
- # @overload direct_messages(*ids)
79
- # Returns direct messages
80
- #
81
- # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/show
82
- # @param ids [Enumerable<Integer>] A collection of direct message IDs.
83
- # @overload direct_messages(*ids, options)
84
- # Returns direct messages
85
- #
86
- # @see https://dev.twitter.com/docs/api/1.1/get/direct_messages/show
87
- # @param ids [Enumerable<Integer>] A collection of direct message IDs.
88
- # @param options [Hash] A customizable set of options.
89
- def direct_messages(*args)
90
- arguments = Twitter::Arguments.new(args)
91
- if arguments.empty?
92
- direct_messages_received(arguments.options)
93
- else
94
- parallel_map(arguments) do |id|
95
- direct_message(id, arguments.options)
96
- end
97
- end
98
- end
99
-
100
- # Destroys direct messages
101
- #
102
- # @see https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy
103
- # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
104
- # @rate_limited No
105
- # @authentication Requires user context
106
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
107
- # @return [Array<Twitter::DirectMessage>] Deleted direct message.
108
- # @overload destroy_direct_message(*ids)
109
- # @param ids [Enumerable<Integer>] A collection of direct message IDs.
110
- # @overload destroy_direct_message(*ids, options)
111
- # @param ids [Enumerable<Integer>] A collection of direct message IDs.
112
- # @param options [Hash] A customizable set of options.
113
- def destroy_direct_message(*args)
114
- parallel_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
115
- end
116
- deprecate_alias :direct_message_destroy, :destroy_direct_message
117
-
118
- # Sends a new direct message to the specified user from the authenticating user
119
- #
120
- # @see https://dev.twitter.com/docs/api/1.1/post/direct_messages/new
121
- # @rate_limited No
122
- # @authentication Requires user context
123
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
124
- # @return [Twitter::DirectMessage] The sent message.
125
- # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
126
- # @param text [String] The text of your direct message, up to 140 characters.
127
- # @param options [Hash] A customizable set of options.
128
- def create_direct_message(user, text, options = {})
129
- merge_user!(options, user)
130
- options[:text] = text
131
- perform_with_object(:post, '/1.1/direct_messages/new.json', options, Twitter::DirectMessage)
132
- end
133
- alias_method :d, :create_direct_message
134
- alias_method :m, :create_direct_message
135
- alias_method :dm, :create_direct_message
136
- deprecate_alias :direct_message_create, :create_direct_message
137
- end
138
- end
139
- end
140
- end
@@ -1,115 +0,0 @@
1
- require 'twitter/arguments'
2
- require 'twitter/error/already_favorited'
3
- require 'twitter/error/forbidden'
4
- require 'twitter/request'
5
- require 'twitter/rest/api/utils'
6
- require 'twitter/tweet'
7
- require 'twitter/user'
8
- require 'twitter/utils'
9
-
10
- module Twitter
11
- module REST
12
- module API
13
- module Favorites
14
- include Twitter::REST::API::Utils
15
- include Twitter::Utils
16
-
17
- # @see https://dev.twitter.com/docs/api/1.1/get/favorites/list
18
- # @rate_limited Yes
19
- # @authentication Requires user context
20
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
21
- # @return [Array<Twitter::Tweet>] favorite Tweets.
22
- # @overload favorites(options = {})
23
- # Returns the 20 most recent favorite Tweets for the authenticating user
24
- #
25
- # @param options [Hash] A customizable set of options.
26
- # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
27
- # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
28
- # @overload favorites(user, options = {})
29
- # Returns the 20 most recent favorite Tweets for the specified user
30
- #
31
- # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
32
- # @param options [Hash] A customizable set of options.
33
- # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
34
- # @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.
35
- def favorites(*args)
36
- arguments = Twitter::Arguments.new(args)
37
- merge_user!(arguments.options, arguments.pop) if arguments.last
38
- perform_with_objects(:get, '/1.1/favorites/list.json', arguments.options, Twitter::Tweet)
39
- end
40
-
41
- # Un-favorites the specified Tweets as the authenticating user
42
- #
43
- # @see https://dev.twitter.com/docs/api/1.1/post/favorites/destroy
44
- # @rate_limited No
45
- # @authentication Requires user context
46
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
47
- # @return [Array<Twitter::Tweet>] The un-favorited Tweets.
48
- # @overload unfavorite(*tweets)
49
- # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
50
- # @overload unfavorite(*tweets, options)
51
- # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
52
- # @param options [Hash] A customizable set of options.
53
- def unfavorite(*args)
54
- parallel_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
55
- end
56
- alias_method :destroy_favorite, :unfavorite
57
- deprecate_alias :favorite_destroy, :unfavorite
58
-
59
- # Favorites the specified Tweets as the authenticating user
60
- #
61
- # @see https://dev.twitter.com/docs/api/1.1/post/favorites/create
62
- # @rate_limited No
63
- # @authentication Requires user context
64
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
65
- # @return [Array<Twitter::Tweet>] The favorited Tweets.
66
- # @overload favorite(*tweets)
67
- # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
68
- # @overload favorite(*tweets, options)
69
- # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
70
- # @param options [Hash] A customizable set of options.
71
- def favorite(*args)
72
- arguments = Twitter::Arguments.new(args)
73
- parallel_map(arguments) do |tweet|
74
- begin
75
- perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
76
- rescue Twitter::Error::Forbidden => error
77
- raise unless error.message == Twitter::Error::AlreadyFavorited::MESSAGE
78
- end
79
- end.compact
80
- end
81
- alias_method :fav, :favorite
82
- alias_method :fave, :favorite
83
- deprecate_alias :favorite_create, :favorite
84
-
85
- # Favorites the specified Tweets as the authenticating user and raises an error if one has already been favorited
86
- #
87
- # @see https://dev.twitter.com/docs/api/1.1/post/favorites/create
88
- # @rate_limited No
89
- # @authentication Requires user context
90
- # @raise [Twitter::Error::AlreadyFavorited] Error raised when tweet has already been favorited.
91
- # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
92
- # @return [Array<Twitter::Tweet>] The favorited Tweets.
93
- # @overload favorite(*tweets)
94
- # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
95
- # @overload favorite(*tweets, options)
96
- # @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
97
- # @param options [Hash] A customizable set of options.
98
- def favorite!(*args)
99
- arguments = Twitter::Arguments.new(args)
100
- parallel_map(arguments) do |tweet|
101
- begin
102
- perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
103
- rescue Twitter::Error::Forbidden => error
104
- handle_forbidden_error(Twitter::Error::AlreadyFavorited, error)
105
- end
106
- end
107
- end
108
- alias_method :create_favorite!, :favorite!
109
- alias_method :fav!, :favorite!
110
- alias_method :fave!, :favorite!
111
- deprecate_alias :favorite_create!, :favorite!
112
- end
113
- end
114
- end
115
- end