twitter 5.5.1 → 5.6.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.
- checksums.yaml +4 -4
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +0 -0
 - data/CHANGELOG.md +12 -0
 - data/README.md +8 -10
 - data/lib/twitter/base.rb +4 -2
 - data/lib/twitter/client.rb +7 -5
 - data/lib/twitter/configuration.rb +1 -1
 - data/lib/twitter/cursor.rb +18 -17
 - data/lib/twitter/entities.rb +27 -1
 - data/lib/twitter/error.rb +1 -1
 - data/lib/twitter/error/request_timeout.rb +10 -0
 - data/lib/twitter/geo_results.rb +5 -3
 - data/lib/twitter/media/photo.rb +1 -1
 - data/lib/twitter/null_object.rb +8 -20
 - data/lib/twitter/profile_banner.rb +1 -1
 - data/lib/twitter/request.rb +47 -0
 - data/lib/twitter/rest/api/direct_messages.rb +7 -5
 - data/lib/twitter/rest/api/favorites.rb +7 -7
 - data/lib/twitter/rest/api/friends_and_followers.rb +11 -9
 - data/lib/twitter/rest/api/help.rb +4 -3
 - data/lib/twitter/rest/api/lists.rb +9 -7
 - data/lib/twitter/rest/api/oauth.rb +11 -5
 - data/lib/twitter/rest/api/places_and_geo.rb +6 -5
 - data/lib/twitter/rest/api/saved_searches.rb +8 -6
 - data/lib/twitter/rest/api/search.rb +4 -10
 - data/lib/twitter/rest/api/spam_reporting.rb +1 -0
 - data/lib/twitter/rest/api/suggested_users.rb +4 -3
 - data/lib/twitter/rest/api/timelines.rb +5 -4
 - data/lib/twitter/rest/api/trends.rb +5 -4
 - data/lib/twitter/rest/api/tweets.rb +19 -24
 - data/lib/twitter/rest/api/users.rb +17 -16
 - data/lib/twitter/rest/api/utils.rb +45 -73
 - data/lib/twitter/rest/client.rb +34 -34
 - data/lib/twitter/rest/request/multipart_with_file.rb +2 -0
 - data/lib/twitter/rest/response/parse_json.rb +2 -0
 - data/lib/twitter/rest/response/raise_error.rb +2 -0
 - data/lib/twitter/search_results.rb +28 -60
 - data/lib/twitter/streaming/client.rb +4 -4
 - data/lib/twitter/suggestion.rb +1 -1
 - data/lib/twitter/trend_results.rb +6 -4
 - data/lib/twitter/tweet.rb +3 -3
 - data/lib/twitter/user.rb +1 -1
 - data/lib/twitter/utils.rb +18 -3
 - data/lib/twitter/version.rb +2 -2
 - data/spec/helper.rb +1 -1
 - data/spec/twitter/error_spec.rb +1 -1
 - data/spec/twitter/geo_factory_spec.rb +1 -1
 - data/spec/twitter/identifiable_spec.rb +1 -1
 - data/spec/twitter/media_factory_spec.rb +1 -1
 - data/spec/twitter/rest/api/favorites_spec.rb +2 -2
 - data/spec/twitter/rest/api/tweets_spec.rb +4 -4
 - data/spec/twitter/rest/client_spec.rb +13 -25
 - data/spec/twitter/tweet_spec.rb +69 -0
 - data/twitter.gemspec +2 -1
 - metadata +23 -15
 - metadata.gz.sig +0 -0
 - data/spec/twitter/null_object_spec.rb +0 -90
 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'twitter/arguments'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'twitter/direct_message'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'twitter/rest/api/utils'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'twitter/user'
         
     | 
| 
       5 
6 
     | 
    
         
             
            require 'twitter/utils'
         
     | 
| 
         @@ -9,6 +10,7 @@ module Twitter 
     | 
|
| 
       9 
10 
     | 
    
         
             
                module API
         
     | 
| 
       10 
11 
     | 
    
         
             
                  module DirectMessages
         
     | 
| 
       11 
12 
     | 
    
         
             
                    include Twitter::REST::API::Utils
         
     | 
| 
      
 13 
     | 
    
         
            +
                    include Twitter::Utils
         
     | 
| 
       12 
14 
     | 
    
         | 
| 
       13 
15 
     | 
    
         
             
                    # Returns the 20 most recent direct messages sent to the authenticating user
         
     | 
| 
       14 
16 
     | 
    
         
             
                    #
         
     | 
| 
         @@ -24,7 +26,7 @@ module Twitter 
     | 
|
| 
       24 
26 
     | 
    
         
             
                    # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
         
     | 
| 
       25 
27 
     | 
    
         
             
                    # @option options [Integer] :page Specifies the page of results to retrieve.
         
     | 
| 
       26 
28 
     | 
    
         
             
                    def direct_messages_received(options = {})
         
     | 
| 
       27 
     | 
    
         
            -
                       
     | 
| 
      
 29 
     | 
    
         
            +
                      perform_with_objects(:get, '/1.1/direct_messages.json', options, Twitter::DirectMessage)
         
     | 
| 
       28 
30 
     | 
    
         
             
                    end
         
     | 
| 
       29 
31 
     | 
    
         | 
| 
       30 
32 
     | 
    
         
             
                    # Returns the 20 most recent direct messages sent by the authenticating user
         
     | 
