Getting -FACEBOOK FRIENDS AND USER DETAILS USEING KOLA GEM IN RAILS
def get_facebook_friends
facebook_token = request.env['omniauth.auth']["credentials"]["token"]
facebook_user_id = request.env['omniauth.auth']['uid']
fb_graph = Koala::Facebook::API.new(facebook_token)
friends = fb_graph.get_connections("me", "friends")
friends_id = friends.map{ |friend| friend["id"]}
end
def get_facebook_user_details
omniauth = request.env["omniauth.auth"]
token = omniauth['credentials']['token']
@graph = Koala::Facebook::API.new(token)
fb = @graph.get_object("me")
@fb_id = fb["id"]
image_url = @graph.get_picture(@fb_id)
image = open(image_url)
name = fb["name"]
firstname = fb["first_name"]
if fb.include?("location")
location = fb["location"]["name"]
elsif fb.include?("hometown")
location = fb["hometown"]["name"]
end
city,country = location.split(',').map(&:strip)
end
def get_facebook_friends
facebook_token = request.env['omniauth.auth']["credentials"]["token"]
facebook_user_id = request.env['omniauth.auth']['uid']
fb_graph = Koala::Facebook::API.new(facebook_token)
friends = fb_graph.get_connections("me", "friends")
friends_id = friends.map{ |friend| friend["id"]}
end
def get_facebook_user_details
omniauth = request.env["omniauth.auth"]
token = omniauth['credentials']['token']
@graph = Koala::Facebook::API.new(token)
fb = @graph.get_object("me")
@fb_id = fb["id"]
image_url = @graph.get_picture(@fb_id)
image = open(image_url)
name = fb["name"]
firstname = fb["first_name"]
if fb.include?("location")
location = fb["location"]["name"]
elsif fb.include?("hometown")
location = fb["hometown"]["name"]
end
city,country = location.split(',').map(&:strip)
end
Comments
Post a Comment