class ActiveResource::Request

Attributes

body[RW]
headers[RW]
method[RW]
path[RW]

Public Class Methods

new(method, path, body = nil, headers = {}) click to toggle source
# 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

Public Instance Methods

==(req) click to toggle source
# File lib/active_resource/http_mock.rb, line 287
def ==(req)
  path == req.path && method == req.method && headers_match?(req)
end
to_s() click to toggle source
# File lib/active_resource/http_mock.rb, line 291
def to_s
  "<#{method.to_s.upcase}: #{path} [#{headers}] (#{body})>"
end

Private Instance Methods

headers_match?(req) click to toggle source
# File lib/active_resource/http_mock.rb, line 297
def headers_match?(req)
  # Ignore format header on equality if it's not defined
  format_header = ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[method]
  if headers[format_header].present? || req.headers[format_header].blank?
    headers == req.headers
  else
    headers.dup.merge(format_header => req.headers[format_header]) == req.headers
  end
end