Class: Jimson::ClientHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/syncano/jimson_client.rb

Overview

Overwritten helper from Jimson gem

Instance Method Summary collapse

Instance Method Details

#send_batchArray

Overwritten send_batch method, so it now returns collection of responses

Returns:

  • (Array)

    collection of responses



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/syncano/jimson_client.rb', line 7

def send_batch
  batch = @batch.map(&:first) # get the requests
  response = send_batch_request(batch)

  begin
    responses = JSON.parse(response)
  rescue
    raise Jimson::ClientError::InvalidJSON.new(json)
  end

  process_batch_response(responses)
  responses = @batch

  @batch = []

  responses
end