randombits
randombits

Reputation: 48450

Twitter Ruby Gem - get friends names and ids, nothing more

Is it possible to simply get the people you are following with just an id and full name? I do not need any of the additional data, it's a waste of bandwidth.

Currently the only solution I have is:

 twitter_client = Twitter::Client.new
 friend_ids = twitter_client.friend_ids['ids']
 friends = twitter_client.users(friend_ids).map { |f| {:twitter_id => f.id, :name => f.name} }

is there anyway to just have users returned be an array of ids and full names? better way of doing it than the way depicted above? preferably a way to not filter on the client side.

Upvotes: 0

Views: 1764

Answers (1)

deviousdodo
deviousdodo

Reputation: 9172

The users method uses the users/lookup API call. As you can see on the page, the only param available is include_entities. The only other method which helps you find users has the same limitation. So you cannot download only the needed attributes.

The only other thing I'd like to say is that you could directly use the friends variable, I don't see any benefit of running the map on it.

Upvotes: 2

Related Questions