Class: ActiveResource::Request

Inherits:
Object
  • Object
show all
Defined in:
activeresource/lib/active_resource/http_mock.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Request) initialize(method, path, body = nil, headers = {})



146
147
148
# File 'activeresource/lib/active_resource/http_mock.rb', line 146

def initialize(method, path, body = nil, headers = {})
  @method, @path, @body, @headers = method, path, body, headers.merge(ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[method] => 'application/xml')
end

Instance Attribute Details

- (Object) body

Returns the value of attribute body



144
145
146
# File 'activeresource/lib/active_resource/http_mock.rb', line 144

def body
  @body
end

- (Object) headers

Returns the value of attribute headers



144
145
146
# File 'activeresource/lib/active_resource/http_mock.rb', line 144

def headers
  @headers
end

- (Object) method

Returns the value of attribute method



144
145
146
# File 'activeresource/lib/active_resource/http_mock.rb', line 144

def method
  @method
end

- (Object) path

Returns the value of attribute path



144
145
146
# File 'activeresource/lib/active_resource/http_mock.rb', line 144

def path
  @path
end

Instance Method Details

- (Object) ==(req)



150
151
152
# File 'activeresource/lib/active_resource/http_mock.rb', line 150

def ==(req)
  path == req.path && method == req.method && headers == req.headers
end

- (Object) to_s



154
155
156
# File 'activeresource/lib/active_resource/http_mock.rb', line 154

def to_s
  "<#{method.to_s.upcase}: #{path} [#{headers}] (#{body})>"
end