Class: Omnisocial::FacebookAccount

Inherits:
LoginAccount
  • Object
show all
Defined in:
app/models/omnisocial/facebook_account.rb

Instance Method Summary collapse

Methods inherited from LoginAccount

create_from_auth_hash, find_or_create_from_auth_hash, #find_or_create_user

Instance Method Details

#account_urlObject



15
16
17
# File 'app/models/omnisocial/facebook_account.rb', line 15

def 
  "http://facebook.com/#{self.}"
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 (auth_hash)
  self.  = auth_hash['uid']
  self.              = 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_urlObject



19
20
21
22
23
24
25
# File 'app/models/omnisocial/facebook_account.rb', line 19

def picture_url
  if self..include?('profile.php')
    "https://graph.facebook.com/#{self..gsub(/[^\d]/, '')}/picture?type=square"
  else
    "https://graph.facebook.com/#{self.}/picture?type=square"
  end
end