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
- #==(req) ⇒ Object
-
#initialize(method, path, body = nil, headers = {}, options = {}) ⇒ Request
constructor
A new instance of Request.
-
#remove_query_params_from_path ⇒ String
Removes query parameters from the path.
- #to_s ⇒ Object
Constructor Details
#initialize(method, path, body = nil, headers = {}, options = {}) ⇒ Request
Returns a new instance of Request.
282 283 284 |
# File 'lib/active_resource/http_mock.rb', line 282 def initialize(method, path, body = nil, headers = {}, = {}) @method, @path, @body, @headers, @options = method, path, body, headers, end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
280 281 282 |
# File 'lib/active_resource/http_mock.rb', line 280 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
280 281 282 |
# File 'lib/active_resource/http_mock.rb', line 280 def headers @headers end |
#method ⇒ Object
Returns the value of attribute method.
280 281 282 |
# File 'lib/active_resource/http_mock.rb', line 280 def method @method end |
#path ⇒ Object
Returns the value of attribute path.
280 281 282 |
# File 'lib/active_resource/http_mock.rb', line 280 def path @path end |
Instance Method Details
#==(req) ⇒ Object
286 287 288 |
# File 'lib/active_resource/http_mock.rb', line 286 def ==(req) same_path?(req) && method == req.method && headers_match?(req) end |
#remove_query_params_from_path ⇒ String
Removes query parameters from the path.
297 298 299 |
# File 'lib/active_resource/http_mock.rb', line 297 def remove_query_params_from_path path.split("?").first end |
#to_s ⇒ Object
290 291 292 |
# File 'lib/active_resource/http_mock.rb', line 290 def to_s "<#{method.to_s.upcase}: #{path} [#{headers}] (#{body})>" end |