Method: Azure::Table::TableService#execute_batch

Defined in:
lib/azure/table/table_service.rb

#execute_batch(batch, options = {}) ⇒ Object

Public: Executes a batch of operations.

Attributes

  • batch - The Azure::Table::Batch instance to execute.

  • options - Hash. Optional parameters.

Options

Accepted key/value pairs in options parameter are:

  • :timeout - Integer. A timeout in seconds.

See msdn.microsoft.com/en-us/library/windowsazure/dd894038

Returns an array of results, one for each operation in the batch



440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/azure/table/table_service.rb', line 440

def execute_batch(batch, options={})
  headers = {
    "Content-Type"=> "multipart/mixed; boundary=#{batch.batch_id}",
    "Accept"=> 'application/atom+xml,application/xml',
    'Accept-Charset'=> 'UTF-8'
  }

  query = { }
  query["timeout"] = options[:timeout].to_s if options[:timeout]

  body = batch.to_body
  response = call(:post, generate_uri("/$batch", query), body, headers)
  batch.parse_response(response)
end