Class: HttpHelper::WebHttpResponse
- Defined in:
- lib/helpers/tmc_helpers/http_helper/http_helper.rb
Overview
Adds json attribute to http response
Instance Method Summary collapse
-
#initialize(http_response) ⇒ WebHttpResponse
constructor
A new instance of WebHttpResponse.
-
#json ⇒ Object
Public: Gets response json, if any.
Constructor Details
#initialize(http_response) ⇒ WebHttpResponse
Returns a new instance of WebHttpResponse.
86 87 88 89 |
# File 'lib/helpers/tmc_helpers/http_helper/http_helper.rb', line 86 def initialize(http_response) super(http_response) @code = self.code.to_i end |
Instance Method Details
#json ⇒ Object
Public: Gets response json, if any.
Returns a Hash of response json, or nil.
94 95 96 |
# File 'lib/helpers/tmc_helpers/http_helper/http_helper.rb', line 94 def json json_parse(self.body) rescue nil end |