class Joey::User

Public Class Methods

recognize?(hash) click to toggle source
# File lib/joey/user.rb, line 16
def self.recognize?(hash)
  !hash.has_key?("category")
end

Public Instance Methods

friends!(ids) click to toggle source
# File lib/joey/user.rb, line 49
def friends!(ids)
  data = self.client.rest_call('users.getInfo', :uids => ids, :fields =>
                               'about_me,activities,affiliations,books,birthday,birthday_date,current_location,education_history,
                                             email,family,first_name,hometown_location,hs_info,interests,is_app_user,is_blocked,last_name,
                                             locale,meeting_for,meeting_sex,movies,music,name,notes_count,pic,pic_big,pic_small,pic_square,
                                             pic_with_logo,pic_big_with_logo,pic_small_with_logo,pic_square_with_logo,
                                             political,profile_blurb,profile_update_time,profile_url,quotes,relationship_status,religion,sex,
                                             significant_other_id,status,timezone,tv,username,wall_count,website,work_history')
 self.client.map_data(data, self.class)
end
has_app_permission?(ext_perm) click to toggle source
# File lib/joey/user.rb, line 44
def has_app_permission?(ext_perm)
  permissions = client.get_object('me/permissions', {})['data'].first
  boolianize(permissions[ext_perm])
end
info(args) click to toggle source
# File lib/joey/user.rb, line 60
def info(args)
  data = self.client.rest_call('users.getInfo', :uids => self.id, :fields => args.join(','))
  user = self.client.map_data(data, self.class).first
  user.id = self.id
  user
end
valid?() click to toggle source
# File lib/joey/user.rb, line 77
def valid?
  self.validate
  puts self.errors.inspect unless self.errors.empty?
  self.errors.empty?
end
validate() click to toggle source
# File lib/joey/user.rb, line 67
def validate
  errors << { :message => 'id should not be nil' } if id.nil?
  errors << { :message => "name should be string but is #{name.inspect}" } unless name.is_a?(String)
  errors << { :message => "gender should be 'male' or 'female' but is #{gender.inspect}" } unless ['male', 'female', nil].include?(gender)
  errors << { :message => "pic big is neither string nor nil but is #{pic_big.inspect}" } unless pic_big.is_a?(String) || pic_big.nil?
  errors << { :message => "current location is neither Joey::Location nor nil but is #{current_location.inspect}" } unless current_location.is_a?(Joey::Location) || current_location.nil?
  errors << { :message => "Facebook is an idiot. This is an event instead of a Joey::User or Joey::Page" } unless start_time.nil?
  # updated_time.to_time rescue errors << { :message => 'updated_time is not compatible' }
end