19: def uri2indirection(http_method, uri, params)
20: environment, indirection, key = uri.split("/", 4)[1..-1]
21:
22: raise ArgumentError, "The environment must be purely alphanumeric, not '%s'" % environment unless environment =~ /^\w+$/
23: raise ArgumentError, "The indirection name must be purely alphanumeric, not '%s'" % indirection unless indirection =~ /^\w+$/
24:
25: method = indirection_method(http_method, indirection)
26:
27: params[:environment] = environment
28:
29: raise ArgumentError, "No request key specified in %s" % uri if key == "" or key.nil?
30:
31: key = URI.unescape(key)
32:
33: Puppet::Indirector::Request.new(indirection, method, key, params)
34: end