class Croesus::WebResponse
Attributes
body[R]
code[R]
headers[R]
raw_body[R]
Public Class Methods
new(response)
click to toggle source
# 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 @cookies = response.cookies Croesus.last_response = { code: response.code, headers: response.headers, body: JSON.parse(response.body), cookies: response.cookies, description: response.description }.recursively_normalize_keys begin @body = JSON.parse(@raw_body) rescue Exception end end
Public Instance Methods
==(other)
click to toggle source
# File lib/croesus/web_client/web_response.rb, line 50 def ==(other) @headers == other end
inspect()
click to toggle source
# File lib/croesus/web_client/web_response.rb, line 54 def inspect @headers.inspect end
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/croesus/web_client/web_response.rb, line 58 def method_missing(name, *args, &block) if @headers.respond_to?(name) @headers.send(name, *args, &block) else super end end
respond_to?(method)
click to toggle source
Calls superclass method
# File lib/croesus/web_client/web_response.rb, line 66 def respond_to?(method) super || @headers.respond_to?(method) end