Class: PecCalcClient::Response
- Inherits:
-
Object
- Object
- PecCalcClient::Response
- Defined in:
- lib/pec_calc_client/response.rb
Overview
Response from api server
Instance Method Summary collapse
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #to_hash ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/pec_calc_client/response.rb', line 6 def initialize(response) @response = response fail BadResponse, 'Respons Code not 200' if @response.code != '200' end |
Instance Method Details
#to_hash ⇒ Object
11 12 13 |
# File 'lib/pec_calc_client/response.rb', line 11 def to_hash JSON.parse @response.body if @response.body.to_s != '' end |