Skip to content

Commit

Permalink
Call GET users/show if screen name has already been fetched
Browse files Browse the repository at this point in the history
Closes #561.
  • Loading branch information
sferik committed May 2, 2014
1 parent 26a9b0c commit 0691a62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/twitter/rest/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ def users(*args)
# @option options [Boolean, String, Integer] :skip_status Do not include user's Tweets when set to true, 't' or 1.
def user(*args)
arguments = Twitter::Arguments.new(args)
if arguments.last
merge_user!(arguments.options, arguments.pop)
if arguments.last || screen_name?
merge_user!(arguments.options, arguments.pop || screen_name)
perform_with_object(:get, '/1.1/users/show.json', arguments.options, Twitter::User)
else
verify_credentials(arguments.options)
Expand Down
4 changes: 4 additions & 0 deletions lib/twitter/rest/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ def screen_name
@screen_name ||= verify_credentials.screen_name
end

def screen_name?
instance_variable_defined?(:@screen_name)
end

def merge_default_cursor!(options)
options[:cursor] = DEFAULT_CURSOR unless options[:cursor]
end
Expand Down

0 comments on commit 0691a62

Please sign in to comment.