# File lib/puppet/network/http/api/v1.rb, line 22
22:   def uri2indirection(http_method, uri, params)
23:     environment, indirection, key = uri.split("/", 4)[1..-1] # the first field is always nil because of the leading slash
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