require 'openssl'
require 'json'
GIT_CMD_MAP = {
'git-upload-pack' => 'read',
'git-upload-archive' => 'read',
'git-receive-pack' => 'write',
}
end
end
Rails.logger.debug "Performing GET #{url}"
<<-MSG
Received response #{response.code} => <#{response.body}>.
MSG
end
response
rescue UriFetcher::TooManyRedirectionsError => error
response = error.last_response
Rails.logger.error do
<<-ERROR
API call <GET #{url}> failed:
#{response.code} => <#{response.body}>.
We also encountered this error:
<##{error.class}> <#{error.message}>
With this stacktrace:
#{error.backtrace.join('\n')}
ERROR
end
raise
end
private
def build_url
access_url = "#{host}/repositories/#{repo_path}/ssh_access"
options = "?key_id=#{key_id}&permission=#{access_right}"
"#{access_url}#{options}"
end
end