Class: ActiveResource::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/active_resource/http_mock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, path, body = nil, headers = {}) ⇒ Request

Returns a new instance of Request.



283
284
285
# File 'lib/active_resource/http_mock.rb', line 283

def initialize(method, path, body = nil, headers = {})
  @method, @path, @body, @headers = method, path, body, headers
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



281
282
283
# File 'lib/active_resource/http_mock.rb', line 281

def body
  @body
end

#headersObject

Returns the value of attribute headers.



281
282
283
# File 'lib/active_resource/http_mock.rb', line 281

def headers
  @headers
end

#methodObject

Returns the value of attribute method.



281
282
283
# File 'lib/active_resource/http_mock.rb', line 281

def method
  @method
end

#pathObject

Returns the value of attribute path.



281
282
283
# File 'lib/active_resource/http_mock.rb', line 281

def path
  @path
end

Instance Method Details

#==(req) ⇒ Object



287
288
289
# File 'lib/active_resource/http_mock.rb', line 287

def ==(req)
  path == req.path && method == req.method && headers_match?(req)
end

#to_sObject



291
292
293
# File 'lib/active_resource/http_mock.rb', line 291

def to_s
  "<#{method.to_s.upcase}: #{path} [#{headers}] (#{body})>"
end