Created
November 19, 2014 19:29
-
-
Save juanjoseijas/707b1cfb0b8dd8d45e5d to your computer and use it in GitHub Desktop.
Revisions
-
juanjoseijas created this gist
Nov 19, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ require 'rubygems' require 'httparty' ## define class class Facebook ## load and inherit HTTParty class include HTTParty ## set the default base URI base_uri 'https://graph.facebook.com' ## set the format to JSON, so that HTTParty will automatically decode it format :json ## constructor def initialize(access_token) @access_token = access_token end def get_info self.class.get('/me',:query => { :access_token => @access_token }) end end ## create an instance of the Facebook class fb = Facebook.new(<your-access-token>); ## call the method r = fb.get_info() print r.body