Skip to content

Commit

Permalink
Rename threaded_ methods to parallel_
Browse files Browse the repository at this point in the history
Threads are an implementation detail. See discussion with @charliesome:
#503
  • Loading branch information
sferik committed Jan 4, 2014
1 parent c9fbd3e commit 940e57f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/twitter/rest/api/direct_messages.rb
Expand Up @@ -109,7 +109,7 @@ def direct_messages(*args)
# @param ids [Enumerable<Integer>] A collection of direct message IDs.
# @param options [Hash] A customizable set of options.
def destroy_direct_message(*args)
threaded_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
parallel_objects_from_response(Twitter::DirectMessage, :post, '/1.1/direct_messages/destroy.json', args)
end
deprecate_alias :direct_message_destroy, :destroy_direct_message

Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/api/favorites.rb
Expand Up @@ -49,7 +49,7 @@ def favorites(*args)
# @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
# @param options [Hash] A customizable set of options.
def unfavorite(*args)
threaded_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
parallel_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
end
alias_method :destroy_favorite, :unfavorite
deprecate_alias :favorite_destroy, :unfavorite
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/api/friends_and_followers.rb
Expand Up @@ -157,7 +157,7 @@ def follow!(*args)
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def unfollow(*args)
threaded_user_objects_from_response(:post, '/1.1/friendships/destroy.json', args)
parallel_user_objects_from_response(:post, '/1.1/friendships/destroy.json', args)
end
alias_method :destroy_friendship, :unfollow
deprecate_alias :friendship_destroy, :unfollow
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/rest/api/spam_reporting.rb
Expand Up @@ -20,7 +20,7 @@ module SpamReporting
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def report_spam(*args)
threaded_user_objects_from_response(:post, '/1.1/users/report_spam.json', args)
parallel_user_objects_from_response(:post, '/1.1/users/report_spam.json', args)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/twitter/rest/api/tweets.rb
Expand Up @@ -77,7 +77,7 @@ def status(tweet, options = {})
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def statuses(*args)
threaded_tweets_from_response(:get, '/1.1/statuses/show', args)
parallel_tweets_from_response(:get, '/1.1/statuses/show', args)
end

# Destroys the specified Tweets
Expand All @@ -95,7 +95,7 @@ def statuses(*args)
# @param options [Hash] A customizable set of options.
# @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author's numerical ID when set to true, 't' or 1.
def destroy_status(*args)
threaded_tweets_from_response(:post, '/1.1/statuses/destroy', args)
parallel_tweets_from_response(:post, '/1.1/statuses/destroy', args)
end
alias_method :destroy_tweet, :destroy_status
deprecate_alias :status_destroy, :destroy_status
Expand Down Expand Up @@ -280,7 +280,7 @@ def retweeters_ids(*args)
# @param path [String]
# @param args [Array]
# @return [Array<Twitter::Tweet>]
def threaded_tweets_from_response(request_method, path, args)
def parallel_tweets_from_response(request_method, path, args)
arguments = Twitter::Arguments.new(args)
Twitter::Utils.parallel_map(arguments) do |tweet|
id = extract_id(tweet)
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/rest/api/users.rb
Expand Up @@ -191,7 +191,7 @@ def block?(user, options = {})
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def block(*args)
threaded_user_objects_from_response(:post, '/1.1/blocks/create.json', args)
parallel_user_objects_from_response(:post, '/1.1/blocks/create.json', args)
end

# Un-blocks the users specified by the authenticating user
Expand All @@ -207,7 +207,7 @@ def block(*args)
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects.
# @param options [Hash] A customizable set of options.
def unblock(*args)
threaded_user_objects_from_response(:post, '/1.1/blocks/destroy.json', args)
parallel_user_objects_from_response(:post, '/1.1/blocks/destroy.json', args)
end

# Returns extended information for up to 100 users
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/rest/api/utils.rb
Expand Up @@ -49,7 +49,7 @@ def extract_id(object)
# @param path [String]
# @param args [Array]
# @return [Array<Twitter::User>]
def threaded_user_objects_from_response(request_method, path, args)
def parallel_user_objects_from_response(request_method, path, args)
arguments = Twitter::Arguments.new(args)
Twitter::Utils.parallel_map(arguments) do |user|
object_from_response(Twitter::User, request_method, path, merge_user(arguments.options, user))
Expand Down Expand Up @@ -101,7 +101,7 @@ def objects_from_array(klass, array)
# @param path [String]
# @param args [Array]
# @return [Array]
def threaded_objects_from_response(klass, request_method, path, args) # rubocop:disable ParameterLists
def parallel_objects_from_response(klass, request_method, path, args) # rubocop:disable ParameterLists
arguments = Twitter::Arguments.new(args)
Twitter::Utils.parallel_map(arguments) do |object|
id = extract_id(object)
Expand Down

0 comments on commit 940e57f

Please sign in to comment.