| 
         @@ -41,7 +43,7 @@ module Twitter 
     | 
|
| 
       41 
43 
     | 
    
         
             
                    # @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 200.
         
     | 
| 
       42 
44 
     | 
    
         
             
                    # @option options [Integer] :page Specifies the page of results to retrieve.
         
     | 
| 
       43 
45 
     | 
    
         
             
                    def direct_messages_sent(options = {})
         
     | 
| 
       44 
     | 
    
         
            -
                       
     | 
| 
      
 46 
     | 
    
         
            +
                      perform_with_objects(:get, '/1.1/direct_messages/sent.json', options, Twitter::DirectMessage)
         
     | 
| 
       45 
47 
     | 
    
         
             
                    end
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
       47 
49 
     | 
    
         
             
                    # Returns a direct message
         
     | 
| 
         @@ -56,7 +58,7 @@ module Twitter 
     | 
|
| 
       56 
58 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       57 
59 
     | 
    
         
             
                    def direct_message(id, options = {})
         
     | 
| 
       58 
60 
     | 
    
         
             
                      options[:id] = id
         
     | 
| 
       59 
     | 
    
         
            -
                       
     | 
| 
      
 61 
     | 
    
         
            +
                      perform_with_object(:get, '/1.1/direct_messages/show.json', options, Twitter::DirectMessage)
         
     | 
| 
       60 
62 
     | 
    
         
             
                    end
         
     | 
| 
       61 
63 
     | 
    
         | 
| 
       62 
64 
     | 
    
         
             
                    # @note This method requires an access token with RWD (read, write & direct message) permissions. Consult The Application Permission Model for more information.
         
     | 
| 
         @@ -89,7 +91,7 @@ module Twitter 
     | 
|
| 
       89 
91 
     | 
    
         
             
                      if arguments.empty?
         
     | 
| 
       90 
92 
     | 
    
         
             
                        direct_messages_received(arguments.options)
         
     | 
| 
       91 
93 
     | 
    
         
             
                      else
         
     | 
| 
       92 
     | 
    
         
            -
                         
     | 
| 
      
 94 
     | 
    
         
            +
                        parallel_map(arguments) do |id|
         
     | 
| 
       93 
95 
     | 
    
         
             
                          direct_message(id, arguments.options)
         
     | 
| 
       94 
96 
     | 
    
         
             
                        end
         
     | 
| 
       95 
97 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -126,7 +128,7 @@ module Twitter 
     | 
|
| 
       126 
128 
     | 
    
         
             
                    def create_direct_message(user, text, options = {})
         
     | 
| 
       127 
129 
     | 
    
         
             
                      merge_user!(options, user)
         
     | 
| 
       128 
130 
     | 
    
         
             
                      options[:text] = text
         
     | 
| 
       129 
     | 
    
         
            -
                       
     | 
| 
      
 131 
     | 
    
         
            +
                      perform_with_object(:post, '/1.1/direct_messages/new.json', options, Twitter::DirectMessage)
         
     | 
| 
       130 
132 
     | 
    
         
             
                    end
         
     | 
| 
       131 
133 
     | 
    
         
             
                    alias_method :d, :create_direct_message
         
     | 
| 
       132 
134 
     | 
    
         
             
                    alias_method :m, :create_direct_message
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'twitter/arguments'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'twitter/error/already_favorited'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'twitter/error/forbidden'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'twitter/rest/api/utils'
         
     | 
| 
       5 
6 
     | 
    
         
             
            require 'twitter/tweet'
         
     | 
| 
       6 
7 
     | 
    
         
             
            require 'twitter/user'
         
     | 
| 
         @@ -11,6 +12,7 @@ module Twitter 
     | 
|
| 
       11 
12 
     | 
    
         
             
                module API
         
     | 
| 
       12 
13 
     | 
    
         
             
                  module Favorites
         
     | 
| 
       13 
14 
     | 
    
         
             
                    include Twitter::REST::API::Utils
         
     | 
| 
      
 15 
     | 
    
         
            +
                    include Twitter::Utils
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
       15 
17 
     | 
    
         
             
                    # @see https://dev.twitter.com/docs/api/1.1/get/favorites/list
         
     | 
| 
       16 
18 
     | 
    
         
             
                    # @rate_limited Yes
         
     | 
| 
         @@ -33,7 +35,7 @@ module Twitter 
     | 
|
| 
       33 
35 
     | 
    
         
             
                    def favorites(*args)
         
     | 
| 
       34 
36 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       35 
37 
     | 
    
         
             
                      merge_user!(arguments.options, arguments.pop) if arguments.last
         
     | 
| 
       36 
     | 
    
         
            -
                       
     | 
| 
      
 38 
     | 
    
         
            +
                      perform_with_objects(:get, '/1.1/favorites/list.json', arguments.options, Twitter::Tweet)
         
     | 
| 
       37 
39 
     | 
    
         
             
                    end
         
     | 
| 
       38 
40 
     | 
    
         | 
| 
       39 
41 
     | 
    
         
             
                    # Un-favorites the specified Tweets as the authenticating user
         
     | 
| 
         @@ -68,10 +70,9 @@ module Twitter 
     | 
|
| 
       68 
70 
     | 
    
         
             
                    #   @param options [Hash] A customizable set of options.
         
     | 
| 
       69 
71 
     | 
    
         
             
                    def favorite(*args)
         
     | 
| 
       70 
72 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       71 
     | 
    
         
            -
                       
     | 
