Method: OpenapiClient::BatchesApi#get_batch_by_id_with_http_info

Defined in:
lib/openapi_client/api/batches_api.rb

#get_batch_by_id_with_http_info(batch_id, opts = {}) ⇒ Array<(GetBatchByIdResponseBody, Integer, Hash)>

Get Batch By ID Get Batch By ID

Parameters:

  • batch_id (String)

    Batch ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(GetBatchByIdResponseBody, Integer, Hash)>)

    GetBatchByIdResponseBody data, response status code and response headers



321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/openapi_client/api/batches_api.rb', line 321

def get_batch_by_id_with_http_info(batch_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_by_id ...'
  end
  # verify the required parameter 'batch_id' is set
  if @api_client.config.client_side_validation && batch_id.nil?
    fail ArgumentError, "Missing the required parameter 'batch_id' when calling BatchesApi.get_batch_by_id"
  end
  if @api_client.config.client_side_validation && batch_id.to_s.length > 25
    fail ArgumentError, 'invalid value for "batch_id" when calling BatchesApi.get_batch_by_id, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && batch_id.to_s.length < 1
    fail ArgumentError, 'invalid value for "batch_id" when calling BatchesApi.get_batch_by_id, the character length must be great than or equal to 1.'
  end

  pattern = Regexp.new(/^se(-[a-z0-9]+)+$/)
  if @api_client.config.client_side_validation && batch_id !~ pattern
    fail ArgumentError, "invalid value for 'batch_id' when calling BatchesApi.get_batch_by_id, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/v1/batches/{batch_id}'.sub('{' + 'batch_id' + '}', CGI.escape(batch_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'GetBatchByIdResponseBody' 

  # auth_names
  auth_names = opts[:auth_names] || ['api_key']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BatchesApi#get_batch_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end