Methods
#
N
S
Attributes
[RW] body
[RW] code
[RW] headers
[RW] message
Class Public methods
new(body, message = 200, headers = {})
# File activeresource/lib/active_resource/http_mock.rb, line 257
def initialize(body, message = 200, headers = {})
  @body, @message, @headers = body, message.to_s, headers
  @code = @message[0,3].to_i
  resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s]
  if resp_cls && !resp_cls.body_permitted?
    @body = nil
  end
  if @body.nil?
    self['Content-Length'] = "0"
  else
    self['Content-Length'] = body.size.to_s
  end
end
Instance Public methods
==(other)
# File activeresource/lib/active_resource/http_mock.rb, line 285
def ==(other)
  if (other.is_a?(Response))
    other.body == body && other.message == message && other.headers == headers
  else
    false
  end
end
[](key)
# File activeresource/lib/active_resource/http_mock.rb, line 277
def [](key)
  headers[key]
end
[]=(key, value)
# File activeresource/lib/active_resource/http_mock.rb, line 281
def []=(key, value)
  headers[key] = value
end
success?()
# File activeresource/lib/active_resource/http_mock.rb, line 273
def success?
  (200..299).include?(code)
end