| 
       72 
     | 
    
         
            -
                        id = extract_id(tweet)
         
     | 
| 
      
 73 
     | 
    
         
            +
                      parallel_map(arguments) do |tweet|
         
     | 
| 
       73 
74 
     | 
    
         
             
                        begin
         
     | 
| 
       74 
     | 
    
         
            -
                           
     | 
| 
      
 75 
     | 
    
         
            +
                          perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
         
     | 
| 
       75 
76 
     | 
    
         
             
                        rescue Twitter::Error::Forbidden => error
         
     | 
| 
       76 
77 
     | 
    
         
             
                          raise unless error.message == Twitter::Error::AlreadyFavorited::MESSAGE
         
     | 
| 
       77 
78 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -96,10 +97,9 @@ module Twitter 
     | 
|
| 
       96 
97 
     | 
    
         
             
                    #   @param options [Hash] A customizable set of options.
         
     | 
| 
       97 
98 
     | 
    
         
             
                    def favorite!(*args)
         
     | 
| 
       98 
99 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       99 
     | 
    
         
            -
                       
     | 
| 
       100 
     | 
    
         
            -
                        id = extract_id(tweet)
         
     | 
| 
      
 100 
     | 
    
         
            +
                      parallel_map(arguments) do |tweet|
         
     | 
| 
       101 
101 
     | 
    
         
             
                        begin
         
     | 
| 
       102 
     | 
    
         
            -
                           
     | 
| 
      
 102 
     | 
    
         
            +
                          perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
         
     | 
| 
       103 
103 
     | 
    
         
             
                        rescue Twitter::Error::Forbidden => error
         
     | 
| 
       104 
104 
     | 
    
         
             
                          handle_forbidden_error(Twitter::Error::AlreadyFavorited, error)
         
     | 
| 
       105 
105 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -2,6 +2,7 @@ require 'twitter/arguments' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'twitter/cursor'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'twitter/error/forbidden'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'twitter/relationship'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       5 
6 
     | 
    
         
             
            require 'twitter/rest/api/utils'
         
     | 
| 
       6 
7 
     | 
    
         
             
            require 'twitter/user'
         
     | 
| 
       7 
8 
     | 
    
         
             
            require 'twitter/utils'
         
     | 
| 
         @@ -11,6 +12,7 @@ module Twitter 
     | 
|
| 
       11 
12 
     | 
    
         
             
                module API
         
     | 
| 
       12 
13 
     | 
    
         
             
                  module FriendsAndFollowers
         
     | 
| 
       13 
14 
     | 
    
         
             
                    include Twitter::REST::API::Utils
         
     | 
| 
      
 15 
     | 
    
         
            +
                    include Twitter::Utils
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
       15 
17 
     | 
    
         
             
                    # @see https://dev.twitter.com/docs/api/1.1/get/friends/ids
         
     | 
| 
       16 
18 
     | 
    
         
             
                    # @rate_limited Yes
         
     | 
| 
         @@ -67,7 +69,7 @@ module Twitter 
     | 
|
| 
       67 
69 
     | 
    
         
             
                    def friendships(*args)
         
     | 
| 
       68 
70 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       69 
71 
     | 
    
         
             
                      merge_users!(arguments.options, arguments)
         
     | 
| 
       70 
     | 
    
         
            -
                       
     | 
| 
      
 72 
     | 
    
         
            +
                      perform_with_objects(:get, '/1.1/friendships/lookup.json', arguments.options, Twitter::User)
         
     | 
| 
       71 
73 
     | 
    
         
             
                    end
         
     | 
| 
       72 
74 
     | 
    
         | 
| 
       73 
75 
     | 
    
         
             
                    # Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user
         
     | 
| 
         @@ -80,7 +82,7 @@ module Twitter 
     | 
|
| 
       80 
82 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       81 
83 
     | 
    
         
             
                    # @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
         
     | 
| 
       82 
84 
     | 
    
         
             
                    def friendships_incoming(options = {})
         
     | 
| 
       83 
     | 
    
         
            -
                       
     | 
| 
      
 85 
     | 
    
         
            +
                      perform_with_cursor(:get, '/1.1/friendships/incoming.json', options, :ids)
         
     | 
| 
       84 
86 
     | 
    
         
             
                    end
         
     | 
| 
       85 
87 
     | 
    
         | 
| 
       86 
88 
     | 
    
         
             
                    # Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request
         
     | 
| 
         @@ -93,7 +95,7 @@ module Twitter 
     | 
|
| 
       93 
95 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       94 
96 
     | 
    
         
             
                    # @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
         
     | 
| 
       95 
97 
     | 
    
         
             
                    def friendships_outgoing(options = {})
         
     | 
| 
       96 
     | 
    
         
            -
                       
     | 
| 
      
 98 
     | 
    
         
            +
                      perform_with_cursor(:get, '/1.1/friendships/outgoing.json', options, :ids)
         
     | 
| 
       97 
99 
     | 
    
         
             
                    end
         
     | 
| 
       98 
100 
     | 
    
         | 
| 
       99 
101 
     | 
    
         
             
                    # Allows the authenticating user to follow the specified users, unless they are already followed
         
     | 
| 
         @@ -115,7 +117,7 @@ module Twitter 
     | 
|
| 
       115 
117 
     | 
    
         
             
                        friend_ids.to_a
         
     | 
| 
       116 
