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:
68:
69:
70:
71: if key.to_s =~ /^\w+:\/\//
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