Module: FacebookProfile::InstanceMethods

Defined in:
app/models/facebook_profile.rb

Instance Method Summary collapse

Instance Method Details

#facebook?Boolean


22
23
24
# File 'app/models/facebook_profile.rb', line 22

def facebook?
  facebook_authorization
end

#facebook_authorizationObject


26
27
28
# File 'app/models/facebook_profile.rb', line 26

def facebook_authorization
  self.authorizations.where(:provider => "facebook").first
end

#fb_friend_idsObject


10
11
12
# File 'app/models/facebook_profile.rb', line 10

def fb_friend_ids
  graph.get_connections('/me', 'friends').map{|h| h['id'].to_i}      
end

#fb_friends_with?(user) ⇒ Boolean


14
15
16
# File 'app/models/facebook_profile.rb', line 14

def fb_friends_with?(user)
  fb_friend_ids.include?(user.profile[:id])
end

#graphObject


18
19
20
# File 'app/models/facebook_profile.rb', line 18

def graph
  @graph ||= Koala::Facebook::API.new(facebook_authorization.token)
end