lib/rentjuicer/response.rb in rentjuicer-0.5.1 vs lib/rentjuicer/response.rb in rentjuicer-0.6.0
- old
+ new
@@ -1,16 +1,16 @@
module Rentjuicer
class Response
attr_accessor :body
- def initialize(response, raise_error = true)
+ def initialize(response, raise_error = false)
rash_response(response)
raise Error.new(self.body.code, self.body.message) if !success? && raise_error
end
def success?
- self.body.status == "ok"
+ self.body && !self.body.blank? && self.body.respond_to?(:status) && self.body.status == "ok"
end
def method_missing(method_name, *args)
if self.body.respond_to?(method_name)
self.body.send(method_name)