118 
     | 
    
         
             
                      end
         
     | 
| 
       117 
119 
     | 
    
         
             
                      new_friends = Thread.new do
         
     | 
| 
       118 
     | 
    
         
            -
                        users(args). 
     | 
| 
      
 120 
     | 
    
         
            +
                        users(args).collect(&:id)
         
     | 
| 
       119 
121 
     | 
    
         
             
                      end
         
     | 
| 
       120 
122 
     | 
    
         
             
                      follow!(new_friends.value - existing_friends.value, arguments.options)
         
     | 
| 
       121 
123 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -137,8 +139,8 @@ module Twitter 
     | 
|
| 
       137 
139 
     | 
    
         
             
                    #   @option options [Boolean] :follow (false) Enable notifications for the target user.
         
     | 
| 
       138 
140 
     | 
    
         
             
                    def follow!(*args)
         
     | 
| 
       139 
141 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       140 
     | 
    
         
            -
                       
     | 
| 
       141 
     | 
    
         
            -
                         
     | 
| 
      
 142 
     | 
    
         
            +
                      parallel_map(arguments) do |user|
         
     | 
| 
      
 143 
     | 
    
         
            +
                        perform_with_object(:post, '/1.1/friendships/create.json', merge_user(arguments.options, user), Twitter::User)
         
     | 
| 
       142 
144 
     | 
    
         
             
                      end.compact
         
     | 
| 
       143 
145 
     | 
    
         
             
                    end
         
     | 
| 
       144 
146 
     | 
    
         
             
                    alias_method :create_friendship!, :follow!
         
     | 
| 
         @@ -175,7 +177,7 @@ module Twitter 
     | 
|
| 
       175 
177 
     | 
    
         
             
                    # @option options [Boolean] :retweets Enable/disable retweets from the target user.
         
     | 
| 
       176 
178 
     | 
    
         
             
                    def friendship_update(user, options = {})
         
     | 
| 
       177 
179 
     | 
    
         
             
                      merge_user!(options, user)
         
     | 
| 
       178 
     | 
    
         
            -
                       
     | 
| 
      
 180 
     | 
    
         
            +
                      perform_with_object(:post, '/1.1/friendships/update.json', options, Twitter::Relationship)
         
     | 
| 
       179 
181 
     | 
    
         
             
                    end
         
     | 
| 
       180 
182 
     | 
    
         | 
| 
       181 
183 
     | 
    
         
             
                    # Returns detailed information about the relationship between two users
         
     | 
| 
         @@ -193,7 +195,7 @@ module Twitter 
     | 
|
| 
       193 
195 
     | 
    
         
             
                      options[:source_id] = options.delete(:source_user_id) unless options[:source_user_id].nil?
         
     | 
| 
       194 
196 
     | 
    
         
             
                      merge_user!(options, target, 'target')
         
     | 
| 
       195 
197 
     | 
    
         
             
                      options[:target_id] = options.delete(:target_user_id) unless options[:target_user_id].nil?
         
     | 
| 
       196 
     | 
    
         
            -
                       
     | 
| 
      
 198 
     | 
    
         
            +
                      perform_with_object(:get, '/1.1/friendships/show.json', options, Twitter::Relationship)
         
     | 
| 
       197 
199 
     | 
    
         
             
                    end
         
     | 
| 
       198 
200 
     | 
    
         
             
                    alias_method :friendship_show, :friendship
         
     | 
| 
       199 
201 
     | 
    
         
             
                    alias_method :relationship, :friendship
         
     | 
| 
         @@ -273,7 +275,7 @@ module Twitter 
     | 
|
| 
       273 
275 
     | 
    
         
             
                    # @return [Array<Integer>]
         
     | 
| 
       274 
276 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       275 
277 
     | 
    
         
             
                    def no_retweet_ids(options = {})
         
     | 
| 
       276 
     | 
    
         
            -
                      get('/1.1/friendships/no_retweets/ids.json', options)[:body]. 
     | 
| 
      
 278 
     | 
    
         
            +
                      get('/1.1/friendships/no_retweets/ids.json', options)[:body].collect(&:to_i)
         
     | 
| 
       277 
279 
     | 
    
         
             
                    end
         
     | 
| 
       278 
280 
     | 
    
         
             
                    alias_method :no_retweets_ids, :no_retweet_ids
         
     | 
| 
       279 
281 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'twitter/rest/api/utils'
         
     | 
| 
       2 
1 
     | 
    
         
             
            require 'twitter/configuration'
         
     | 
| 
       3 
2 
     | 
    
         
             
            require 'twitter/language'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'twitter/rest/api/utils'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module Twitter
         
     | 
| 
       6 
7 
     | 
    
         
             
              module REST
         
     | 
| 
         @@ -16,7 +17,7 @@ module Twitter 
     | 
|
| 
       16 
17 
     | 
    
         
             
                    # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
         
     | 
| 
       17 
18 
     | 
    
         
             
                    # @return [Twitter::Configuration] Twitter's configuration.
         
     | 
| 
       18 
19 
     | 
    
         
             
                    def configuration(options = {})
         
     | 
| 
       19 
     | 
    
         
            -
                       
     | 
| 
      
 20 
     | 
    
         
            +
                      perform_with_object(:get, '/1.1/help/configuration.json', options, Twitter::Configuration)
         
     | 
| 
       20 
21 
     | 
    
         
             
                    end
         
     | 
| 
       21 
