Created
June 28, 2010 18:41
-
-
Save nfo/456198 to your computer and use it in GitHub Desktop.
Facebooker: replace session_key by access_token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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