Class: CGI::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/facebooker/rails/facebook_session_handling.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_optionsObject (readonly)

Returns the value of attribute initialization_options.



28
29
30
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 28

def initialization_options
  @initialization_options
end

#requestObject (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_idObject



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_facebookerObject



61
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 61

alias :create_new_id_aliased_by_facebooker :create_new_id

#facebook_session_keyObject



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_facebookerObject



27
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 27

alias :initialize_aliased_by_facebooker :initialize

#request_parametersObject



45
46
47
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 45

def request_parameters
  request.instance_variable_get("@request_params")
end

#session_keyObject



53
54
55
# File 'lib/facebooker/rails/facebook_session_handling.rb', line 53

def session_key
  initialization_options['session_key'] || '_session_id'
end

#session_key_should_be_set_with_facebook_session_key?Boolean

Returns:

  • (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_idObject



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