Class: MiniFB::Session

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, secret_key, session_key, uid) ⇒ Session

Returns a new instance of Session.



37
38
39
40
41
42
# File 'lib/photo_mini_fb.rb', line 37

def initialize(api_key, secret_key, session_key, uid)
    @api_key = api_key
    @secret_key = FaceBookSecret.new secret_key
    @session_key = session_key
    @uid = uid
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



34
35
36
# File 'lib/photo_mini_fb.rb', line 34

def api_key
  @api_key
end

#secret_keyObject

Returns the value of attribute secret_key.



34
35
36
# File 'lib/photo_mini_fb.rb', line 34

def secret_key
  @secret_key
end

#session_keyObject

Returns the value of attribute session_key.



34
35
36
# File 'lib/photo_mini_fb.rb', line 34

def session_key
  @session_key
end

#uidObject

Returns the value of attribute uid.



34
35
36
# File 'lib/photo_mini_fb.rb', line 34

def uid
  @uid
end

Instance Method Details

#call(method, params = {}) ⇒ Object



56
57
58
# File 'lib/photo_mini_fb.rb', line 56

def call(method, params={})
    return MiniFB.call(api_key, secret_key, method, params.update("session_key"=>session_key))
end

#photosObject



51
52
53
# File 'lib/photo_mini_fb.rb', line 51

def photos
    Photos.new(self)
end

#userObject

returns current user



45
46
47
48
49
# File 'lib/photo_mini_fb.rb', line 45

def user
    return @user unless @user.nil?
    @user = User.new(MiniFB.call(@api_key, @secret_key, "Users.getInfo", "session_key"=>@session_key, "uids"=>@uid, "fields"=>User.all_fields)[0], self)
    @user
end