module Github::Request
def request(method, path, params) # :nodoc:
def request(method, path, params) # :nodoc: if !METHODS.include?(method) raise ArgumentError, "unkown http method: #{method}" end puts "EXECUTED: #{method} - #{path} with PARAMS: #{params}" if ENV['DEBUG'] conn_options = params.options.merge(current_options) conn = connection(conn_options) if conn.path_prefix != '/' && path.index(conn.path_prefix) != 0 path = (conn.path_prefix + path).gsub(/\/(\/)*/, '/') end response = conn.send(method) do |request| case method.to_sym when *(METHODS - METHODS_WITH_BODIES) request.body = params.data if params.has_key?('data') request.url(path, params.to_hash) when *METHODS_WITH_BODIES request.path = path request.body = params.data unless params.empty? end end ResponseWrapper.new(response, self) end