[Facebooker-talk] Is Session.users weird or is it me?

Ethan Herdrick herdrick at gmail.com
Sun Feb 22 17:06:22 EST 2009


Thank you Alan.


On Sun, Feb 22, 2009 at 3:03 AM, Alan Larkin <alan.larkin at gmail.com> wrote:
> You will kick yourself ...
>
> Session#get_users returns an array of Facebooker::User.
> Facebooker::User#to_s just returns the id as a string. Try
>
> p session.users(user_ids, fields).inspect
>
> Alan.
>
> Ethan Herdrick wrote:
>>
>> Here's my problem: I'm trying to use Facebooker::Session.users but it
>> seems to be broken, or more likely, my use of it is broken.  What I'm
>> seeing is that when I call it it just returns the user ids array I
>> pass it.
>>
>> (For the following code, assume this:
>>  user_ids = [3201111, 556161111, 501411111, 687861111]
>>  fields = [:uid, :first_name, :last_name, :name, :timezone,
>> :birthday, :sex, :affiliations, :locale, :profile_url, :proxied_email]
>>  fields_string = fields.join ","
>> )
>>
>>  with_users_method = session.users(user_ids, fields)
>>  puts "with_users_method = " + with_users_method.join(" *** ")
>>
>> Which gave me:
>> with_users_method = 3201111 *** 556161111 *** 501411111 *** 687861111
>>
>> Odd, eh?  So I looked at the source of Session.users and tried making
>> some changes and it works now, kinda.  What I did was simply adapt
>> that code by omiting the block that is passed to session.post, like
>> so:
>>
>>  with_getInfo_no_block =
>>
>> session.post("facebook.users.getInfo",:uids=>user_ids.join(","),:fields=>fields_string)
>>  puts "with_getInfo_no_block = "  + with_getInfo_no_block.join(" *** ")
>>
>> Which gives:
>> with_getInfo_no_block = nameDaniel
>> SmithaffiliationsnameDISQUStypeworkyear0statusnid504602nameUC
>> Davistypecollegeyear0statusUndergradnid16777249nameVTbare,
>> Inc.typeworkyear0statusnid50432nameSan Francisco,
>>
>> CAtyperegionyear0statusnid67108894timezoneuid3205241proxied_emailsexprofile_urlhttp://www.facebook.com/profile.php?id=32052birthdaylast_nameSmithlocaleen_USfirst_nameDaniel
>> *** nameKendra JonesaffiliationsnameNew York,
>>
>> NYtyperegionyear0statusnid671086nameColumbiatypecollegeyear2003statusAlumnus/Alumnanid16777219timezone-5uid556167404proxied_emailsexfemaleprofile_urlhttp://www.facebook.com/profile.php?id=5561birthdayAugust
>> 25last_nameJoneslocaleen_USfirst_nameKendra *** nameNatalie
>> HanesaffiliationsnameUniversity of
>> Michigantypecollegeyear2001statusGrad Studentnid167058nameBrighton and
>>
>> Hovetyperegionyear0statusnid67914timezoneuid501410355proxied_emailsexprofile_urlhttp://www.facebook.com/s.php?k=100000080&amp;id=5012222birthdaylast_nameHaneslocaleen_GBfirst_nameNatalie
>> *** nameAllen EthanaffiliationsnameSpokane,
>>
>> WAtyperegionyear0statusnid67109timezoneuid687869280proxied_emailapps+55035481363.687869280.38074720380e9a5306b7e5c2910b070b at proxymail.facebook.comsexprofile_urlhttp://www.facebook.com/s.php?k=100000080&amp;id=687861111birthdaylast_nameEthanlocaleen_USfirst_nameAllen
>>
>> All the info I want is there, if a bit smashed together.  What am I
>> doing wrong?
>>
>> Lee Connell has mentioned that I should use an auth token.  What is
>> this?  Is it related to this problem I'm having?  I have a live app
>> doing offline API calls that seem to work fine without setting an auth
>> token, btw.
>>
>> Thanks in advance.
>>
>>
>>
>>
>>
>> On Fri, Feb 20, 2009 at 9:52 PM, Ethan Herdrick <herdrick at gmail.com>
>> wrote:
>>>
>>> Thanks, Lee!
>>>
>>> But Facebooker::Session doesn't have a populate method.  I've tried
>>> Facebooker::Session.users, but it breaks, claiming my session key is
>>> invalid.  Not sure what's going on there.
>>>
>>> -Ethan
>>>
>>> On Fri, Feb 20, 2009 at 7:35 AM, Lee Connell <lee.a.connell at gmail.com>
>>> wrote:
>>>>
>>>> you get it through calling the method populate on your facebook session,
>>>> passing it arguments of what fields you want, lilke :name, :last_name,
>>>> :uid
>>>> etc... then you access it through the user object, "session.user.name,
>>>> session.user.last_name" I don't have the code i was working on in front
>>>> of
>>>> me but that should get you started.
>>>>
>>>> On Thu, Feb 19, 2009 at 3:46 AM, Ethan Herdrick <herdrick at gmail.com>
>>>> wrote:
>>>>>
>>>>> Where is Facebooker's wrapper of the FB API Users.getInfo ?
>>>>>
>>>>> (http://wiki.developers.facebook.com/index.php/Users.getInfo)
>>>>>
>>>>> Thanks!
>>>>> _______________________________________________
>>>>> Facebooker-talk mailing list
>>>>> Facebooker-talk at rubyforge.org
>>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>>>>
>> _______________________________________________
>> Facebooker-talk mailing list
>> Facebooker-talk at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>>
>
> _______________________________________________
> Facebooker-talk mailing list
> Facebooker-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/facebooker-talk
>


More information about the Facebooker-talk mailing list