class EzClient::Response

Attributes

body[RW]
http_response[RW]

Public Class Methods

new(http_response) click to toggle source
# File lib/ezclient/response.rb, line 6
def initialize(http_response)
  self.http_response = http_response
  self.body = http_response.body.to_s # Make sure we read the body for persistent connection
end

Public Instance Methods

client_error?() click to toggle source
# File lib/ezclient/response.rb, line 32
def client_error?
  code.between?(400, 499)
end
code() click to toggle source
# File lib/ezclient/response.rb, line 15
def code
  http_response.code
end
Also aliased as: status
cookies() click to toggle source
# File lib/ezclient/response.rb, line 20
def cookies
  http_response.cookies
end
error?() click to toggle source
# File lib/ezclient/response.rb, line 40
def error?
  client_error? || server_error?
end
headers() click to toggle source
# File lib/ezclient/response.rb, line 11
def headers
  http_response.headers
end
ok?() click to toggle source
# File lib/ezclient/response.rb, line 24
def ok?
  code.between?(200, 299)
end
redirect?() click to toggle source
# File lib/ezclient/response.rb, line 28
def redirect?
  code.between?(300, 399)
end
server_error?() click to toggle source
# File lib/ezclient/response.rb, line 36
def server_error?
  code.between?(500, 599)
end
status()
Alias for: code