Thanks Vincent. You solution works great.<br><br>JD<br><br><div class="gmail_quote">On Wed, Nov 19, 2008 at 10:42 AM, vincent chu <span dir="ltr"><<a href="mailto:vincentchu@gmail.com">vincentchu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi ---<br>
<br>
I just added a 'get_permissions' method to my FacebookUser model that<br>
queries facebook for a user's extended permissions. Your FQL query<br>
seems correct, but you have to call 'post', instead of 'fql_query':<br>
<br>
def get_permissions<br>
<br>
perms = Hash.new<br>
<br>
begin<br>
current_session = self.facebook_session<br>
current_session.post("facebook.fql.query",<br>
:query => "select email, offline_access,<br>
status_update, photo_upload, create_listing, create_event, rsvp_event,<br>
sms from permissions where uid=#{self.facebook_id}",<br>
:format => "XML") do |response|<br>
<br>
type = response.shift<br>
if (type != "permissions")<br>
return perms<br>
end<br>
<br>
response.shift.map do |hash|<br>
hash.each_pair{|key, value| (value == "1" ? perms.store(key,<br>
true) : perms.store(key, false) )}<br>
end<br>
end<br>
<br>
return perms<br>
<br>
rescue<br>
return nil<br>
end<br>
<br>
end<br>
<br>
<br>
Hope this helps. Cheers,<br>
<br>
Vince<br>
<br>
----<br>
Vincent Chu<br>
Department of Applied Physics<br>
Geballe Laboratory of Advanced Materials<br>
McCullough Bldg. 318<br>
476 Lomita Mall<br>
Stanford, CA, 94305<br>
<br>
vchu AT <a href="http://post.harvard.edu" target="_blank">post.harvard.edu</a><br>
vincentchu AT <a href="http://gmail.com" target="_blank">gmail.com</a><br>
<br>
<a href="http://www.stanford.edu/%7Evincentc" target="_blank">http://www.stanford.edu/~vincentc</a> (homepage, updated sporadically)<br>
<br>
Consider this:<br>
"The smallest positive integer not definable in under eleven words."<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
On Fri, Nov 14, 2008 at 4:43 AM, Joseph Durden <<a href="mailto:josephdurden@gmail.com">josephdurden@gmail.com</a>> wrote:<br>
> Hello everyone,<br>
><br>
> I am using fb_prompt_permission :email, "Give Permission!" and it is working<br>
> properly. A user can give permission and my app can then send emails to<br>
> users.<br>
><br>
> I have a requirement that I have to document that a user has granted this<br>
> email extended permission. I don't see the params for fb_sig_ext_perms =><br>
> email? Why is this not showing up? Could this be the facebooker plugin or<br>
> is it the actual <a href="http://www.facebook.com" target="_blank">www.facebook.com</a> api? I noticed the fb_sig_ext_perms<br>
> before filters although I dont need them<br>
><br>
> before_filter :ensure_has_status_update<br>
> before_filter :ensure_has_photo_upload<br>
> before_filter :ensure_has_create_listing<br>
><br>
><br>
> i have tested the above out, and i properly receive the params for status,<br>
> photo and create. How can I get the email permissions sent as a params? I<br>
> have also tried using fql to grab the email permissions for a given user.<br>
> Here is the fql:<br>
><br>
>>> current_user.facebook_session.fql_query("select email from permissions<br>
>>> where uid = (#{current_user.facebook_id})")<br>
> => [nil]<br>
><br>
> I think that my fql is working properly but not sure.<br>
><br>
> If anyone knows how to get the email sent in params or how to write a fql<br>
> query that can give me the params I would be extatic!<br>
><br>
> Here are my params:<br>
><br>
> Parameters: {"fb_sig_time"=>"1221234687.6134",<br>
> "fb_sig"=>"1234gsdrgdfh4634534yhdsrt6345634", "fb_sig_in_new_facebook"=>"1",<br>
> "_method"=>"GET", "fb_sig_locale"=>"en_US", "action"=>"index",<br>
> "fb_sig_session_key"=>"2354sdfgew563455sgerd34-1231241244",<br>
> "fb_sig_position_fix"=>"1", "fb_sig_in_canvas"=>"1",<br>
> "fb_sig_request_method"=>"GET", "controller"=>"home",<br>
> "fb_sig_expires"=>"123345234234", "fb_sig_added"=>"1",<br>
> "fb_sig_friends"=>"1153203682,1154273529,1189153592,1209608725,1212782770",<br>
> "fb_sig_api_key"=>"1sd234243235235sdgttwet2354g345tr3",<br>
> "fb_sig_ext_perms"=>"status_update,photo_upload,create_listing",<br>
> "fb_sig_user"=>"12342342342", "fb_sig_profile_update_time"=>"1226123330"}<br>
><br>
> as you can see there are no fb_sig_ext_perms.<br>
><br>
> JD<br>
><br>
</div></div>> _______________________________________________<br>
> Facebooker-talk mailing list<br>
> <a href="mailto:Facebooker-talk@rubyforge.org">Facebooker-talk@rubyforge.org</a><br>
> <a href="http://rubyforge.org/mailman/listinfo/facebooker-talk" target="_blank">http://rubyforge.org/mailman/listinfo/facebooker-talk</a><br>
><br>
><br>
</blockquote></div><br>