Skip to content

Instantly share code, notes, and snippets.

@nfo
Created June 28, 2010 18:41
Show Gist options
  • Save nfo/456198 to your computer and use it in GitHub Desktop.
Save nfo/456198 to your computer and use it in GitHub Desktop.
Facebooker: replace session_key by access_token
# Monkey patch Facebooker to set an access token instead of a session key,
# and use the access token on EVERY requests.
Facebooker::Session.class_eval do
def post_without_logging_with_access_token(method, params = {}, use_session_key = true, &proc)
params[:access_token] ||= (params.delete(:session_key) || @session_key)
post_without_logging_without_access_token(method, params, false, &proc)
end
alias_method_chain :post_without_logging, :access_token
end
# Monkey patch Facebooker to use HTTPS instead of HTTP
Facebooker::Service.class_eval do
private
def url(base = nil)
base ||= @api_base
URI.parse('https://'+ base + @api_path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment