Skip to content

Instantly share code, notes, and snippets.

@novikserg
Created May 19, 2015 10:18
Show Gist options
  • Save novikserg/43bc6ae39378bafabdad to your computer and use it in GitHub Desktop.
Save novikserg/43bc6ae39378bafabdad to your computer and use it in GitHub Desktop.
class FacebookGraph
def initialize(token)
@graph = Koala::Facebook::API.new(token)
end
def profile
@graph.get_object('me')
end
def friends_ids
friends.map { |friend| friend['id'] }
end
def get_avatar(type)
@graph.get_picture(profile['id'], type: type)
end
private
def friends
@graph.get_connections('me', 'friends')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment