Sha256: faf8f439031db60f58e50c1a551f53e60bb850e0f343a0d5d1bd2f8b4b5f9b57

Contents?: true

Size: 385 Bytes

Versions: 3

Compression:

Stored size: 385 Bytes

Contents

module Shydra
  class Batch
    OVER_LIMIT_RESPONSE_CODE = 429

    attr_accessor :requests
    def initialize
      @requests = []
    end

    delegate :<<, :size, :clear,  to: :requests

    def finished?
      requests.all?{|r| !r.response.nil?}
    end

    def over_limit?
      requests.any? { |r| r.response && (r.response.code == OVER_LIMIT_RESPONSE_CODE) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shydra-0.4.2 lib/shydra/batch.rb
shydra-0.1.2 lib/shydra/batch.rb
shydra-0.1.1 lib/shydra/batch.rb