Class: MsRest2::HttpOperationResponse
- Inherits:
-
Object
- Object
- MsRest2::HttpOperationResponse
- Defined in:
- lib/ms_rest2/http_operation_response.rb
Overview
Class which represents the data received and deserialized from server.
Instance Attribute Summary collapse
-
#body ⇒ String
The HTTP response body.
- #request ⇒ Object
-
#response ⇒ Faraday::Response
The HTTP response object.
Instance Method Summary collapse
-
#initialize(request, response, body = nil) ⇒ HttpOperationResponse
constructor
Creates and initialize new instance of the HttpOperationResponse class.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(request, response, body = nil) ⇒ HttpOperationResponse
Creates and initialize new instance of the HttpOperationResponse class.
25 26 27 28 29 |
# File 'lib/ms_rest2/http_operation_response.rb', line 25 def initialize(request, response, body = nil) @request = request @response = response @body = body end |
Instance Attribute Details
#body ⇒ String
Returns the HTTP response body.
18 19 20 |
# File 'lib/ms_rest2/http_operation_response.rb', line 18 def body @body end |
#request ⇒ Object
12 13 14 |
# File 'lib/ms_rest2/http_operation_response.rb', line 12 def request @request end |
#response ⇒ Faraday::Response
Returns the HTTP response object.
15 16 17 |
# File 'lib/ms_rest2/http_operation_response.rb', line 15 def response @response end |
Instance Method Details
#to_json(*a) ⇒ Object
31 32 33 34 |
# File 'lib/ms_rest2/http_operation_response.rb', line 31 def to_json(*a) res_dict = response ? { body: response.body, headers: response.headers, status: response.status } : nil {response: res_dict, request: request}.to_json(*a) end |