Class: CGI::Session
- Inherits:
-
Object
- Object
- CGI::Session
- Defined in:
- lib/facebooker/rails/facebook_session_handling.rb
Instance Attribute Summary collapse
-
#initialization_options ⇒ Object
readonly
Returns the value of attribute initialization_options.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #create_new_id ⇒ Object
- #create_new_id_aliased_by_facebooker ⇒ Object
- #facebook_session_key ⇒ Object
-
#initialize(request, option = {}) ⇒ Session
constructor
A new instance of Session.
- #initialize_aliased_by_facebooker ⇒ Object
- #request_parameters ⇒ Object
- #session_key ⇒ Object
- #session_key_should_be_set_with_facebook_session_key? ⇒ Boolean
- #set_session_id ⇒ Object
Constructor Details
#initialize(request, option = {}) ⇒ Session
Returns a new instance of Session.
30 31 32 33 34 35 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 30 def initialize(request, option={}) @request = request @initialization_options = option option['session_id'] ||= set_session_id initialize_aliased_by_facebooker(request, option) end |
Instance Attribute Details
#initialization_options ⇒ Object (readonly)
Returns the value of attribute initialization_options.
28 29 30 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 28 def @initialization_options end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
28 29 30 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 28 def request @request end |
Instance Method Details
#create_new_id ⇒ Object
63 64 65 66 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 63 def create_new_id @new_session = true @session_id || create_new_id_aliased_by_facebooker end |
#create_new_id_aliased_by_facebooker ⇒ Object
61 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 61 alias :create_new_id_aliased_by_facebooker :create_new_id |
#facebook_session_key ⇒ Object
57 58 59 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 57 def facebook_session_key 'fb_sig_session_key' end |
#initialize_aliased_by_facebooker ⇒ Object
27 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 27 alias :initialize_aliased_by_facebooker :initialize |
#request_parameters ⇒ Object
45 46 47 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 45 def request_parameters request.instance_variable_get("@request_params") end |
#session_key ⇒ Object
53 54 55 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 53 def session_key ['session_key'] || '_session_id' end |
#session_key_should_be_set_with_facebook_session_key? ⇒ Boolean
49 50 51 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 49 def session_key_should_be_set_with_facebook_session_key? request_parameters[session_key].blank? && !request_parameters[facebook_session_key].blank? end |
#set_session_id ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 37 def set_session_id if session_key_should_be_set_with_facebook_session_key? request_parameters[facebook_session_key] else request_parameters[session_key] end end |