Class: Aspera::Transfer::Spec

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/transfer/spec.rb

Overview

parameters for Transfer Spec

Constant Summary collapse

ACCESS_KEY_TRANSFER_USER =

default transfer username for access key based transfers

'xfer'
SSH_PORT =
33_001
UDP_PORT =
33_001
AK_TSPEC_BASE =
{
  'remote_user' => ACCESS_KEY_TRANSFER_USER,
  'ssh_port'    => SSH_PORT,
  'fasp_port'   => UDP_PORT
}.freeze
TRANSPORT_FIELDS =

fields for transport

%w[remote_host remote_user ssh_port fasp_port wss_enabled wss_port].freeze
TAG_RESERVED =

reserved tag for Aspera

'aspera'
DESCRIPTION =
CommandLineBuilder.normalize_description(YAML.load_file("#{__FILE__[0..-3]}yaml"))

Class Method Summary collapse

Class Method Details

.action(tspec) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/aspera/transfer/spec.rb', line 35

def action(tspec)
  Aspera.assert_type(tspec, Hash){'transfer spec'}
  Aspera.assert_values(tspec['direction'], [DIRECTION_SEND, DIRECTION_RECEIVE]){'direction'}
  case tspec['direction']
  when DIRECTION_SEND then :upload
  when DIRECTION_RECEIVE then :download
  else Aspera.error_unexpected_value(tspec['direction'])
  end
end

.action_to_direction(tspec, command) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/aspera/transfer/spec.rb', line 25

def action_to_direction(tspec, command)
  Aspera.assert_type(tspec, Hash){'transfer spec'}
  tspec['direction'] = case command.to_sym
  when :upload then DIRECTION_SEND
  when :download then DIRECTION_RECEIVE
  else Aspera.error_unexpected_value(command.to_sym)
  end
  return tspec
end