lib/twitter/rest/api/utils.rb in twitter-5.3.0 vs lib/twitter/rest/api/utils.rb in twitter-5.3.1
- old
+ new
@@ -1,9 +1,10 @@
require 'addressable/uri'
require 'twitter/arguments'
require 'twitter/cursor'
require 'twitter/user'
+require 'twitter/utils'
module Twitter
module REST
module API
module Utils
@@ -48,11 +49,11 @@
# @param path [String]
# @param args [Array]
# @return [Array<Twitter::User>]
def threaded_user_objects_from_response(request_method, path, args)
arguments = Twitter::Arguments.new(args)
- arguments.flatten.threaded_map do |user|
+ Twitter::Utils.parallel_map(arguments) do |user|
object_from_response(Twitter::User, request_method, path, merge_user(arguments.options, user))
end
end
# @param request_method [Symbol]
@@ -100,10 +101,10 @@
# @param path [String]
# @param args [Array]
# @return [Array]
def threaded_objects_from_response(klass, request_method, path, args) # rubocop:disable ParameterLists
arguments = Twitter::Arguments.new(args)
- arguments.flatten.threaded_map do |object|
+ Twitter::Utils.parallel_map(arguments) do |object|
id = extract_id(object)
object_from_response(klass, request_method, path, arguments.options.merge(:id => id))
end
end