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