# File lib/puppet/indirector/request.rb, line 52
52:   def initialize(indirection_name, method, key_or_instance, options_or_instance = {})
53:     if options_or_instance.is_a? Hash
54:       options = options_or_instance
55:       @instance = nil
56:     else
57:       options  = {}
58:       @instance = options_or_instance
59:     end
60: 
61:     self.indirection_name = indirection_name
62:     self.method = method
63: 
64:     set_attributes(options)
65: 
66:     @options = options.inject({}) { |hash, ary| hash[ary[0].to_sym] = ary[1]; hash }
67: 
68:     if key_or_instance.is_a?(String) || key_or_instance.is_a?(Symbol)
69:       key = key_or_instance
70:     else
71:       @instance ||= key_or_instance
72:     end
73: 
74:     if key
75:       # If the request key is a URI, then we need to treat it specially,
76:       # because it rewrites the key.  We could otherwise strip server/port/etc
77:       # info out in the REST class, but it seemed bad design for the REST
78:       # class to rewrite the key.
79:       if key.to_s =~ /^\w+:\/\// # it's a URI
80:         set_uri_key(key)
81:       else
82:         @key = key
83:       end
84:     end
85: 
86:     @key = @instance.name if ! @key and @instance
87:   end