Sha256: 84e2a66bbc18e48126c615600c3727a751f6fae9cef91745b723a87e03a2dc10

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

module Omnisocial
  class FacebookAccount < LoginAccount
    def assign_account_info(auth_hash)
      self.token              = auth_hash['credentials']['token']
      self.remote_account_id  = auth_hash['uid']
      self.login              = auth_hash['user_info']['nickname']
      self.name               = auth_hash['user_info']['name']
      self.picture_url        = generate_picture_url
    end
  
    def account_url
      "http://facebook.com/#{self.login}"
    end
  
    def generate_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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cornflakeomnisocial-0.1.2.3 app/models/omnisocial/facebook_account.rb