lib/appfuel/response_handler.rb in appfuel-0.5.2 vs lib/appfuel/response_handler.rb in appfuel-0.5.3
- old
+ new
@@ -5,11 +5,18 @@
def initialize(response_class = Response)
@response_class = response_class
end
def create_response(data)
- return data if response?(data)
- return error(data) if error_data?(data)
+ if response?(data)
+ return data
+ end
+
+ if error_data?(data)
+ return error(data)
+ end
+
+ # TODO normalize ok key symbol or string here
ok(data)
end
def response?(data)
data.is_a?(response_class)