Created
May 21, 2011 00:42
-
-
Save herestomwiththeweather/984080 to your computer and use it in GitHub Desktop.
create_request_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
def create_request_token(params={}) | |
if params[:scope] | |
scope_uri = URI.parse(params[:scope]) | |
# XXX ignoring host:port and assuming it's our host:port | |
filepath = RAILS_ROOT + '/public' + scope_uri.path | |
if File.exist?(filepath) | |
# valid asset is required | |
asset = CGI::parse(scope_uri.query)['asset'][0] | |
unless asset.blank? | |
group = Group.find_by_asset(asset) | |
RequestToken.create(:client_application => self, | |
:scope => params[:scope], | |
:group_id => group.id, | |
:callback_url=>self.token_callback_url) unless group.nil? | |
end | |
else | |
logger.info "XXX create_request_token - file not found: #{scope_uri.path}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment