How can I get a Twitter screenname/username with the twitter_oauth gem using their id?
How can I get a Twitter screenname/username with th开发者_开发百科e twitter_oauth gem using their id?
Here you go, a sample in irb:
require 'rubygems'
require 'twitter_oauth'
client = TwitterOAuth::Client.new
id = '5452272'
temp = client.show(id)
puts "Screenname: #{temp['screen_name']}, UserName: #{temp['name']}"
精彩评论