lib/grape/batch/response.rb in grape-batch-1.0.2 vs lib/grape/batch/response.rb in grape-batch-1.0.3

- old
+ new

@@ -1,14 +1,10 @@ -module Grape - module Batch - class Response - def self.format(status, headers, response) - if response - body = response.respond_to?(:body) ? response.body.join : response.join - result = MultiJson.decode(body) - end - - (200..299).include?(status) ? {success: result} : {code: status, error: result['error']} - end +class Grape::Batch::Response + def self.format(status, headers, response) + if response + body = response.respond_to?(:body) ? response.body.join : response.join + result = MultiJson.decode(body) end + + (200..299).include?(status) ? {success: result} : {code: status, error: result['error']} end end