class Haile::Response
Attributes
error[RW]
TODO make this attr_reader and set the error some other way
Public Class Methods
error(message)
click to toggle source
# File lib/haile/response.rb, line 24 def self.error(message) error = new(nil) error.error = message error end
new(http)
click to toggle source
# File lib/haile/response.rb, line 7 def initialize(http) @http = http @error = error_message_from_response end
Public Instance Methods
error?()
click to toggle source
# File lib/haile/response.rb, line 16 def error? !success? end
parsed_response()
click to toggle source
# File lib/haile/response.rb, line 20 def parsed_response @http && @http.parsed_response end
success?()
click to toggle source
# File lib/haile/response.rb, line 12 def success? @http && @http.success? end
to_s()
click to toggle source
# File lib/haile/response.rb, line 30 def to_s if success? "OK" else "ERROR: #{error}" end end
Private Instance Methods
error_message_from_response()
click to toggle source
# File lib/haile/response.rb, line 40 def error_message_from_response return if success? return if @http.nil? @http.body end