require 'rubygems'
require 'ramaze'
Ramaze.contrib :facebook
# Settings for your facebook app
# SERVER: where this ramaze app is running
# URL: the apps.facebook.com url to your app
# KEY: API key for your app
# SECRET: Secret key for your app
# ID: Your app's ID (from the about page url)
# ADMINS: uids of facebook users that are admins
# SESSION: an admin's session key
#
# These vars are used by the Facebook Helper are are also useful
# within your controller and templates. For example,
# click here to search
#
# In addition, set the following options on your app's 'Edit Settings' page:
# Callback URL: http://myapp.domain.com:7000/ (trailing slash required)
# Canvas Page URL: ramazing
# Can your app be added on Facebook: Yes
# Who can add your app: Users
# Post-Add URL: http://apps.facebook.com/ramazing/install
# Post-Remove URL: http://myapp.domain.com:7000/uninstall
# Side Nav URL: http://apps.facebook.com/ramazing
module Facebook
SERVER = 'http://myapp.domain.com:7000'
URL = 'http://apps.facebook.com/ramazing'
KEY = 'b32f58685c06a7f8107bc7915354bd89'
SECRET = 'e0f9........................9429'
ID = 2502696782
ADMINS = [ 15601088 ]
SESSION = ''
end unless defined? Facebook::ID
# The facebook helper (included your controller using +helper :facebook+)
# defines a +facebook+ object, which is also aliased to +fb+.
#
# POST parameters sent by the facebook servers can be accessed via fb.params
# and also fb[]. Wherever possible, values will be converted to native ruby
# types (Time objects, true/false, arrays)
#
# fb.params = { :api_key => "b32f58685c06a7f8107bc7915354bd89",
# :added => true,
# :profile_update_time => Mon Oct 15 15:07:28 -0400 2007,
# :friends => [1,2,3],
# :session_key => "f7bed6aefaa5467b3a6344f2-15601088",
# :time => Sat Dec 01 02:02:50 -0500 2007,
# :user => 15601088,
# :position_fix => false,
# :expires => 0,
# :in_canvas => true }
#
# fb[:user] == facebook[:user] == facebook.params[:user]
#
# The facebook object can also be used to make API calls. Native ruby types (true, false, strings, hashes and arrays)
# will be returned. If facebook returns an array with only one element, that element will be returned instead.
#
# facebook.auth.createToken # => "41b5dc65792ba4bf405faf857a17267c"
# fb.users.getInfo :uids => 15601088, :fields => [:name] # => {"name"=>"Aman Gupta", "uid"=>15601088}
# fb.profile.setFBML :uid => 15601088, :markup => 'Hi!' # => true
#
# API calls will use the current viewing users' session key (from fb[:session_key]) if present,
# or Facebook::SESSION, which should be set to one of the admin's keys. You can also provide another
# session key yourself from your users database:
#
# fb.feed.publishActionOfUser :session_key => "the user's session key", :title => 'is using Ramaze!'
#
# Finally, you can use the following facebook object methods:
#
# facebook.valid? # verify fb_sig, if invalid fb.params will return {}
# facebook.redirect '/url' # redirect to /url using .
You updated your profile #{time_diff fb[:profile_update_time]} ago. You have #{fb[:friends].size} friends.
I know you already logged in, but you should really add this app.
You'll get a real nifty surprise on your profile if you do.
Now that you added this app, I can access your profile and news feed.
Did you see the cool surprise I left on your profile?