Module: Aspera

Defined in:
lib/aspera/environment.rb,
lib/aspera/log.rb,
lib/aspera/ssh.rb,
lib/aspera/ascmd.rb,
lib/aspera/assert.rb,
lib/aspera/nagios.rb,
lib/aspera/api/aoc.rb,
lib/aspera/api/ats.rb,
lib/aspera/resumer.rb,
lib/aspera/api/node.rb,
lib/aspera/cli/info.rb,
lib/aspera/cli/main.rb,
lib/aspera/json_rpc.rb,
lib/aspera/web_auth.rb,
lib/aspera/cli/error.rb,
lib/aspera/cli/hints.rb,
lib/aspera/faspex_gw.rb,
lib/aspera/oauth/jwt.rb,
lib/aspera/oauth/web.rb,
lib/aspera/agent/base.rb,
lib/aspera/agent/node.rb,
lib/aspera/api/httpgw.rb,
lib/aspera/cli/plugin.rb,
lib/aspera/oauth/base.rb,
lib/aspera/uri_reader.rb,
lib/aspera/agent/alpha.rb,
lib/aspera/agent/trsdk.rb,
lib/aspera/cli/manager.rb,
lib/aspera/cli/version.rb,
lib/aspera/line_logger.rb,
lib/aspera/agent/direct.rb,
lib/aspera/agent/httpgw.rb,
lib/aspera/api/cos_node.rb,
lib/aspera/id_generator.rb,
lib/aspera/secret_hider.rb,
lib/aspera/transfer/uri.rb,
lib/aspera/agent/connect.rb,
lib/aspera/ascp/products.rb,
lib/aspera/cli/formatter.rb,
lib/aspera/oauth/factory.rb,
lib/aspera/oauth/generic.rb,
lib/aspera/preview/utils.rb,
lib/aspera/timer_limiter.rb,
lib/aspera/transfer/spec.rb,
lib/aspera/transfer/sync.rb,
lib/aspera/node_simulator.rb,
lib/aspera/oauth/url_json.rb,
lib/aspera/transfer/error.rb,
lib/aspera/ascp/management.rb,
lib/aspera/cli/plugins/aoc.rb,
lib/aspera/cli/plugins/ats.rb,
lib/aspera/cli/plugins/cos.rb,
lib/aspera/data_repository.rb,
lib/aspera/faspex_postproc.rb,
lib/aspera/preview/options.rb,
lib/aspera/rest_call_error.rb,
lib/aspera/cli/plugins/alee.rb,
lib/aspera/cli/plugins/node.rb,
lib/aspera/cli/sync_actions.rb,
lib/aspera/preview/terminal.rb,
lib/aspera/ascp/installation.rb,
lib/aspera/preview/generator.rb,
lib/aspera/proxy_auto_config.rb,
lib/aspera/temp_file_manager.rb,
lib/aspera/web_server_simple.rb,
lib/aspera/cli/extended_value.rb,
lib/aspera/cli/plugin_factory.rb,
lib/aspera/cli/plugins/config.rb,
lib/aspera/cli/plugins/faspex.rb,
lib/aspera/cli/plugins/faspio.rb,
lib/aspera/cli/plugins/httpgw.rb,
lib/aspera/cli/plugins/server.rb,
lib/aspera/cli/plugins/shares.rb,
lib/aspera/cli/special_values.rb,
lib/aspera/cli/transfer_agent.rb,
lib/aspera/persistency_folder.rb,
lib/aspera/preview/file_types.rb,
lib/aspera/rest_errors_aspera.rb,
lib/aspera/transfer/faux_file.rb,
lib/aspera/cli/plugins/console.rb,
lib/aspera/cli/plugins/faspex5.rb,
lib/aspera/cli/plugins/preview.rb,
lib/aspera/rest_error_analyzer.rb,
lib/aspera/transfer/error_info.rb,
lib/aspera/transfer/parameters.rb,
lib/aspera/command_line_builder.rb,
lib/aspera/cli/basic_auth_plugin.rb,
lib/aspera/cli/transfer_progress.rb,
lib/aspera/keychain/encrypted_hash.rb,
lib/aspera/keychain/macos_security.rb,
lib/aspera/persistency_action_once.rb,
lib/aspera/cli/plugins/orchestrator.rb,
lib/aspera/rest.rb

Overview

enhance the gem to support other key chains

Defined Under Namespace

Modules: Agent, Api, Ascp, Cli, Keychain, OAuth, Preview, Transfer, UriReader Classes: AsCmd, AssertError, CommandLineBuilder, DataRepository, Environment, Faspex4GWServlet, Faspex4PostProcServlet, IdGenerator, InternalError, JsonRpcClient, LineLogger, Log, Nagios, NodeSimulatorServlet, PersistencyActionOnce, PersistencyFolder, ProxyAutoConfig, Rest, RestCallError, RestErrorAnalyzer, RestErrorsAspera, Resumer, SecretHider, Ssh, TempFileManager, TimerLimiter, WebAuth, WebAuthServlet, WebServerSimple

Class Method Summary collapse

Class Method Details

.assert(assertion, info = nil, level: 2, exception_class: AssertError) ⇒ Object

the block is executed in the context of the Aspera module

Raises:



11
12
13
14
15
16
17
18
19
# File 'lib/aspera/assert.rb', line 11

def assert(assertion, info = nil, level: 2, exception_class: AssertError)
  raise InternalError, 'bad assert: both info and block given' unless info.nil? || !block_given?
  return if assertion
  message = 'assertion failed'
  info = yield if block_given?
  message = "#{message}: #{info}" if info
  message = "#{message}: #{caller(level..level).first}"
  raise exception_class, message
end

.assert_type(value, type, exception_class: AssertError) ⇒ Object

assert that value has the given type

Parameters:

  • value (Object)

    the value to check

  • type (Class)

    the expected type



24
25
26
# File 'lib/aspera/assert.rb', line 24

def assert_type(value, type, exception_class: AssertError)
  assert(value.is_a?(type), level: 3, exception_class: exception_class){"#{block_given? ? "#{yield}: " : nil}expecting #{type}, but have #{value.inspect}"}
end

.assert_values(value, values, exception_class: AssertError) ⇒ Object

assert that value is one of the given values



29
30
31
32
33
# File 'lib/aspera/assert.rb', line 29

def assert_values(value, values, exception_class: AssertError)
  assert(values.include?(value), level: 3, exception_class: exception_class) do
    "#{block_given? ? "#{yield}: " : nil}expecting one of #{values.inspect}, but have #{value.inspect}"
  end
end

.error_unexpected_value(value, exception_class: InternalError) ⇒ Object

the value is not one of the expected values

Raises:

  • (exception_class)


41
42
43
# File 'lib/aspera/assert.rb', line 41

def error_unexpected_value(value, exception_class: InternalError)
  raise exception_class, "#{block_given? ? "#{yield}: " : nil}unexpected value: #{value.inspect}"
end

.error_unreachable_lineObject

the line with this shall never be reached

Raises:



36
37
38
# File 'lib/aspera/assert.rb', line 36

def error_unreachable_line
  raise InternalError, "unreachable line reached: #{caller(2..2).first}"
end