Method: Croesus::WebResponse#initialize
- Defined in:
- lib/croesus/web_client/web_response.rb
#initialize(response) ⇒ WebResponse
Returns a new instance of WebResponse.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/croesus/web_client/web_response.rb', line 29 def initialize(response) @code = response.code; @headers = response.headers @raw_body = response @body = @raw_body = response. Croesus.last_response = { code: response.code, headers: response.headers, body: JSON.parse(response.body), cookies: response., description: response.description }.recursively_normalize_keys begin @body = JSON.parse(@raw_body) rescue Exception end end |