Parent

Files

ActiveResource::Response

Attributes

body[RW]
message[RW]
code[RW]
headers[RW]

Public Class Methods

new(body, message = 200, headers = {}) click to toggle source
     # File lib/active_resource/http_mock.rb, line 256
256:     def initialize(body, message = 200, headers = {})
257:       @body, @message, @headers = body, message.to_s, headers
258:       @code = @message[0,3].to_i
259: 
260:       resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s]
261:       if resp_cls && !resp_cls.body_permitted?
262:         @body = nil
263:       end
264: 
265:       if @body.nil?
266:         self['Content-Length'] = "0"
267:       else
268:         self['Content-Length'] = body.size.to_s
269:       end
270:     end

Public Instance Methods

==(other) click to toggle source
     # File lib/active_resource/http_mock.rb, line 284
284:     def ==(other)
285:       if (other.is_a?(Response))
286:         other.body == body && other.message == message && other.headers == headers
287:       else
288:         false
289:       end
290:     end
[](key) click to toggle source
     # File lib/active_resource/http_mock.rb, line 276
276:     def [](key)
277:       headers[key]
278:     end
[]=(key, value) click to toggle source
     # File lib/active_resource/http_mock.rb, line 280
280:     def []=(key, value)
281:       headers[key] = value
282:     end
success?() click to toggle source
     # File lib/active_resource/http_mock.rb, line 272
272:     def success?
273:       (200..299).include?(code)
274:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.