lib/ivapi/error.rb in ivapi-1.1.5 vs lib/ivapi/error.rb in ivapi-1.1.6

- old
+ new

@@ -6,19 +6,17 @@ # response - The Hash of HTTP response. # # Returns the Ivapi::Error. def self.from_response(response) status = response[:status].to_i - body = response[:body].to_s - headers = response[:response_headers] - if klass = case status - when 400 then Ivapi::BadRequest - when 401 then Ivapi::Unauthorized - when 403 then Ivapi::Forbidden - end - klass.new(response) - end + klass = case status + when 400 then Ivapi::BadRequest + when 401 then Ivapi::Unauthorized + when 403 then Ivapi::Forbidden + end + + klass.new(response) if klass end end # Raised when iv.lt returns a 400 HTTP status code class BadRequest < Error; end