Skip to content

Commit

Permalink
facebook/rails_util.rb: rename methods with rg there...
Browse files Browse the repository at this point in the history
  • Loading branch information
godfat committed Nov 23, 2011
1 parent 85c4401 commit e7c984a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lib/rest-core/client/facebook/rails_util.rb
Expand Up @@ -44,7 +44,7 @@ def rc_facebook_setup options={}
# before, in that case, the fbs would be inside session,
# as we just saved it there

rc_facebook_check_rg_fbs # check rc_facebook storage
rc_facebook_check_fbs # check rc_facebook storage

if rc_options_get(RestCore::Facebook, :ensure_authorized) &&
!rc_facebook.authorized?
Expand Down Expand Up @@ -133,7 +133,7 @@ def rc_facebook_check_params_signed_request
" parsed: #{rc_facebook.data.inspect}")

if rc_facebook.authorized?
rc_facebook_write_rg_fbs
rc_facebook_write_fbs
else
logger.warn(
"WARN: Facebook: bad signed_request: #{params[:signed_request]}")
Expand All @@ -152,7 +152,7 @@ def rc_facebook_check_params_session
" #{rc_facebook.data.inspect}")

if rc_facebook.authorized?
rc_facebook_write_rg_fbs
rc_facebook_write_fbs
else
logger.warn("WARN: Facebook: bad session: #{params[:session]}")
end
Expand Down Expand Up @@ -183,24 +183,24 @@ def rc_facebook_check_code
"#{rc_facebook_normalized_request_uri}," \
" parsed: #{rc_facebook.data.inspect}")

rc_facebook_write_rg_fbs if rc_facebook.authorized?
rc_facebook_write_fbs if rc_facebook.authorized?
end
# ==================== end facebook check ======================



# ==================== begin check ================================
def rc_facebook_storage_key
"rc_facebook_fbs_#{rc_facebook.app_id}"
"rc_facebook_#{rc_facebook.app_id}"
end

def rc_facebook_check_rg_fbs
rc_facebook_check_rg_handler # custom method to store fbs
rc_facebook_check_rg_session # prefered way to store fbs
rc_facebook_check_rg_cookies # in canvas, session might not work..
def rc_facebook_check_fbs
rc_facebook_check_handler # custom method to store fbs
rc_facebook_check_session # prefered way to store fbs
rc_facebook_check_cookies # in canvas, session might not work..
end

def rc_facebook_check_rg_handler handler=
def rc_facebook_check_handler handler=
rc_options_get(RestCore::Facebook, :check_handler)

return if rc_facebook.authorized? || !handler
Expand All @@ -209,7 +209,7 @@ def rc_facebook_check_rg_handler handler=
" #{rc_facebook.data.inspect}")
end

def rc_facebook_check_rg_session
def rc_facebook_check_session
return if rc_facebook.authorized? ||
!rc_options_get(RestCore::Facebook, :write_session) ||
!(fbs = session[rc_facebook_storage_key])
Expand All @@ -219,7 +219,7 @@ def rc_facebook_check_rg_session
" #{rc_facebook.data.inspect}")
end

def rc_facebook_check_rg_cookies
def rc_facebook_check_cookies
return if rc_facebook.authorized? ||
!rc_options_get(RestCore::Facebook, :write_cookies) ||
!(fbs = cookies[rc_facebook_storage_key])
Expand All @@ -230,27 +230,27 @@ def rc_facebook_check_rg_cookies
end
# ==================== end check ================================
# ==================== begin write ================================
def rc_facebook_write_rg_fbs
rc_facebook_write_rg_handler
rc_facebook_write_rg_session
rc_facebook_write_rg_cookies
def rc_facebook_write_fbs
rc_facebook_write_handler
rc_facebook_write_session
rc_facebook_write_cookies
end

def rc_facebook_write_rg_handler handler=
def rc_facebook_write_handler handler=
rc_options_get(RestCore::Facebook, :write_handler)

return if !handler
handler.call(fbs = rc_facebook.fbs)
logger.debug("DEBUG: Facebook: called write_handler: fbs => #{fbs}")
end

def rc_facebook_write_rg_session
def rc_facebook_write_session
return if !rc_options_get(RestCore::Facebook, :write_session)
session[rc_facebook_storage_key] = fbs = rc_facebook.fbs
logger.debug("DEBUG: Facebook: wrote session: fbs => #{fbs}")
end

def rc_facebook_write_rg_cookies
def rc_facebook_write_cookies
return if !rc_options_get(RestCore::Facebook, :write_cookies)
cookies[rc_facebook_storage_key] = fbs = rc_facebook.fbs
logger.debug("DEBUG: Facebook: wrote cookies: fbs => #{fbs}")
Expand Down

0 comments on commit e7c984a

Please sign in to comment.