Class: Shydra::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/shydra/batch.rb

Constant Summary collapse

OVER_LIMIT_RESPONSE_CODE =
429

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBatch

Returns a new instance of Batch.



6
7
8
# File 'lib/shydra/batch.rb', line 6

def initialize
  @requests = []
end

Instance Attribute Details

#requestsObject

Returns the value of attribute requests.



5
6
7
# File 'lib/shydra/batch.rb', line 5

def requests
  @requests
end

Instance Method Details

#finished?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/shydra/batch.rb', line 12

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

#over_limit?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/shydra/batch.rb', line 16

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