Class: MiniFB::Session
- Inherits:
-
Object
- Object
- MiniFB::Session
- Defined in:
- lib/mini_fb.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#session_key ⇒ Object
Returns the value of attribute session_key.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
- #call(method, params = {}) ⇒ Object
-
#initialize(api_key, secret_key, session_key, uid) ⇒ Session
constructor
A new instance of Session.
- #photos ⇒ Object
-
#user ⇒ Object
returns current user.
Constructor Details
#initialize(api_key, secret_key, session_key, uid) ⇒ Session
Returns a new instance of Session.
43 44 45 46 47 48 |
# File 'lib/mini_fb.rb', line 43 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_key ⇒ Object
Returns the value of attribute api_key.
41 42 43 |
# File 'lib/mini_fb.rb', line 41 def api_key @api_key end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
41 42 43 |
# File 'lib/mini_fb.rb', line 41 def secret_key @secret_key end |
#session_key ⇒ Object
Returns the value of attribute session_key.
41 42 43 |
# File 'lib/mini_fb.rb', line 41 def session_key @session_key end |
#uid ⇒ Object
Returns the value of attribute uid.
41 42 43 |
# File 'lib/mini_fb.rb', line 41 def uid @uid end |
Instance Method Details
#call(method, params = {}) ⇒ Object
61 62 63 |
# File 'lib/mini_fb.rb', line 61 def call(method, params={}) return MiniFB.call(api_key, secret_key, method, params.update("session_key"=>session_key)) end |
#photos ⇒ Object
57 58 59 |
# File 'lib/mini_fb.rb', line 57 def photos Photos.new(self) end |
#user ⇒ Object
returns current user
51 52 53 54 55 |
# File 'lib/mini_fb.rb', line 51 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 |