Methods
#
N
S
Attributes
[RW] body
[RW] message
[RW] code
[RW] headers
Class Public methods
new(body, message = 200, headers = {})
     # File activeresource/lib/active_resource/http_mock.rb, line 288
288:     def initialize(body, message = 200, headers = {})
289:       @body, @message, @headers = body, message.to_s, headers
290:       @code = @message[0,3].to_i
291: 
292:       resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s]
293:       if resp_cls && !resp_cls.body_permitted?
294:         @body = nil
295:       end
296: 
297:       if @body.nil?
298:         self['Content-Length'] = "0"
299:       else
300:         self['Content-Length'] = body.size.to_s
301:       end
302:     end
Instance Public methods
==(other)

Returns true if the other is a Response with an equal body, equal message and equal headers. Otherwise it returns false.

     # File activeresource/lib/active_resource/http_mock.rb, line 320
320:     def ==(other)
321:       if (other.is_a?(Response))
322:         other.body == body && other.message == message && other.headers == headers
323:       else
324:         false
325:       end
326:     end
[](key)
     # File activeresource/lib/active_resource/http_mock.rb, line 310
310:     def [](key)
311:       headers[key]
312:     end
[]=(key, value)
     # File activeresource/lib/active_resource/http_mock.rb, line 314
314:     def []=(key, value)
315:       headers[key] = value
316:     end
success?()

Returns true if code is 2xx, false otherwise.

     # File activeresource/lib/active_resource/http_mock.rb, line 306
306:     def success?
307:       code.in?(200..299)
308:     end