Class: Shydra::Batch
- Inherits:
-
Object
- Object
- Shydra::Batch
- Defined in:
- lib/shydra/batch.rb
Constant Summary collapse
- OVER_LIMIT_RESPONSE_CODE =
429
Instance Attribute Summary collapse
-
#requests ⇒ Object
Returns the value of attribute requests.
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize ⇒ Batch
constructor
A new instance of Batch.
- #over_limit? ⇒ Boolean
Constructor Details
#initialize ⇒ Batch
Returns a new instance of Batch.
6 7 8 |
# File 'lib/shydra/batch.rb', line 6 def initialize @requests = [] end |
Instance Attribute Details
#requests ⇒ Object
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
12 13 14 |
# File 'lib/shydra/batch.rb', line 12 def finished? requests.all?{|r| !r.response.nil?} end |
#over_limit? ⇒ 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 |