Created
May 19, 2015 10:18
-
-
Save novikserg/43bc6ae39378bafabdad to your computer and use it in GitHub Desktop.
This file contains 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
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