22 
     | 
    
         | 
| 
       22 
23 
     | 
    
         
             
                    # Returns the list of languages supported by Twitter
         
     | 
| 
         @@ -27,7 +28,7 @@ module Twitter 
     | 
|
| 
       27 
28 
     | 
    
         
             
                    # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
         
     | 
| 
       28 
29 
     | 
    
         
             
                    # @return [Array<Twitter::Language>]
         
     | 
| 
       29 
30 
     | 
    
         
             
                    def languages(options = {})
         
     | 
| 
       30 
     | 
    
         
            -
                       
     | 
| 
      
 31 
     | 
    
         
            +
                      perform_with_objects(:get, '/1.1/help/languages.json', options, Twitter::Language)
         
     | 
| 
       31 
32 
     | 
    
         
             
                    end
         
     | 
| 
       32 
33 
     | 
    
         | 
| 
       33 
34 
     | 
    
         
             
                    # Returns {https://twitter.com/privacy Twitter's Privacy Policy}
         
     | 
| 
         @@ -3,6 +3,7 @@ require 'twitter/cursor' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'twitter/error/forbidden'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'twitter/error/not_found'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'twitter/list'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       6 
7 
     | 
    
         
             
            require 'twitter/rest/api/utils'
         
     | 
| 
       7 
8 
     | 
    
         
             
            require 'twitter/tweet'
         
     | 
| 
       8 
9 
     | 
    
         
             
            require 'twitter/user'
         
     | 
| 
         @@ -13,6 +14,7 @@ module Twitter 
     | 
|
| 
       13 
14 
     | 
    
         
             
                module API
         
     | 
| 
       14 
15 
     | 
    
         
             
                  module Lists
         
     | 
| 
       15 
16 
     | 
    
         
             
                    include Twitter::REST::API::Utils
         
     | 
| 
      
 17 
     | 
    
         
            +
                    include Twitter::Utils
         
     | 
| 
       16 
18 
     | 
    
         
             
                    MAX_USERS_PER_REQUEST = 100
         
     | 
| 
       17 
19 
     | 
    
         
             
                    URI_SUBSTRING = '://'
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
         @@ -59,7 +61,7 @@ module Twitter 
     | 
|
| 
       59 
61 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       60 
62 
     | 
    
         
             
                      merge_list!(arguments.options, arguments.pop)
         
     | 
| 
       61 
63 
     | 
    
         
             
                      merge_owner!(arguments.options, arguments.pop)
         
     | 
| 
       62 
     | 
    
         
            -
                       
     | 
| 
      
 64 
     | 
    
         
            +
                      perform_with_objects(:get, '/1.1/lists/statuses.json', arguments.options, Twitter::Tweet)
         
     | 
| 
       63 
65 
     | 
    
         
             
                    end
         
     | 
| 
       64 
66 
     | 
    
         | 
| 
       65 
67 
     | 
    
         
             
                    # Removes the specified member from the list
         
     | 
| 
         @@ -319,7 +321,7 @@ module Twitter 
     | 
|
| 
       319 
321 
     | 
    
         
             
                    # @option options [String] :mode ('public') Whether your list is public or private. Values can be 'public' or 'private'.
         
     | 
| 
       320 
322 
     | 
    
         
             
                    # @option options [String] :description The description to give the list.
         
     | 
| 
       321 
323 
     | 
    
         
             
                    def create_list(name, options = {})
         
     | 
| 
       322 
     | 
    
         
            -
                       
     | 
| 
      
 324 
     | 
    
         
            +
                      perform_with_object(:post, '/1.1/lists/create.json', options.merge(:name => name), Twitter::List)
         
     | 
| 
       323 
325 
     | 
    
         
             
                    end
         
     | 
| 
       324 
326 
     | 
    
         
             
                    deprecate_alias :list_create, :create_list
         
     | 
| 
       325 
327 
     | 
    
         | 
| 
         @@ -411,14 +413,14 @@ module Twitter 
     | 
|
| 
       411 
413 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       412 
414 
     | 
    
         
             
                      merge_list!(arguments.options, arguments.pop)
         
     | 
| 
       413 
415 
     | 
    
         
             
                      merge_owner!(arguments.options, arguments.pop)
         
     | 
| 
       414 
     | 
    
         
            -
                       
     | 
| 
      
 416 
     | 
    
         
            +
                      perform_with_object(request_method, path, arguments.options, Twitter::List)
         
     | 
| 
       415 
417 
     | 
    
         
             
                    end
         
     | 
| 
       416 
418 
     | 
    
         | 
| 
       417 
419 
     | 
    
         
             
                    def cursor_from_response_with_list(request_method, path, args)
         
     | 
| 
       418 
420 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       419 
421 
     | 
    
         
             
                      merge_list!(arguments.options, arguments.pop)
         
     | 
| 
       420 
422 
     | 
    
         
             
                      merge_owner!(arguments.options, arguments.pop)
         
     | 
| 
       421 
     | 
    
         
            -
                       
     | 
| 
      
 423 
     | 
    
         
            +
                      perform_with_cursor(request_method, path, arguments.options, :users, Twitter::User)
         
     | 
| 
       422 
424 
     | 
    
         
             
                    end
         
     | 
| 
       423 
425 
     | 
    
         | 
| 
       424 
426 
     | 
    
         
             
                    def list_user?(request_method, path, args)
         
     | 
