module Ecoportal module API module Common class BatchResponse attr_reader :status, :body, :result def initialize(status, body, result = nil) @status = HTTP::Response::Status.new(status) @body = body @result = result end def success? status.success? end def each [*@result].each do |doc| yield doc end end def print if success? each(&:print) else puts "Request failed." end end end end end end