Last night someone asked about your Facebook application requiring Offline
Access, also known as an infinite session key.
There is a method about to be added to the Session model in Facebooker
It usese FQL , Facebook Query Language, which we didn't discuss last night.
You could add a before filter to your controller that calls the Facebook API
for the current persmission that are granted, then if you don't have Offline
Access redirect to a screen that requires the user to give you offline
access.
The method will resemble this:
def get_permissions
perms = Hash.new
begin
current_session = self.facebook_session
current_session.post("facebook.fql.query",
:query => "select email, offline_access,
status_update, photo_upload, create_listing, create_event, rsvp_event,
sms from permissions where uid=#{self.facebook_id}",
:format => "XML") do |response|
type = response.shift
if (type != "permissions")
return perms
end
response.shift.map do |hash|
hash.each_pair{|key, value| (value == "1" ? perms.store(key,
true) : perms.store(key, false) )}
end
end
return perms
rescue
return nil
end
end
_______________________________________________
Bdrg-members mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/bdrg-members