Class: ActiveResource::Request
- Inherits:
-
Object
- Object
- ActiveResource::Request
- Defined in:
- lib/active_resource/http_mock.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#method ⇒ Object
Returns the value of attribute method.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #==(other_request) ⇒ Object
- #eql?(other_request) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(method, path, body = nil, headers = {}) ⇒ Request
constructor
A new instance of Request.
- #to_s ⇒ Object
Constructor Details
#initialize(method, path, body = nil, headers = {}) ⇒ Request
Returns a new instance of Request.
148 149 150 |
# File 'lib/active_resource/http_mock.rb', line 148 def initialize(method, path, body = nil, headers = {}) @method, @path, @body, @headers = method, path, body, headers.merge(ActiveResource::Connection::HTTP_FORMAT_HEADER_NAMES[method] => 'application/xml') end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
146 147 148 |
# File 'lib/active_resource/http_mock.rb', line 146 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
146 147 148 |
# File 'lib/active_resource/http_mock.rb', line 146 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
146 147 148 |
# File 'lib/active_resource/http_mock.rb', line 146 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
146 147 148 |
# File 'lib/active_resource/http_mock.rb', line 146 def path @path end |
Instance Method Details
#==(other_request) ⇒ Object
152 153 154 |
# File 'lib/active_resource/http_mock.rb', line 152 def ==(other_request) other_request.hash == hash end |
#eql?(other_request) ⇒ Boolean
156 157 158 |
# File 'lib/active_resource/http_mock.rb', line 156 def eql?(other_request) self == other_request end |
#hash ⇒ Object
164 165 166 |
# File 'lib/active_resource/http_mock.rb', line 164 def hash "#{path}#{method}#{headers}".hash end |
#to_s ⇒ Object
160 161 162 |
# File 'lib/active_resource/http_mock.rb', line 160 def to_s "<#{method.to_s.upcase}: #{path} [#{headers}] (#{body})>" end |