Skip to content

Instantly share code, notes, and snippets.

@nov
Created October 24, 2011 13:50
Show Gist options
  • Select an option

  • Save nov/1309068 to your computer and use it in GitHub Desktop.

Select an option

Save nov/1309068 to your computer and use it in GitHub Desktop.
FbGraph OpenGraph Sample
app = FbGraph::Application.new(APP_ID)
me = FbGraph::User.me(ACCESS_TOKEN)
## Play (pre-configured for Game apps)
# Fetch activities
actions = me.og_actions "games.plays"
# Publish an activity
action = me.og_action!(
"games.plays",
:game => 'http://samples.ogp.me/163382137069945'
)
## Custom Action (you need to configure them in your app setting)
# Fetch activities
actions = me.og_actions app.og_action(:custom_action)
# Publish an activity
action = me.og_action!(
app.og_action(:custom_action), # or simply "APP_NAMESPACE:ACTION" as String
:custom_object => 'http://samples.ogp.me/264755040233381'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment