lib/twitter/cursor.rb in twitter-5.12.0 vs lib/twitter/cursor.rb in twitter-5.13.0

- old
+ new

@@ -1,6 +1,7 @@ require 'twitter/enumerable' +require 'twitter/rest/request' require 'twitter/utils' module Twitter class Cursor include Twitter::Enumerable @@ -11,24 +12,23 @@ alias_method :to_hash, :to_h deprecate_alias :to_hsh, :to_hash # Initializes a new Cursor # - # @param attrs [Hash] # @param key [String, Symbol] The key to fetch the data from the response # @param klass [Class] The class to instantiate objects in the response - # @param request [Twitter::Request] + # @param request [Twitter::REST::Request] # @return [Twitter::Cursor] - def initialize(attrs, key, klass, request) + def initialize(key, klass, request) @key = key.to_sym @klass = klass @client = request.client @request_method = request.verb @path = request.path @options = request.options @collection = [] - self.attrs = attrs + self.attrs = request.perform end private # @return [Integer] @@ -42,10 +42,10 @@ next_cursor.zero? end # @return [Hash] def fetch_next_page - response = @client.send(@request_method, @path, @options.merge(:cursor => next_cursor)).body + response = Twitter::REST::Request.new(@client, @request_method, @path, @options.merge(:cursor => next_cursor)).perform self.attrs = response end # @param attrs [Hash] # @return [Hash]