| 
         @@ -437,7 +439,7 @@ module Twitter 
     | 
|
| 
       437 
439 
     | 
    
         
             
                      merge_user!(arguments.options, arguments.pop)
         
     | 
| 
       438 
440 
     | 
    
         
             
                      merge_list!(arguments.options, arguments.pop)
         
     | 
| 
       439 
441 
     | 
    
         
             
                      merge_owner!(arguments.options, arguments.pop)
         
     | 
| 
       440 
     | 
    
         
            -
                       
     | 
| 
      
 442 
     | 
    
         
            +
                      perform_with_object(request_method, path, arguments.options, Twitter::List)
         
     | 
| 
       441 
443 
     | 
    
         
             
                    end
         
     | 
| 
       442 
444 
     | 
    
         | 
| 
       443 
445 
     | 
    
         
             
                    def list_from_response_with_users(request_method, path, args)
         
     | 
| 
         @@ -446,8 +448,8 @@ module Twitter 
     | 
|
| 
       446 
448 
     | 
    
         
             
                      members = arguments.pop
         
     | 
| 
       447 
449 
     | 
    
         
             
                      merge_list!(options, arguments.pop)
         
     | 
| 
       448 
450 
     | 
    
         
             
                      merge_owner!(options, arguments.pop)
         
     | 
| 
       449 
     | 
    
         
            -
                       
     | 
| 
       450 
     | 
    
         
            -
                         
     | 
| 
      
 451 
     | 
    
         
            +
                      parallel_map(members.flatten.each_slice(MAX_USERS_PER_REQUEST)) do |users|
         
     | 
| 
      
 452 
     | 
    
         
            +
                        perform_with_object(request_method, path, merge_users(options, users), Twitter::List)
         
     | 
| 
       451 
453 
     | 
    
         
             
                      end.last
         
     | 
| 
       452 
454 
     | 
    
         
             
                    end
         
     | 
| 
       453 
455 
     | 
    
         | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       1 
2 
     | 
    
         
             
            require 'twitter/rest/api/utils'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'twitter/token'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'twitter/rest/response/parse_error_json'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'twitter/token'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module Twitter
         
     | 
| 
       6 
7 
     | 
    
         
             
              module REST
         
     | 
| 
         @@ -19,11 +20,14 @@ module Twitter 
     | 
|
| 
       19 
20 
     | 
    
         
             
                    # @authentication Required
         
     | 
| 
       20 
21 
     | 
    
         
             
                    # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
         
     | 
| 
       21 
22 
     | 
    
         
             
                    # @return [Twitter::Token] The Bearer Token. token_type should be 'bearer'.
         
     | 
| 
      
 23 
     | 
    
         
            +
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       22 
24 
     | 
    
         
             
                    # @example Generate a Bearer Token
         
     | 
| 
       23 
25 
     | 
    
         
             
                    #   client = Twitter::REST::Client.new(:consumer_key => "abc", :consumer_secret => 'def')
         
     | 
| 
       24 
26 
     | 
    
         
             
                    #   bearer_token = client.token
         
     | 
| 
       25 
     | 
    
         
            -
                    def token
         
     | 
| 
       26 
     | 
    
         
            -
                       
     | 
| 
      
 27 
     | 
    
         
            +
                    def token(options = {})
         
     | 
| 
      
 28 
     | 
    
         
            +
                      options[:bearer_token_request] = true
         
     | 
| 
      
 29 
     | 
    
         
            +
                      options[:grant_type] ||= 'client_credentials'
         
     | 
| 
      
 30 
     | 
    
         
            +
                      perform_with_object(:post, '/oauth2/token', options, Twitter::Token)
         
     | 
| 
       27 
31 
     | 
    
         
             
                    end
         
     | 
| 
       28 
32 
     | 
    
         
             
                    alias_method :bearer_token, :token
         
     | 
| 
       29 
33 
     | 
    
         | 
| 
         @@ -34,10 +38,12 @@ module Twitter 
     | 
|
| 
       34 
38 
     | 
    
         
             
                    # @authentication Required
         
     | 
| 
       35 
39 
     | 
    
         
             
                    # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
         
     | 
| 
       36 
40 
     | 
    
         
             
                    # @param access_token [String, Twitter::Token] The bearer token to revoke.
         
     | 
| 
      
 41 
     | 
    
         
            +
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       37 
42 
     | 
    
         
             
                    # @return [Twitter::Token] The invalidated token. token_type should be nil.
         
     | 
| 
       38 
     | 
    
         
            -
                    def invalidate_token(access_token)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    def invalidate_token(access_token, options = {})
         
     | 
| 
       39 
44 
     | 
    
         
             
                      access_token = access_token.access_token if access_token.is_a?(Twitter::Token)
         
     | 
| 
       40 
     | 
    
         
            -
                       
     | 
| 
      
 45 
     | 
    
         
            +
                      options[:access_token] = access_token
         
     | 
| 
      
 46 
     | 
    
         
            +
                      perform_with_object(:post, '/oauth2/invalidate_token', options, Twitter::Token)
         
     | 
| 
       41 
47 
     | 
    
         
             
                    end
         
     | 
| 
       42 
48 
     | 
    
         | 
| 
       43 
49 
     | 
    
         
             
                    # Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials.
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'twitter/rest/api/utils'
         
     | 
| 
       2 
1 
     | 
    
         
             
            require 'twitter/geo_results'
         
     | 
| 
       3 
