Class: Philiprehberger::HttpMock::Response
- Inherits:
-
Object
- Object
- Philiprehberger::HttpMock::Response
- Defined in:
- lib/philiprehberger/http_mock/response.rb
Overview
Represents a stubbed HTTP response
Instance Attribute Summary collapse
-
#body ⇒ String
readonly
The response body.
-
#headers ⇒ Hash
readonly
The response headers.
-
#status ⇒ Integer
readonly
The HTTP status code.
Instance Method Summary collapse
-
#initialize(status: 200, body: '', headers: {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(status: 200, body: '', headers: {}) ⇒ Response
Returns a new instance of Response.
19 20 21 22 23 |
# File 'lib/philiprehberger/http_mock/response.rb', line 19 def initialize(status: 200, body: '', headers: {}) @status = status @body = body @headers = headers end |
Instance Attribute Details
#body ⇒ String (readonly)
Returns the response body.
11 12 13 |
# File 'lib/philiprehberger/http_mock/response.rb', line 11 def body @body end |
#headers ⇒ Hash (readonly)
Returns the response headers.
14 15 16 |
# File 'lib/philiprehberger/http_mock/response.rb', line 14 def headers @headers end |
#status ⇒ Integer (readonly)
Returns the HTTP status code.
8 9 10 |
# File 'lib/philiprehberger/http_mock/response.rb', line 8 def status @status end |