module Omnisocial class FacebookAccount < LoginAccount def assign_account_info(auth_hash) self.remote_account_id = auth_hash['uid'] self.login = auth_hash['user_info']['nickname'] self.name = auth_hash['user_info']['name'] self.first_name = auth_hash['user_info']['first_name'] if self.respond_to? :first_name self.last_name = auth_hash['user_info']['last_name'] if self.respond_to? :last_name self.email = auth_hash['extra']['user_hash']['email'] if self.respond_to? :email self.gender = auth_hash['extra']['user_hash']['gender'] if self.respond_to? :gender self.timezone = auth_hash['extra']['user_hash']['timezone'] if self.respond_to? :timezone self.access_token = auth_hash['credentials']['token'] end def account_url "http://facebook.com/#{self.login}" end def picture_url if self.login.include?('profile.php') "https://graph.facebook.com/#{self.login.gsub(/[^\d]/, '')}/picture?type=square" else "https://graph.facebook.com/#{self.login}/picture?type=square" end end end end