Methods
Attributes
[RW] | body | |
[RW] | code | |
[RW] | headers | |
[RW] | message |
Public Class methods
[ show source ]
# File activeresource/lib/active_resource/http_mock.rb, line 164 164: def initialize(body, message = 200, headers = {}) 165: @body, @message, @headers = body, message.to_s, headers 166: @code = @message[0,3].to_i 167: 168: resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s] 169: if resp_cls && !resp_cls.body_permitted? 170: @body = nil 171: end 172: 173: if @body.nil? 174: self['Content-Length'] = "0" 175: else 176: self['Content-Length'] = body.size.to_s 177: end 178: end
Public Instance methods
[ show source ]
# File activeresource/lib/active_resource/http_mock.rb, line 192 192: def ==(other) 193: if (other.is_a?(Response)) 194: other.body == body && other.message == message && other.headers == headers 195: else 196: false 197: end 198: end
[ show source ]
# File activeresource/lib/active_resource/http_mock.rb, line 184 184: def [](key) 185: headers[key] 186: end
[ show source ]
# File activeresource/lib/active_resource/http_mock.rb, line 188 188: def []=(key, value) 189: headers[key] = value 190: end
[ show source ]
# File activeresource/lib/active_resource/http_mock.rb, line 180 180: def success? 181: (200..299).include?(code) 182: end