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