populate logged in user with restricted set of fields

2 views
Skip to first unread message

klochner

unread,
Nov 20, 2009, 5:14:05 PM11/20/09
to facebooker
I'm finally up-to-date again with the facebooker code base, going to
be working on streamlining the facebook connect authentication.

First up, is there any easy way to restrict the fields used to
populate the logged-in user?

From what I gather, the easiest way is to do something like the
following:

class Facebooker::User
populating_attr_accessor *MIN_FIELDS
end

Ideally I'd like to be able to do something like this:

> facebook_session.user(MIN_FIELDS)

or something along those lines. That way I don't change the default
way in which a user is populated.

Is my best bet to do the first option (change
populating_attr_accessor), and then just use facebook_session.users
(FIELDS) to get the full user information?

Also, I noticed the following that looks like an error (users_standard
--> user_fields, users --> standard_fields):

def users_standard(user_ids, fields=[])
post("facebook.users.getStandardInfo",:uids=>user_ids.join
(","),:fields=>User.user_fields(fields)) do |users|
users.map { |u| User.new(u)}
end
end

def users(user_ids, fields=[])
post("facebook.users.getInfo",:uids=>user_ids.join
(","),:fields=>User.standard_fields(fields)) do |users|
users.map { |u| User.new(u)}
end
Reply all
Reply to author
Forward
0 new messages