2 
     | 
    
         
             
            require 'twitter/place'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'twitter/rest/api/utils'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            module Twitter
         
     | 
| 
       6 
7 
     | 
    
         
             
              module REST
         
     | 
| 
         @@ -18,7 +19,7 @@ module Twitter 
     | 
|
| 
       18 
19 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       19 
20 
     | 
    
         
             
                    # @return [Twitter::Place] The requested place.
         
     | 
| 
       20 
21 
     | 
    
         
             
                    def place(place_id, options = {})
         
     | 
| 
       21 
     | 
    
         
            -
                       
     | 
| 
      
 22 
     | 
    
         
            +
                      perform_with_object(:get, "/1.1/geo/id/#{place_id}.json", options, Twitter::Place)
         
     | 
| 
       22 
23 
     | 
    
         
             
                    end
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
                    # Searches for up to 20 places that can be used as a place_id
         
     | 
| 
         @@ -36,7 +37,7 @@ module Twitter 
     | 
|
| 
       36 
37 
     | 
    
         
             
                    # @option options [Integer] :max_results A hint as to the number of results to return. This does not guarantee that the number of results returned will equal max_results, but instead informs how many "nearby" results to return. Ideally, only pass in the number of places you intend to display to the user here.
         
     | 
| 
       37 
38 
     | 
    
         
             
                    # @return [Array<Twitter::Place>]
         
     | 
| 
       38 
39 
     | 
    
         
             
                    def reverse_geocode(options = {})
         
     | 
| 
       39 
     | 
    
         
            -
                       
     | 
| 
      
 40 
     | 
    
         
            +
                      perform_with_object(:get, '/1.1/geo/reverse_geocode.json', options, Twitter::GeoResults)
         
     | 
| 
       40 
41 
     | 
    
         
             
                    end
         
     | 
| 
       41 
42 
     | 
    
         | 
| 
       42 
43 
     | 
    
         
             
                    # Search for places that can be attached to a {Twitter::REST::API::Tweets#update}
         
     | 
| 
         @@ -57,7 +58,7 @@ module Twitter 
     | 
|
| 
       57 
58 
     | 
    
         
             
                    # @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
         
     | 
| 
       58 
59 
     | 
    
         
             
                    # @return [Array<Twitter::Place>]
         
     | 
| 
       59 
60 
     | 
    
         
             
                    def geo_search(options = {})
         
     | 
| 
       60 
     | 
    
         
            -
                       
     | 
| 
      
 61 
     | 
    
         
            +
                      perform_with_object(:get, '/1.1/geo/search.json', options, Twitter::GeoResults)
         
     | 
| 
       61 
62 
     | 
    
         
             
                    end
         
     | 
| 
       62 
63 
     | 
    
         
             
                    alias_method :places_nearby, :geo_search
         
     | 
| 
       63 
64 
     | 
    
         | 
| 
         @@ -76,7 +77,7 @@ module Twitter 
     | 
|
| 
       76 
77 
     | 
    
         
             
                    # @option options [String] :"attribute:street_address" This option searches for places which have this given street address. There are other well-known and application-specific attributes available. Custom attributes are also permitted.
         
     | 
| 
       77 
78 
     | 
    
         
             
                    # @return [Array<Twitter::Place>]
         
     | 
| 
       78 
79 
     | 
    
         
             
                    def similar_places(options = {})
         
     | 
| 
       79 
     | 
    
         
            -
                       
     | 
| 
      
 80 
     | 
    
         
            +
                      perform_with_object(:get, '/1.1/geo/similar_places.json', options, Twitter::GeoResults)
         
     | 
| 
       80 
81 
     | 
    
         
             
                    end
         
     | 
| 
       81 
82 
     | 
    
         
             
                    alias_method :places_similar, :similar_places
         
     | 
| 
       82 
83 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'twitter/arguments'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       2 
3 
     | 
    
         
             
            require 'twitter/rest/api/utils'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'twitter/saved_search'
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'twitter/utils'
         
     | 
| 
         @@ -8,6 +9,7 @@ module Twitter 
     | 
|
| 
       8 
9 
     | 
    
         
             
                module API
         
     | 
| 
       9 
10 
     | 
    
         
             
                  module SavedSearches
         
     | 
| 
       10 
11 
     | 
    
         
             
                    include Twitter::REST::API::Utils
         
     | 
| 
      
 12 
     | 
    
         
            +
                    include Twitter::Utils
         
     | 
| 
       11 
13 
     | 
    
         | 
| 
       12 
14 
     | 
    
         
             
                    # @rate_limited Yes
         
     | 
| 
       13 
15 
     | 
    
         
             
                    # @authentication Requires user context
         
     | 
| 
         @@ -32,9 +34,9 @@ module Twitter 
     | 
|
| 
       32 
34 
     | 
    
         
             
                    def saved_searches(*args)
         
     | 
| 
       33 
35 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       34 
36 
     | 
    
         
             
                      if arguments.empty?
         
     | 
| 
       35 
     | 
    
         
            -
                         
     | 
| 
      
 37 
     | 
    
         
            +
                        perform_with_objects(:get, '/1.1/saved_searches/list.json', arguments.options, Twitter::SavedSearch)
         
     | 
| 
       36 
38 
     | 
    
         
             
                      else
         
     | 
| 
       37 
     | 
    
         
            -
                         
     | 
| 
      
 39 
     | 
    
         
            +
                        parallel_map(arguments) do |id|
         
     | 
