Hi,
I started with rfacebook but given the recent events figure its best
to move over to facebooker.
I have:
1.) Installed the facebooker plugin
2.) setup my facebook app (fbml/canvas)
3.) created a method on controller & view to handle initial request
4.) added "ensure_application_is_installed_by_facebook_user" to top
off application.rb
I am able to get to my landing page and show the facebook id of the
users that comes in, but...
If I try to show the users friends in the view using:
<% for a_friend in @user.friends %>
<%=a_friend.first_name%>
<% end %>
It makes my server hang, for about 70 seconds, then the method seems
to complete. Note, I had similar functionality working in rfacebook,
so I don''t think its an environmental thing.
What could I be doing wrong?
Also, I have done some reading on issues with running a non facebook
application with this setup on same application, what should I do?
a.) Create a subclass of my ApplicationController called
FaceController to do all the facebook related stuff?
b.) Is there a way to do an if around
"ensure_application_is_installed_by_facebook_user" so that it is only
enforced if coming from facebook?
Does anyone have an example app, example code of how to do common
things?, I looked through kitchen sink and there is nothing in there?
I will blog how to do this TODAY if you guys help me get it going.
thanks
Joel
Facebooker is querying facebook and looking up the name of each friend, one at a time. We populate the the friends array from the ID list that is passed in via Facebook. If you want this output without having to query facebook for each friends, you can use: <%= fb_name a_friend,: firstnameonly=>true %> Mike On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote:> Hi, > > I started with rfacebook but given the recent events figure its best > to move over to facebooker. > > I have: > > 1.) Installed the facebooker plugin > 2.) setup my facebook app (fbml/canvas) > 3.) created a method on controller & view to handle initial request > 4.) added "ensure_application_is_installed_by_facebook_user" to top > off application.rb > > I am able to get to my landing page and show the facebook id of the > users that comes in, but... > > If I try to show the users friends in the view using: > <% for a_friend in @user.friends %> > <%=a_friend.first_name%> > <% end %> > > It makes my server hang, for about 70 seconds, then the method seems > to complete. Note, I had similar functionality working in rfacebook, > so I don''t think its an environmental thing. > > What could I be doing wrong? > > Also, I have done some reading on issues with running a non facebook > application with this setup on same application, what should I do? > > a.) Create a subclass of my ApplicationController called > FaceController to do all the facebook related stuff? > b.) Is there a way to do an if around > "ensure_application_is_installed_by_facebook_user" so that it is only > enforced if coming from facebook? > > Does anyone have an example app, example code of how to do common > things?, I looked through kitchen sink and there is nothing in there? > I will blog how to do this TODAY if you guys help me get it going. > > thanks > Joel > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
Shawn Van Ittersum
2008-Jan-24 19:41 UTC
[Facebooker-talk] getting started with facebooker
Can Facebooker be modified to call FB''s getInfo on a list of friend ID''s instead of one at a time? Shawn On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote:> Facebooker is querying facebook and looking up the name of each > friend, one at a time. We populate the the friends array from the ID > list that is passed in via Facebook. > > If you want this output without having to query facebook for each > friends, you can use: > > <%= fb_name a_friend,: firstnameonly=>true %> > > Mike > > On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: > >> Hi, >> >> I started with rfacebook but given the recent events figure its best >> to move over to facebooker. >> >> I have: >> >> 1.) Installed the facebooker plugin >> 2.) setup my facebook app (fbml/canvas) >> 3.) created a method on controller & view to handle initial request >> 4.) added "ensure_application_is_installed_by_facebook_user" to top >> off application.rb >> >> I am able to get to my landing page and show the facebook id of the >> users that comes in, but... >> >> If I try to show the users friends in the view using: >> <% for a_friend in @user.friends %> >> <%=a_friend.first_name%> >> <% end %> >> >> It makes my server hang, for about 70 seconds, then the method seems >> to complete. Note, I had similar functionality working in rfacebook, >> so I don''t think its an environmental thing. >> >> What could I be doing wrong? >> >> Also, I have done some reading on issues with running a non facebook >> application with this setup on same application, what should I do? >> >> a.) Create a subclass of my ApplicationController called >> FaceController to do all the facebook related stuff? >> b.) Is there a way to do an if around >> "ensure_application_is_installed_by_facebook_user" so that it is only >> enforced if coming from facebook? >> >> Does anyone have an example app, example code of how to do common >> things?, I looked through kitchen sink and there is nothing in there? >> I will blog how to do this TODAY if you guys help me get it going. >> >> thanks >> Joel >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
Isn''t that what user.friends! already does? I think I did this once
when I first started out.
###
# Retrieve friends with user info populated
# Subsequent calls will be retrieved from memory.
# Optional: list of fields to retrieve as symbols
def friends!(*fields)
@friends ||= session.post(''facebook.users.getInfo'',
:fields =>
collect(fields), :uids => friends.map{|f|
f.id}.join('','')).map do
|hash|
User.new(hash[''uid''], session, hash)
end
end
Dave
On Jan 24, 2008 12:41 PM, Shawn Van Ittersum <svicalifornia at gmail.com>
wrote:> Can Facebooker be modified to call FB''s getInfo on a list of
friend ID''s instead of one at a time?
>
> Shawn
>
>
> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote:
> > Facebooker is querying facebook and looking up the name of each
> > friend, one at a time. We populate the the friends array from the ID
> > list that is passed in via Facebook.
> >
> > If you want this output without having to query facebook for each
> > friends, you can use:
> >
> > <%= fb_name a_friend,: firstnameonly=>true %>
> >
> > Mike
> >
> > On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote:
> >
> >> Hi,
> >>
> >> I started with rfacebook but given the recent events figure its
best
> >> to move over to facebooker.
> >>
> >> I have:
> >>
> >> 1.) Installed the facebooker plugin
> >> 2.) setup my facebook app (fbml/canvas)
> >> 3.) created a method on controller & view to handle initial
request
> >> 4.) added
"ensure_application_is_installed_by_facebook_user" to top
> >> off application.rb
> >>
> >> I am able to get to my landing page and show the facebook id of
the
> >> users that comes in, but...
> >>
> >> If I try to show the users friends in the view using:
> >> <% for a_friend in @user.friends %>
> >> <%=a_friend.first_name%>
> >> <% end %>
> >>
> >> It makes my server hang, for about 70 seconds, then the method
seems
> >> to complete. Note, I had similar functionality working in
rfacebook,
> >> so I don''t think its an environmental thing.
> >>
> >> What could I be doing wrong?
> >>
> >> Also, I have done some reading on issues with running a non
facebook
> >> application with this setup on same application, what should I do?
> >>
> >> a.) Create a subclass of my ApplicationController called
> >> FaceController to do all the facebook related stuff?
> >> b.) Is there a way to do an if around
> >> "ensure_application_is_installed_by_facebook_user" so
that it is only
> >> enforced if coming from facebook?
> >>
> >> Does anyone have an example app, example code of how to do common
> >> things?, I looked through kitchen sink and there is nothing in
there?
> >> I will blog how to do this TODAY if you guys help me get it going.
> >>
> >> thanks
> >> Joel
> >>
> >> _______________________________________________
> >> Facebooker-talk mailing list
> >> Facebooker-talk at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/facebooker-talk
> >
> > --
> > Mike Mangino
> > http://www.elevatedrails.com
> >
> > _______________________________________________
> > 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
>
Shawn Van Ittersum
2008-Jan-24 19:53 UTC
[Facebooker-talk] getting started with facebooker
I see what you mean. And although I''m from rfacebook-land (like Joel), I just want to say that I do agree with the Ruby-inspired abstraction added to Facebooker. It would be great, tho, to be able to take advantage of FB''s ability to return user info for a list of users in one REST call. Performance is very important in FB apps, and this is a very common use case for IFRAME apps and even many FBML apps. Shawn On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote:> Facebooker is querying facebook and looking up the name of each > friend, one at a time. We populate the the friends array from the ID > list that is passed in via Facebook. > > If you want this output without having to query facebook for each > friends, you can use: > > <%= fb_name a_friend,: firstnameonly=>true %> > > Mike > > On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: > >> Hi, >> >> I started with rfacebook but given the recent events figure its best >> to move over to facebooker. >> >> I have: >> >> 1.) Installed the facebooker plugin >> 2.) setup my facebook app (fbml/canvas) >> 3.) created a method on controller & view to handle initial request >> 4.) added "ensure_application_is_installed_by_facebook_user" to top >> off application.rb >> >> I am able to get to my landing page and show the facebook id of the >> users that comes in, but... >> >> If I try to show the users friends in the view using: >> <% for a_friend in @user.friends %> >> <%=a_friend.first_name%> >> <% end %> >> >> It makes my server hang, for about 70 seconds, then the method seems >> to complete. Note, I had similar functionality working in rfacebook, >> so I don''t think its an environmental thing. >> >> What could I be doing wrong? >> >> Also, I have done some reading on issues with running a non facebook >> application with this setup on same application, what should I do? >> >> a.) Create a subclass of my ApplicationController called >> FaceController to do all the facebook related stuff? >> b.) Is there a way to do an if around >> "ensure_application_is_installed_by_facebook_user" so that it is only >> enforced if coming from facebook? >> >> Does anyone have an example app, example code of how to do common >> things?, I looked through kitchen sink and there is nothing in there? >> I will blog how to do this TODAY if you guys help me get it going. >> >> thanks >> Joel >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk
So I can try to learn what is going on beneath the covers I have
modified the service post method to log (it would be cool if there was
an env variable to turn this on or off in facebooker) the actual post
and response:
Here is my version for anyone else that wants to understand the
facebook api calls that are happening under the covers.
def post(params)
logger.debug "About to post to :" + url.to_s
logger.debug "with params:"
params.each { |elem| logger.debug elem[0].to_s + " : " +
elem[1].to_s}
resp,data = Net::HTTP.post_form(url, params)
logger.debug "Result: " + resp.to_s
logger.debug "Response Data: " + data.to_s
Parser.parse(params[:method],resp)
end
I also didn''t realize that by using the helpers that fbml can add the
First & Last name of the user for you on the return of the round trip
(if your using fbml & canvas)
so I changed it to:
Friends: <BR/>
<% for a_friend in @userF.friends %>
<%= fb_name a_friend %><BR>
<% end %>
And it displays a list of friends that link to their profiles.
thanks
Joel
On Jan 24, 2008, at 2:53 PM, Shawn Van Ittersum wrote:
> I see what you mean. And although I''m from rfacebook-land (like
> Joel), I just want to say that I do agree with the Ruby-inspired
> abstraction added to Facebooker. It would be great, tho, to be able
> to take advantage of FB''s ability to return user info for a list
of
> users in one REST call. Performance is very important in FB apps,
> and this is a very common use case for IFRAME apps and even many
> FBML apps.
>
> Shawn
>
> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote:
>> Facebooker is querying facebook and looking up the name of each
>> friend, one at a time. We populate the the friends array from the ID
>> list that is passed in via Facebook.
>>
>> If you want this output without having to query facebook for each
>> friends, you can use:
>>
>> <%= fb_name a_friend,: firstnameonly=>true %>
>>
>> Mike
>>
>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote:
>>
>>> Hi,
>>>
>>> I started with rfacebook but given the recent events figure its
best
>>> to move over to facebooker.
>>>
>>> I have:
>>>
>>> 1.) Installed the facebooker plugin
>>> 2.) setup my facebook app (fbml/canvas)
>>> 3.) created a method on controller & view to handle initial
request
>>> 4.) added
"ensure_application_is_installed_by_facebook_user" to top
>>> off application.rb
>>>
>>> I am able to get to my landing page and show the facebook id of the
>>> users that comes in, but...
>>>
>>> If I try to show the users friends in the view using:
>>> <% for a_friend in @user.friends %>
>>> <%=a_friend.first_name%>
>>> <% end %>
>>>
>>> It makes my server hang, for about 70 seconds, then the method
seems
>>> to complete. Note, I had similar functionality working in
rfacebook,
>>> so I don''t think its an environmental thing.
>>>
>>> What could I be doing wrong?
>>>
>>> Also, I have done some reading on issues with running a non
facebook
>>> application with this setup on same application, what should I do?
>>>
>>> a.) Create a subclass of my ApplicationController called
>>> FaceController to do all the facebook related stuff?
>>> b.) Is there a way to do an if around
>>> "ensure_application_is_installed_by_facebook_user" so
that it is
>>> only
>>> enforced if coming from facebook?
>>>
>>> Does anyone have an example app, example code of how to do common
>>> things?, I looked through kitchen sink and there is nothing in
>>> there?
>>> I will blog how to do this TODAY if you guys help me get it going.
>>>
>>> thanks
>>> Joel
>>>
>>> _______________________________________________
>>> Facebooker-talk mailing list
>>> Facebooker-talk at rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/facebooker-talk
>>
>> --
>> Mike Mangino
>> http://www.elevatedrails.com
>>
>> _______________________________________________
>> Facebooker-talk mailing list
>> Facebooker-talk at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/facebooker-talk
Shawn Van Ittersum
2008-Jan-24 20:12 UTC
[Facebooker-talk] getting started with facebooker
Well, ideally, we''d also get to specify which fields get fetched from FB. Some (networks, schools, etc) require JOINs on FB''s database and take longer to complete. I have timed simple requests (name, birthdate, etc) against full requests and noticed dramatic differences in speed. Shawn On Thu, 24 Jan 2008 12:46:19 -0700, David Clements wrote:> Isn''t that what user.friends! already does? I think I did this once > when I first started out. > > ### > # Retrieve friends with user info populated > # Subsequent calls will be retrieved from memory. > # Optional: list of fields to retrieve as symbols > def friends!(*fields) > @friends ||= session.post(''facebook.users.getInfo'', :fields => > collect(fields), :uids => friends.map{|f| f.id}.join('','')).map do > |hash| > User.new(hash[''uid''], session, hash) > end > end > > Dave > > > > On Jan 24, 2008 12:41 PM, Shawn Van Ittersum > <svicalifornia at gmail.com> wrote: >> Can Facebooker be modified to call FB''s getInfo on a list of friend >> ID''s instead of one at a time? >> >> Shawn >> >> >> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote: >>> Facebooker is querying facebook and looking up the name of each >>> friend, one at a time. We populate the the friends array from the ID >>> list that is passed in via Facebook. >>> >>> If you want this output without having to query facebook for each >>> friends, you can use: >>> >>> <%= fb_name a_friend,: firstnameonly=>true %> >>> >>> Mike >>> >>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: >>> >>>> Hi, >>>> >>>> I started with rfacebook but given the recent events figure its best >>>> to move over to facebooker. >>>> >>>> I have: >>>> >>>> 1.) Installed the facebooker plugin >>>> 2.) setup my facebook app (fbml/canvas) >>>> 3.) created a method on controller & view to handle initial request >>>> 4.) added "ensure_application_is_installed_by_facebook_user" to top >>>> off application.rb >>>> >>>> I am able to get to my landing page and show the facebook id of the >>>> users that comes in, but... >>>> >>>> If I try to show the users friends in the view using: >>>> <% for a_friend in @user.friends %> >>>> <%=a_friend.first_name%> >>>> <% end %> >>>> >>>> It makes my server hang, for about 70 seconds, then the method seems >>>> to complete. Note, I had similar functionality working in rfacebook, >>>> so I don''t think its an environmental thing. >>>> >>>> What could I be doing wrong? >>>> >>>> Also, I have done some reading on issues with running a non facebook >>>> application with this setup on same application, what should I do? >>>> >>>> a.) Create a subclass of my ApplicationController called >>>> FaceController to do all the facebook related stuff? >>>> b.) Is there a way to do an if around >>>> "ensure_application_is_installed_by_facebook_user" so that it is only >>>> enforced if coming from facebook? >>>> >>>> Does anyone have an example app, example code of how to do common >>>> things?, I looked through kitchen sink and there is nothing in there? >>>> I will blog how to do this TODAY if you guys help me get it going. >>>> >>>> thanks >>>> Joel >>>> >>>> _______________________________________________ >>>> Facebooker-talk mailing list >>>> Facebooker-talk at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>> >>> -- >>> Mike Mangino >>> http://www.elevatedrails.com >>> >>> _______________________________________________ >>> 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 >>
On 1/24/08, Shawn Van Ittersum <svicalifornia at gmail.com> wrote:> Well, ideally, we''d also get to specify which fields get fetched from FB. Some (networks, schools, etc) require JOINs on FB''s database and take longer to complete. I have timed simple requests (name, birthdate, etc) against full requests and noticed dramatic differences in speed. > > ShawnYea. When I wrote this feature, I put that on my mental TODO list for when I needed it. Never needed it, so it never got added (by me). I''m of course not at all the main contributor to Facebooker anymore (until I need to do some more Facebook work), but I''m sure this addition would be warmly welcome if accompanied by tests. Thanks! Chad
Shawn- You can specify what fields you want as symbols. i.e: facebook_session.user.populate(:first_name). This will only fetch the first name record. Shane On Jan 24, 2008 2:12 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote:> Well, ideally, we''d also get to specify which fields get fetched from FB. Some (networks, schools, etc) require JOINs on FB''s database and take longer to complete. I have timed simple requests (name, birthdate, etc) against full requests and noticed dramatic differences in speed. > > Shawn > > > On Thu, 24 Jan 2008 12:46:19 -0700, David Clements wrote: > > Isn''t that what user.friends! already does? I think I did this once > > when I first started out. > > > > ### > > # Retrieve friends with user info populated > > # Subsequent calls will be retrieved from memory. > > # Optional: list of fields to retrieve as symbols > > def friends!(*fields) > > @friends ||= session.post(''facebook.users.getInfo'', :fields => > > collect(fields), :uids => friends.map{|f| f.id}.join('','')).map do > > |hash| > > User.new(hash[''uid''], session, hash) > > end > > end > > > > Dave > > > > > > > > On Jan 24, 2008 12:41 PM, Shawn Van Ittersum > > <svicalifornia at gmail.com> wrote: > >> Can Facebooker be modified to call FB''s getInfo on a list of friend > >> ID''s instead of one at a time? > >> > >> Shawn > >> > >> > >> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote: > >>> Facebooker is querying facebook and looking up the name of each > >>> friend, one at a time. We populate the the friends array from the ID > >>> list that is passed in via Facebook. > >>> > >>> If you want this output without having to query facebook for each > >>> friends, you can use: > >>> > >>> <%= fb_name a_friend,: firstnameonly=>true %> > >>> > >>> Mike > >>> > >>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: > >>> > >>>> Hi, > >>>> > >>>> I started with rfacebook but given the recent events figure its best > >>>> to move over to facebooker. > >>>> > >>>> I have: > >>>> > >>>> 1.) Installed the facebooker plugin > >>>> 2.) setup my facebook app (fbml/canvas) > >>>> 3.) created a method on controller & view to handle initial request > >>>> 4.) added "ensure_application_is_installed_by_facebook_user" to top > >>>> off application.rb > >>>> > >>>> I am able to get to my landing page and show the facebook id of the > >>>> users that comes in, but... > >>>> > >>>> If I try to show the users friends in the view using: > >>>> <% for a_friend in @user.friends %> > >>>> <%=a_friend.first_name%> > >>>> <% end %> > >>>> > >>>> It makes my server hang, for about 70 seconds, then the method seems > >>>> to complete. Note, I had similar functionality working in rfacebook, > >>>> so I don''t think its an environmental thing. > >>>> > >>>> What could I be doing wrong? > >>>> > >>>> Also, I have done some reading on issues with running a non facebook > >>>> application with this setup on same application, what should I do? > >>>> > >>>> a.) Create a subclass of my ApplicationController called > >>>> FaceController to do all the facebook related stuff? > >>>> b.) Is there a way to do an if around > >>>> "ensure_application_is_installed_by_facebook_user" so that it is only > >>>> enforced if coming from facebook? > >>>> > >>>> Does anyone have an example app, example code of how to do common > >>>> things?, I looked through kitchen sink and there is nothing in there? > >>>> I will blog how to do this TODAY if you guys help me get it going. > >>>> > >>>> thanks > >>>> Joel > >>>> > >>>> _______________________________________________ > >>>> Facebooker-talk mailing list > >>>> Facebooker-talk at rubyforge.org > >>>> http://rubyforge.org/mailman/listinfo/facebooker-talk > >>> > >>> -- > >>> Mike Mangino > >>> http://www.elevatedrails.com > >>> > >>> _______________________________________________ > >>> 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 >-- http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com
Shawn Van Ittersum
2008-Jan-24 21:08 UTC
[Facebooker-talk] getting started with facebooker
OK, but does this allow fetching multiple specified fields on multiple specified users all in one FB API call? Shawn On Thu, 24 Jan 2008 15:03:39 -0600, Shane Vitarana wrote:> Shawn- > > You can specify what fields you want as symbols. i.e: > facebook_session.user.populate(:first_name). This will only fetch the > first name record. > > Shane > > > On Jan 24, 2008 2:12 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote: >> Well, ideally, we''d also get to specify which fields get fetched >> from FB. Some (networks, schools, etc) require JOINs on FB''s >> database and take longer to complete. I have timed simple requests >> (name, birthdate, etc) against full requests and noticed dramatic >> differences in speed. >> >> Shawn >> >> >> On Thu, 24 Jan 2008 12:46:19 -0700, David Clements wrote: >>> Isn''t that what user.friends! already does? I think I did this once >>> when I first started out. >>> >>> ### >>> # Retrieve friends with user info populated >>> # Subsequent calls will be retrieved from memory. >>> # Optional: list of fields to retrieve as symbols >>> def friends!(*fields) >>> @friends ||= session.post(''facebook.users.getInfo'', :fields => >>> collect(fields), :uids => friends.map{|f| f.id}.join('','')).map do >>> |hash| >>> User.new(hash[''uid''], session, hash) >>> end >>> end >>> >>> Dave >>> >>> >>> >>> On Jan 24, 2008 12:41 PM, Shawn Van Ittersum >>> <svicalifornia at gmail.com> wrote: >>>> Can Facebooker be modified to call FB''s getInfo on a list of friend >>>> ID''s instead of one at a time? >>>> >>>> Shawn >>>> >>>> >>>> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote: >>>>> Facebooker is querying facebook and looking up the name of each >>>>> friend, one at a time. We populate the the friends array from the ID >>>>> list that is passed in via Facebook. >>>>> >>>>> If you want this output without having to query facebook for each >>>>> friends, you can use: >>>>> >>>>> <%= fb_name a_friend,: firstnameonly=>true %> >>>>> >>>>> Mike >>>>> >>>>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I started with rfacebook but given the recent events figure its best >>>>>> to move over to facebooker. >>>>>> >>>>>> I have: >>>>>> >>>>>> 1.) Installed the facebooker plugin >>>>>> 2.) setup my facebook app (fbml/canvas) >>>>>> 3.) created a method on controller & view to handle initial request >>>>>> 4.) added "ensure_application_is_installed_by_facebook_user" to top >>>>>> off application.rb >>>>>> >>>>>> I am able to get to my landing page and show the facebook id of the >>>>>> users that comes in, but... >>>>>> >>>>>> If I try to show the users friends in the view using: >>>>>> <% for a_friend in @user.friends %> >>>>>> <%=a_friend.first_name%> >>>>>> <% end %> >>>>>> >>>>>> It makes my server hang, for about 70 seconds, then the method seems >>>>>> to complete. Note, I had similar functionality working in rfacebook, >>>>>> so I don''t think its an environmental thing. >>>>>> >>>>>> What could I be doing wrong? >>>>>> >>>>>> Also, I have done some reading on issues with running a non facebook >>>>>> application with this setup on same application, what should I do? >>>>>> >>>>>> a.) Create a subclass of my ApplicationController called >>>>>> FaceController to do all the facebook related stuff? >>>>>> b.) Is there a way to do an if around >>>>>> "ensure_application_is_installed_by_facebook_user" so that it is only >>>>>> enforced if coming from facebook? >>>>>> >>>>>> Does anyone have an example app, example code of how to do common >>>>>> things?, I looked through kitchen sink and there is nothing in there? >>>>>> I will blog how to do this TODAY if you guys help me get it going. >>>>>> >>>>>> thanks >>>>>> Joel >>>>>> >>>>>> _______________________________________________ >>>>>> Facebooker-talk mailing list >>>>>> Facebooker-talk at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>>>> >>>>> -- >>>>> Mike Mangino >>>>> http://www.elevatedrails.com >>>>> >>>>> _______________________________________________ >>>>> 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 >> > > > > -- > http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com
You can only get multiple specified files for *one* user. You can always construct an FQL query to get multiple fields for multiple users. On Jan 24, 2008 3:08 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote:> OK, but does this allow fetching multiple specified fields on multiple specified users all in one FB API call? > > Shawn > > > On Thu, 24 Jan 2008 15:03:39 -0600, Shane Vitarana wrote: > > Shawn- > > > > You can specify what fields you want as symbols. i.e: > > facebook_session.user.populate(:first_name). This will only fetch the > > first name record. > > > > Shane > > > > > > On Jan 24, 2008 2:12 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote: > >> Well, ideally, we''d also get to specify which fields get fetched > >> from FB. Some (networks, schools, etc) require JOINs on FB''s > >> database and take longer to complete. I have timed simple requests > >> (name, birthdate, etc) against full requests and noticed dramatic > >> differences in speed. > >> > >> Shawn > >> > >> > >> On Thu, 24 Jan 2008 12:46:19 -0700, David Clements wrote: > >>> Isn''t that what user.friends! already does? I think I did this once > >>> when I first started out. > >>> > >>> ### > >>> # Retrieve friends with user info populated > >>> # Subsequent calls will be retrieved from memory. > >>> # Optional: list of fields to retrieve as symbols > >>> def friends!(*fields) > >>> @friends ||= session.post(''facebook.users.getInfo'', :fields => > >>> collect(fields), :uids => friends.map{|f| f.id}.join('','')).map do > >>> |hash| > >>> User.new(hash[''uid''], session, hash) > >>> end > >>> end > >>> > >>> Dave > >>> > >>> > >>> > >>> On Jan 24, 2008 12:41 PM, Shawn Van Ittersum > >>> <svicalifornia at gmail.com> wrote: > >>>> Can Facebooker be modified to call FB''s getInfo on a list of friend > >>>> ID''s instead of one at a time? > >>>> > >>>> Shawn > >>>> > >>>> > >>>> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote: > >>>>> Facebooker is querying facebook and looking up the name of each > >>>>> friend, one at a time. We populate the the friends array from the ID > >>>>> list that is passed in via Facebook. > >>>>> > >>>>> If you want this output without having to query facebook for each > >>>>> friends, you can use: > >>>>> > >>>>> <%= fb_name a_friend,: firstnameonly=>true %> > >>>>> > >>>>> Mike > >>>>> > >>>>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: > >>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I started with rfacebook but given the recent events figure its best > >>>>>> to move over to facebooker. > >>>>>> > >>>>>> I have: > >>>>>> > >>>>>> 1.) Installed the facebooker plugin > >>>>>> 2.) setup my facebook app (fbml/canvas) > >>>>>> 3.) created a method on controller & view to handle initial request > >>>>>> 4.) added "ensure_application_is_installed_by_facebook_user" to top > >>>>>> off application.rb > >>>>>> > >>>>>> I am able to get to my landing page and show the facebook id of the > >>>>>> users that comes in, but... > >>>>>> > >>>>>> If I try to show the users friends in the view using: > >>>>>> <% for a_friend in @user.friends %> > >>>>>> <%=a_friend.first_name%> > >>>>>> <% end %> > >>>>>> > >>>>>> It makes my server hang, for about 70 seconds, then the method seems > >>>>>> to complete. Note, I had similar functionality working in rfacebook, > >>>>>> so I don''t think its an environmental thing. > >>>>>> > >>>>>> What could I be doing wrong? > >>>>>> > >>>>>> Also, I have done some reading on issues with running a non facebook > >>>>>> application with this setup on same application, what should I do? > >>>>>> > >>>>>> a.) Create a subclass of my ApplicationController called > >>>>>> FaceController to do all the facebook related stuff? > >>>>>> b.) Is there a way to do an if around > >>>>>> "ensure_application_is_installed_by_facebook_user" so that it is only > >>>>>> enforced if coming from facebook? > >>>>>> > >>>>>> Does anyone have an example app, example code of how to do common > >>>>>> things?, I looked through kitchen sink and there is nothing in there? > >>>>>> I will blog how to do this TODAY if you guys help me get it going. > >>>>>> > >>>>>> thanks > >>>>>> Joel > >>>>>> > >>>>>> _______________________________________________ > >>>>>> Facebooker-talk mailing list > >>>>>> Facebooker-talk at rubyforge.org > >>>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk > >>>>> > >>>>> -- > >>>>> Mike Mangino > >>>>> http://www.elevatedrails.com > >>>>> > >>>>> _______________________________________________ > >>>>> 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 > >> > > > > > > > > -- > > http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com >-- http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com
Shawn Van Ittersum
2008-Jan-24 21:30 UTC
[Facebooker-talk] getting started with facebooker
OK, then my request to get multiple fields for multiple users still holds. The FB API allows this, so we should have a method to do it, as Chad has also said. I''ll be looking into this further after working on the callback_path stuff. Shawn On Thu, 24 Jan 2008 15:20:37 -0600, Shane Vitarana wrote:> You can only get multiple specified files for *one* user. You can > always construct an FQL query to get multiple fields for multiple > users. > > On Jan 24, 2008 3:08 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote: >> OK, but does this allow fetching multiple specified fields on >> multiple specified users all in one FB API call? >> >> Shawn >> >> >> On Thu, 24 Jan 2008 15:03:39 -0600, Shane Vitarana wrote: >>> Shawn- >>> >>> You can specify what fields you want as symbols. i.e: >>> facebook_session.user.populate(:first_name). This will only fetch the >>> first name record. >>> >>> Shane >>> >>> >>> On Jan 24, 2008 2:12 PM, Shawn Van Ittersum >>> <svicalifornia at gmail.com> wrote: >>>> Well, ideally, we''d also get to specify which fields get fetched >>>> from FB. Some (networks, schools, etc) require JOINs on FB''s >>>> database and take longer to complete. I have timed simple requests >>>> (name, birthdate, etc) against full requests and noticed dramatic >>>> differences in speed. >>>> >>>> Shawn >>>> >>>> >>>> On Thu, 24 Jan 2008 12:46:19 -0700, David Clements wrote: >>>>> Isn''t that what user.friends! already does? I think I did this once >>>>> when I first started out. >>>>> >>>>> ### >>>>> # Retrieve friends with user info populated >>>>> # Subsequent calls will be retrieved from memory. >>>>> # Optional: list of fields to retrieve as symbols >>>>> def friends!(*fields) >>>>> @friends ||= session.post(''facebook.users.getInfo'', :fields => >>>>> collect(fields), :uids => friends.map{|f| f.id}.join('','')).map do >>>>> |hash| >>>>> User.new(hash[''uid''], session, hash) >>>>> end >>>>> end >>>>> >>>>> Dave >>>>> >>>>> >>>>> >>>>> On Jan 24, 2008 12:41 PM, Shawn Van Ittersum >>>>> <svicalifornia at gmail.com> wrote: >>>>>> Can Facebooker be modified to call FB''s getInfo on a list of friend >>>>>> ID''s instead of one at a time? >>>>>> >>>>>> Shawn >>>>>> >>>>>> >>>>>> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote: >>>>>>> Facebooker is querying facebook and looking up the name of each >>>>>>> friend, one at a time. We populate the the friends array from the ID >>>>>>> list that is passed in via Facebook. >>>>>>> >>>>>>> If you want this output without having to query facebook for each >>>>>>> friends, you can use: >>>>>>> >>>>>>> <%= fb_name a_friend,: firstnameonly=>true %> >>>>>>> >>>>>>> Mike >>>>>>> >>>>>>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: >>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> I started with rfacebook but given the recent events figure its best >>>>>>>> to move over to facebooker. >>>>>>>> >>>>>>>> I have: >>>>>>>> >>>>>>>> 1.) Installed the facebooker plugin >>>>>>>> 2.) setup my facebook app (fbml/canvas) >>>>>>>> 3.) created a method on controller & view to handle initial request >>>>>>>> 4.) added "ensure_application_is_installed_by_facebook_user" to top >>>>>>>> off application.rb >>>>>>>> >>>>>>>> I am able to get to my landing page and show the facebook id of the >>>>>>>> users that comes in, but... >>>>>>>> >>>>>>>> If I try to show the users friends in the view using: >>>>>>>> <% for a_friend in @user.friends %> >>>>>>>> <%=a_friend.first_name%> >>>>>>>> <% end %> >>>>>>>> >>>>>>>> It makes my server hang, for about 70 seconds, then the method seems >>>>>>>> to complete. Note, I had similar functionality working in rfacebook, >>>>>>>> so I don''t think its an environmental thing. >>>>>>>> >>>>>>>> What could I be doing wrong? >>>>>>>> >>>>>>>> Also, I have done some reading on issues with running a non facebook >>>>>>>> application with this setup on same application, what should I do? >>>>>>>> >>>>>>>> a.) Create a subclass of my ApplicationController called >>>>>>>> FaceController to do all the facebook related stuff? >>>>>>>> b.) Is there a way to do an if around >>>>>>>> "ensure_application_is_installed_by_facebook_user" so that it is only >>>>>>>> enforced if coming from facebook? >>>>>>>> >>>>>>>> Does anyone have an example app, example code of how to do common >>>>>>>> things?, I looked through kitchen sink and there is nothing in there? >>>>>>>> I will blog how to do this TODAY if you guys help me get it going. >>>>>>>> >>>>>>>> thanks >>>>>>>> Joel >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> Facebooker-talk mailing list >>>>>>>> Facebooker-talk at rubyforge.org >>>>>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>>>>>> >>>>>>> -- >>>>>>> Mike Mangino >>>>>>> http://www.elevatedrails.com >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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 >>>> >>> >>> >>> >>> -- >>> http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com >> > > > > -- > http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com
Cool. On Jan 24, 2008 3:30 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote:> OK, then my request to get multiple fields for multiple users still holds. The FB API allows this, so we should have a method to do it, as Chad has also said. I''ll be looking into this further after working on the callback_path stuff. > > Shawn > > > On Thu, 24 Jan 2008 15:20:37 -0600, Shane Vitarana wrote: > > You can only get multiple specified files for *one* user. You can > > always construct an FQL query to get multiple fields for multiple > > users. > > > > On Jan 24, 2008 3:08 PM, Shawn Van Ittersum <svicalifornia at gmail.com> wrote: > >> OK, but does this allow fetching multiple specified fields on > >> multiple specified users all in one FB API call? > >> > >> Shawn > >> > >> > >> On Thu, 24 Jan 2008 15:03:39 -0600, Shane Vitarana wrote: > >>> Shawn- > >>> > >>> You can specify what fields you want as symbols. i.e: > >>> facebook_session.user.populate(:first_name). This will only fetch the > >>> first name record. > >>> > >>> Shane > >>> > >>> > >>> On Jan 24, 2008 2:12 PM, Shawn Van Ittersum > >>> <svicalifornia at gmail.com> wrote: > >>>> Well, ideally, we''d also get to specify which fields get fetched > >>>> from FB. Some (networks, schools, etc) require JOINs on FB''s > >>>> database and take longer to complete. I have timed simple requests > >>>> (name, birthdate, etc) against full requests and noticed dramatic > >>>> differences in speed. > >>>> > >>>> Shawn > >>>> > >>>> > >>>> On Thu, 24 Jan 2008 12:46:19 -0700, David Clements wrote: > >>>>> Isn''t that what user.friends! already does? I think I did this once > >>>>> when I first started out. > >>>>> > >>>>> ### > >>>>> # Retrieve friends with user info populated > >>>>> # Subsequent calls will be retrieved from memory. > >>>>> # Optional: list of fields to retrieve as symbols > >>>>> def friends!(*fields) > >>>>> @friends ||= session.post(''facebook.users.getInfo'', :fields => > >>>>> collect(fields), :uids => friends.map{|f| f.id}.join('','')).map do > >>>>> |hash| > >>>>> User.new(hash[''uid''], session, hash) > >>>>> end > >>>>> end > >>>>> > >>>>> Dave > >>>>> > >>>>> > >>>>> > >>>>> On Jan 24, 2008 12:41 PM, Shawn Van Ittersum > >>>>> <svicalifornia at gmail.com> wrote: > >>>>>> Can Facebooker be modified to call FB''s getInfo on a list of friend > >>>>>> ID''s instead of one at a time? > >>>>>> > >>>>>> Shawn > >>>>>> > >>>>>> > >>>>>> On Thu, 24 Jan 2008 08:23:57 -0600, Mike Mangino wrote: > >>>>>>> Facebooker is querying facebook and looking up the name of each > >>>>>>> friend, one at a time. We populate the the friends array from the ID > >>>>>>> list that is passed in via Facebook. > >>>>>>> > >>>>>>> If you want this output without having to query facebook for each > >>>>>>> friends, you can use: > >>>>>>> > >>>>>>> <%= fb_name a_friend,: firstnameonly=>true %> > >>>>>>> > >>>>>>> Mike > >>>>>>> > >>>>>>> On Jan 24, 2008, at 7:39 AM, Joel Nylund wrote: > >>>>>>> > >>>>>>>> Hi, > >>>>>>>> > >>>>>>>> I started with rfacebook but given the recent events figure its best > >>>>>>>> to move over to facebooker. > >>>>>>>> > >>>>>>>> I have: > >>>>>>>> > >>>>>>>> 1.) Installed the facebooker plugin > >>>>>>>> 2.) setup my facebook app (fbml/canvas) > >>>>>>>> 3.) created a method on controller & view to handle initial request > >>>>>>>> 4.) added "ensure_application_is_installed_by_facebook_user" to top > >>>>>>>> off application.rb > >>>>>>>> > >>>>>>>> I am able to get to my landing page and show the facebook id of the > >>>>>>>> users that comes in, but... > >>>>>>>> > >>>>>>>> If I try to show the users friends in the view using: > >>>>>>>> <% for a_friend in @user.friends %> > >>>>>>>> <%=a_friend.first_name%> > >>>>>>>> <% end %> > >>>>>>>> > >>>>>>>> It makes my server hang, for about 70 seconds, then the method seems > >>>>>>>> to complete. Note, I had similar functionality working in rfacebook, > >>>>>>>> so I don''t think its an environmental thing. > >>>>>>>> > >>>>>>>> What could I be doing wrong? > >>>>>>>> > >>>>>>>> Also, I have done some reading on issues with running a non facebook > >>>>>>>> application with this setup on same application, what should I do? > >>>>>>>> > >>>>>>>> a.) Create a subclass of my ApplicationController called > >>>>>>>> FaceController to do all the facebook related stuff? > >>>>>>>> b.) Is there a way to do an if around > >>>>>>>> "ensure_application_is_installed_by_facebook_user" so that it is only > >>>>>>>> enforced if coming from facebook? > >>>>>>>> > >>>>>>>> Does anyone have an example app, example code of how to do common > >>>>>>>> things?, I looked through kitchen sink and there is nothing in there? > >>>>>>>> I will blog how to do this TODAY if you guys help me get it going. > >>>>>>>> > >>>>>>>> thanks > >>>>>>>> Joel > >>>>>>>> > >>>>>>>> _______________________________________________ > >>>>>>>> Facebooker-talk mailing list > >>>>>>>> Facebooker-talk at rubyforge.org > >>>>>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk > >>>>>>> > >>>>>>> -- > >>>>>>> Mike Mangino > >>>>>>> http://www.elevatedrails.com > >>>>>>> > >>>>>>> _______________________________________________ > >>>>>>> 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 > >>>> > >>> > >>> > >>> > >>> -- > >>> http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com > >> > > > > > > > > -- > > http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com >-- http://myfitbuddy.com | http://shanesbrain.net | http://crimsonjet.com