Class: KnapsackPro::QueueAllocator::Batch
- Inherits:
-
Object
- Object
- KnapsackPro::QueueAllocator::Batch
- Defined in:
- lib/knapsack_pro/queue_allocator.rb
Instance Method Summary collapse
- #connection_failed? ⇒ Boolean
-
#initialize(connection, response) ⇒ Batch
constructor
A new instance of Batch.
- #queue_exists? ⇒ Boolean
- #test_files ⇒ Object
Constructor Details
#initialize(connection, response) ⇒ Batch
Returns a new instance of Batch.
8 9 10 11 12 13 |
# File 'lib/knapsack_pro/queue_allocator.rb', line 8 def initialize(connection, response) @connection = connection @response = response raise ArgumentError.new(connection.response) if connection.errors? end |
Instance Method Details
#connection_failed? ⇒ Boolean
22 23 24 |
# File 'lib/knapsack_pro/queue_allocator.rb', line 22 def connection_failed? !connection.success? end |
#queue_exists? ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/knapsack_pro/queue_allocator.rb', line 15 def queue_exists? raise "Connection failed. Please report this as a bug: #{KnapsackPro::Urls::SUPPORT}" if connection_failed? return false if connection.api_code == KnapsackPro::Client::API::V1::Queues::CODE_ATTEMPT_CONNECT_TO_QUEUE_FAILED true end |
#test_files ⇒ Object
26 27 28 |
# File 'lib/knapsack_pro/queue_allocator.rb', line 26 def test_files response.fetch('test_files') end |