Sha256: d20f0e6343d1cba931271bb089bd70643efda8d4e605dbca854ba410996df765
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
require "social_profile/version" module SocialProfile class Person attr_reader :uid, :access_token, :options def initialize(uid, access_token, options = {}) @uid = uid @access_token = access_token @options = options end def self.get(provider, uid, access_token, options = {}) return if provider.nil? klass = case provider.to_s when "facebook" then People::Facebook when "vkontakte" then People::Vkontakte when "twitter" then People::Twitter else Person end klass.new(uid, access_token, options) end # Find album by id def fetch_album(album_id) raise NotImplementedError("Subclasses should implement this!") end # Create new album id def album!(options = {}) raise NotImplementedError("Subclasses should implement this!") end def find_album(album_id) return if album_id.nil? begin fetch_album(album_id) rescue Exception => e return nil end end def find_or_create_album(album_id, options = {}) record = find_album(album_id) record ||= album!(options) record end def share_photo!(album_id, filepath, options = {}) album = find_or_create_album(album_id, options[:album]) data = { :source => File.new(filepath) }.merge(options[:photo] || {}) album.photo!(data) end def tag_object!(object, tags) tags = Array.wrap(tags) return if tags.empty? || object.nil? object.tag!(:tags => tags) end # Get friends count def friends_count(options = {}) nil end # Get followers count def followers_count(options = {}) nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
social_profile-0.2.2 | lib/social_profile/person.rb |
social_profile-0.2.1 | lib/social_profile/person.rb |
social_profile-0.2.0 | lib/social_profile/person.rb |