Class: MiniFB::User

Inherits:
Object
  • Object
show all
Defined in:
lib/mini_fb.rb

Constant Summary collapse

FIELDS =
[:uid, :status, :political, :pic_small, :name, :quotes, :is_app_user, :tv, :profile_update_time, :meeting_sex, :hs_info, :timezone, :relationship_status, :hometown_location, :about_me, :wall_count, :significant_other_id, :pic_big, :music, :work_history, :sex, :religion, :notes_count, :activities, :pic_square, :movies, :has_added_app, :education_history, :birthday, :birthday_date, :first_name, :meeting_for, :last_name, :interests, :current_location, :pic, :books, :affiliations, :locale, :profile_url, :proxied_email, :email_hashes, :allowed_restrictions, :pic_with_logo, :pic_big_with_logo, :pic_small_with_logo, :pic_square_with_logo]
STANDARD_FIELDS =
[:uid, :first_name, :last_name, :name, :timezone, :birthday, :sex, :affiliations, :locale, :profile_url, :proxied_email]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fb_hash, session) ⇒ User

Returns a new instance of User.



78
79
80
81
# File 'lib/mini_fb.rb', line 78

def initialize(fb_hash, session)
    @fb_hash = fb_hash
    @session = session
end

Class Method Details

.all_fieldsObject



70
71
72
# File 'lib/mini_fb.rb', line 70

def self.all_fields
    FIELDS.join(",")
end

.standard_fieldsObject



74
75
76
# File 'lib/mini_fb.rb', line 74

def self.standard_fields
    STANDARD_FIELDS.join(",")
end

Instance Method Details

#[](key) ⇒ Object



83
84
85
# File 'lib/mini_fb.rb', line 83

def [](key)
    @fb_hash[key]
end

#merge_aid(aid, uid) ⇒ Object



99
100
101
102
103
104
# File 'lib/mini_fb.rb', line 99

def merge_aid(aid, uid)
    uid = uid.to_i
    ret = (uid << 32) + (aid & 0xFFFFFFFF)
#            puts 'merge_aid=' + ret.inspect
    return ret
end

#profile_photosObject



91
92
93
# File 'lib/mini_fb.rb', line 91

def profile_photos
    @session.photos.get("uid"=>uid, "aid"=>profile_pic_album_id)
end

#profile_pic_album_idObject



95
96
97
# File 'lib/mini_fb.rb', line 95

def profile_pic_album_id
    merge_aid(-3, uid)
end

#uidObject



87
88
89
# File 'lib/mini_fb.rb', line 87

def uid
    return self["uid"]
end