Sha256: 4454c517a90504e5ac04f47a8eca87e92d8776324facbb21111fff805027cc06

Contents?: true

Size: 378 Bytes

Versions: 3

Compression:

Stored size: 378 Bytes

Contents

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
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-batch-1.0.2 lib/grape/batch/response.rb
grape-batch-1.0.1 lib/grape/batch/response.rb
grape-batch-1.0.0 lib/grape/batch/response.rb