Class: Omnisocial::FacebookAccount
Instance Method Summary
collapse
create_from_auth_hash, find_or_create_from_auth_hash, #find_or_create_user
Instance Method Details
#account_url ⇒ Object
15
16
17
|
# File 'app/models/omnisocial/facebook_account.rb', line 15
def account_url
"http://facebook.com/#{self.login}"
end
|
#assign_account_info(auth_hash) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
|
# File 'app/models/omnisocial/facebook_account.rb', line 3
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
|
#picture_url ⇒ Object
19
20
21
22
23
24
25
|
# File 'app/models/omnisocial/facebook_account.rb', line 19
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
|