Class: SimpleFacebookConnect::User
- Inherits:
-
Object
- Object
- SimpleFacebookConnect::User
- Defined in:
- lib/simple_facebook_connect/user.rb
Constant Summary collapse
- FIELDS =
[:uid, :hometown_location, :first_name, :last_name, :current_location, :pic, :locale, :email_hashes, :about_me, :interests]
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
- #coma_seperated_fields ⇒ Object
-
#initialize(uid, session) ⇒ User
constructor
A new instance of User.
- #populate ⇒ Object
Constructor Details
#initialize(uid, session) ⇒ User
Returns a new instance of User.
9 10 11 12 13 |
# File 'lib/simple_facebook_connect/user.rb', line 9 def initialize(uid, session) @uid = uid @session = session populate end |
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/simple_facebook_connect/user.rb', line 7 def session @session end |
Instance Method Details
#coma_seperated_fields ⇒ Object
23 24 25 |
# File 'lib/simple_facebook_connect/user.rb', line 23 def coma_seperated_fields FIELDS.join(',') end |
#populate ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/simple_facebook_connect/user.rb', line 15 def populate @session.post('facebook.users.getInfo', :fields => coma_seperated_fields, :uids => uid) do |response| FIELDS.each do |field| instance_variable_set(:"@#{field}", response.first[field.to_s]) end end end |