Class: Facebooker::Data
- Inherits:
-
Object
- Object
- Facebooker::Data
- Defined in:
- lib/facebooker/data.rb
Instance Method Summary (collapse)
-
- (Object) get_cookies(user, name = nil)
** BETA *** Gets a cookie stored on Facebook user The user from whom to get the cookies.
-
- (Object) get_preference(pref_id)
** BETA *** Gets a preference stored on Facebook pref_id The id of the preference to get.
-
- (Data) initialize(session)
constructor
A new instance of Data.
-
- (Object) set_cookie(user, name, value, expires = nil, path = nil)
** BETA *** Sets a cookie on Facebook user The user for whom this cookie needs to be set.
-
- (Object) set_preference(pref_id, value)
** BETA *** Sets a preference on Facebook pref_id The id of the preference to set value The value to set for this preference.
Constructor Details
- (Data) initialize(session)
A new instance of Data
3 4 5 |
# File 'lib/facebooker/data.rb', line 3 def initialize(session) @session = session end |
Instance Method Details
- (Object) get_cookies(user, name = nil)
** BETA *** Gets a cookie stored on Facebook user The user from whom to get the cookies. Optional: name The name of the cookie. If not specified, all the cookies for the given user get returned.
31 32 33 34 35 36 37 38 |
# File 'lib/facebooker/data.rb', line 31 def (user, name=nil) @cookies = @session.post( 'facebook.data.getCookies', :uid => User.cast_to_facebook_id(user), :name => name) do |response| response.map do |hash| Cookie.from_hash(hash) end end end |
- (Object) get_preference(pref_id)
** BETA *** Gets a preference stored on Facebook pref_id The id of the preference to get
44 45 46 |
# File 'lib/facebooker/data.rb', line 44 def get_preference(pref_id) @session.post('facebook.data.getUserPreference', :pref_id=>pref_id) end |
- (Object) set_cookie(user, name, value, expires = nil, path = nil)
** BETA *** Sets a cookie on Facebook user The user for whom this cookie needs to be set. name Name of the cookie value Value of the cookie Optional: expires Time when the cookie should expire. If not specified, the cookie never expires. path Path relative to the application's callback URL, with which the cookie should be associated. (default value is /?
16 17 18 19 20 21 22 23 |
# File 'lib/facebooker/data.rb', line 16 def (user, name, value, expires=nil, path=nil) @session.post('facebook.data.setCookie', :uid => User.cast_to_facebook_id(user), :name => name, :value => value, :expires => expires, :path => path) {|response| response == '1'} end |
- (Object) set_preference(pref_id, value)
** BETA *** Sets a preference on Facebook pref_id The id of the preference to set value The value to set for this preference
53 54 55 |
# File 'lib/facebooker/data.rb', line 53 def set_preference(pref_id, value) @session.post('facebook.data.setUserPreference', :pref_id=>pref_id, :value=>value) end |