Created
October 24, 2011 13:50
-
-
Save nov/1309068 to your computer and use it in GitHub Desktop.
FbGraph OpenGraph Sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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