| 
       38 
40 
     | 
    
         
             
                          saved_search(id, arguments.options)
         
     | 
| 
       39 
41 
     | 
    
         
             
                        end
         
     | 
| 
       40 
42 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -50,7 +52,7 @@ module Twitter 
     | 
|
| 
       50 
52 
     | 
    
         
             
                    # @param id [Integer] The ID of the saved search.
         
     | 
| 
       51 
53 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       52 
54 
     | 
    
         
             
                    def saved_search(id, options = {})
         
     | 
| 
       53 
     | 
    
         
            -
                       
     | 
| 
      
 55 
     | 
    
         
            +
                      perform_with_object(:get, "/1.1/saved_searches/show/#{id}.json", options, Twitter::SavedSearch)
         
     | 
| 
       54 
56 
     | 
    
         
             
                    end
         
     | 
| 
       55 
57 
     | 
    
         | 
| 
       56 
58 
     | 
    
         
             
                    # Creates a saved search for the authenticated user
         
     | 
| 
         @@ -63,7 +65,7 @@ module Twitter 
     | 
|
| 
       63 
65 
     | 
    
         
             
                    # @param query [String] The query of the search the user would like to save.
         
     | 
| 
       64 
66 
     | 
    
         
             
                    # @param options [Hash] A customizable set of options.
         
     | 
| 
       65 
67 
     | 
    
         
             
                    def create_saved_search(query, options = {})
         
     | 
| 
       66 
     | 
    
         
            -
                       
     | 
| 
      
 68 
     | 
    
         
            +
                      perform_with_object(:post, '/1.1/saved_searches/create.json', options.merge(:query => query), Twitter::SavedSearch)
         
     | 
| 
       67 
69 
     | 
    
         
             
                    end
         
     | 
| 
       68 
70 
     | 
    
         
             
                    deprecate_alias :saved_search_create, :create_saved_search
         
     | 
| 
       69 
71 
     | 
    
         | 
| 
         @@ -82,8 +84,8 @@ module Twitter 
     | 
|
| 
       82 
84 
     | 
    
         
             
                    #   @param options [Hash] A customizable set of options.
         
     | 
| 
       83 
85 
     | 
    
         
             
                    def destroy_saved_search(*args)
         
     | 
| 
       84 
86 
     | 
    
         
             
                      arguments = Twitter::Arguments.new(args)
         
     | 
| 
       85 
     | 
    
         
            -
                       
     | 
| 
       86 
     | 
    
         
            -
                         
     | 
| 
      
 87 
     | 
    
         
            +
                      parallel_map(arguments) do |id|
         
     | 
| 
      
 88 
     | 
    
         
            +
                        perform_with_object(:post, "/1.1/saved_searches/destroy/#{id}.json", arguments.options, Twitter::SavedSearch)
         
     | 
| 
       87 
89 
     | 
    
         
             
                      end
         
     | 
| 
       88 
90 
     | 
    
         
             
                    end
         
     | 
| 
       89 
91 
     | 
    
         
             
                    deprecate_alias :saved_search_destroy, :destroy_saved_search
         
     | 
| 
         @@ -1,11 +1,10 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'twitter/ 
     | 
| 
      
 1 
     | 
    
         
            +
            require 'twitter/request'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'twitter/search_results'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            module Twitter
         
     | 
| 
       5 
5 
     | 
    
         
             
              module REST
         
     | 
| 
       6 
6 
     | 
    
         
             
                module API
         
     | 
| 
       7 
7 
     | 
    
         
             
                  module Search
         
     | 
| 
       8 
     | 
    
         
            -
                    include Twitter::REST::API::Utils
         
     | 
| 
       9 
8 
     | 
    
         
             
                    MAX_TWEETS_PER_REQUEST = 100
         
     | 
| 
       10 
9 
     | 
    
         | 
| 
       11 
10 
     | 
    
         
             
                    # Returns tweets that match a specified query.
         
     | 
| 
         @@ -30,14 +29,9 @@ module Twitter 
     | 
|
| 
       30 
29 
     | 
    
         
             
                    # @return [Twitter::SearchResults] Return tweets that match a specified query with search metadata
         
     | 
| 
       31 
30 
     | 
    
         
             
                    def search(q, options = {})
         
     | 
| 
       32 
31 
     | 
    
         
             
                      options[:count] ||= MAX_TWEETS_PER_REQUEST
         
     | 
| 
       33 
     | 
    
         
            -
                       
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                  private
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                    def search_results_from_response(request_method, path, options = {}) # rubocop:disable ParameterLists
         
     | 
| 
       39 
     | 
    
         
            -
                      response = send(request_method.to_sym, path, options)
         
     | 
| 
       40 
     | 
    
         
            -
                      Twitter::SearchResults.from_response(response, self, request_method, path, options)
         
     | 
| 
      
 32 
     | 
    
         
            +
                      request = Twitter::Request.new(self, :get, '/1.1/search/tweets.json', options.merge(:q => q))
         
     | 
| 
      
 33 
     | 
    
         
            +
                      response = get(request.path, request.options)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      Twitter::SearchResults.from_response(response, request)
         
     | 
| 
       41 
35 
     | 
    
         
             
                    end
         
     | 
| 
       42 
36 
     | 
    
         
             
                  end
         
     | 
| 
       43 
37 
     | 
    
         
             
                end
         
     |