Method: Aspera::Cli::Main.result_transfer_multiple

Defined in:
lib/aspera/cli/main.rb

.result_transfer_multiple(status_table) ⇒ Object

used when one command executes several transfer jobs (each job being possibly multi session) each element has a key STATUS_FIELD which contains the result of possibly multiple sessions

Parameters:

  • status_table (Array)
    array],…,…

Returns:

  • a status object suitable as command result



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/aspera/cli/main.rb', line 51

def result_transfer_multiple(status_table)
  global_status = :success
  # transform status array into string and find if there was problem
  status_table.each do |item|
    worst = TransferAgent.session_status(item[STATUS_FIELD])
    global_status = worst unless worst.eql?(:success)
    item[STATUS_FIELD] = item[STATUS_FIELD].map(&:to_s).join(',')
  end
  raise global_status unless global_status.eql?(:success)
  return {type: :object_list, data: status_table}
end