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 186
186:     def initialize(body, message = 200, headers = {})
187:       @body, @message, @headers = body, message.to_s, headers
188:       @code = @message[0,3].to_i
189: 
190:       resp_cls = Net::HTTPResponse::CODE_TO_OBJ[@code.to_s]
191:       if resp_cls && !resp_cls.body_permitted?
192:         @body = nil
193:       end
194: 
195:       if @body.nil?
196:         self['Content-Length'] = "0"
197:       else
198:         self['Content-Length'] = body.size.to_s
199:       end
200:     end

Public Instance Methods

==(other) click to toggle source
     # File lib/active_resource/http_mock.rb, line 214
214:     def ==(other)
215:       if (other.is_a?(Response))
216:         other.body == body && other.message == message && other.headers == headers
217:       else
218:         false
219:       end
220:     end
[](key) click to toggle source
     # File lib/active_resource/http_mock.rb, line 206
206:     def [](key)
207:       headers[key]
208:     end
[]=(key, value) click to toggle source
     # File lib/active_resource/http_mock.rb, line 210
210:     def []=(key, value)
211:       headers[key] = value
212:     end
success?() click to toggle source
     # File lib/active_resource/http_mock.rb, line 202
202:     def success?
203:       (200..299).include?(code)
204:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.