-
-
Notifications
You must be signed in to change notification settings - Fork 191
Achievements and Scores
nov matake edited this page Dec 16, 2011
·
2 revisions
achievement_url = 'http://fbgraphsample.heroku.com/achievements/1'
app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
# Register Achievement
app.achievement! achievement_url
# Fetch Registered Achievements
achievements = app.achievements
# Unregister Achievement
achievements.first.destroy
app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
user = FbGraph::User.new('matake', :access_token => ACCESS_TOKEN)
# Give Achievement
achievement = user.achieve! achievement_url, :access_token => app.access_token
# Fetch Given Achievements
achievements = user.achievements
# Delete Achievement
achievements.first.destroy :access_token => app.access_token
app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
user = FbGraph::User.new('matake', :access_token => ACCESS_TOKEN)
# Get scores
user.scores
# Update (or register) score
matake.score! 10, :access_token => app.access_token
# Clear score
matake.unscore! :access_token => app.access_token