Class: Hypertube::Sdk::RuntimeBridge

Inherits:
Object
  • Object
show all
Defined in:
lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb

Class Method Summary collapse

Class Method Details

.activate(license_key) ⇒ Integer

Activates Hypertube::Sdk::RuntimeBridge with the provided license key and optionally with proxy data.

Parameters:

  • license_key (String)

    The license key to activate Hypertube::Sdk::RuntimeBridge.

Returns:

  • (Integer)

    The activation status code.

See Also:



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 66

def self.activate(license_key)
  if license_key != Hypertube::Sdk::Tools::ActivationHelper.temporary_license_key
    Hypertube::Sdk::Tools::ActivationHelper.temporary_license_key = license_key
    Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkMessage', 'Activation')
  end

  Hypertube::Sdk::Tools::ActivationHelper.temporary_license_key = license_key
  Hypertube::Core::Transmitter::Transmitter.activate(license_key)
rescue Exception => e
  Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkException', e.message)
  raise e
end

.add_config(priority, config_source) ⇒ Object

Adds configuration from the given source with specified priority.

Parameters:

  • priority (Integer)

    Hypertube::Sdk::Configuration::ConfigPriority value.

  • config_source (String)

    Path or string with configuration data.



111
112
113
114
115
116
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 111

def self.add_config(priority, config_source)
  Hypertube::Sdk::Configuration::ConfigSourceResolver.add_configs(priority, config_source)
rescue Exception => e
  Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkException', e.message)
  raise e
end

.get_runtime_info(get_loaded_modules) ⇒ String

Gets information about the current runtime.

Parameters:

  • get_loaded_modules (Boolean)

    Whether to include loaded modules in the runtime information.

Returns:

  • (String)

    Information about the current runtime.



104
105
106
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 104

def self.get_runtime_info(get_loaded_modules)
  Hypertube::Utils::RuntimeLogger.get_runtime_info(get_loaded_modules)
end

.http2(http2_connection_data) ⇒ Hypertube::Sdk::RuntimeFactory

Initializes Hypertube::Sdk::RuntimeBridge with an HTTP/2 connection to a remote machine.

Parameters:

Returns:



47
48
49
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 47

def self.http2(http2_connection_data)
  Hypertube::Sdk::RuntimeFactory.new(Hypertube::Utils::ConnectionType::HTTP2, http2_connection_data)
end

.in_memoryHypertube::Sdk::RuntimeFactory

Initializes Hypertube::Sdk::RuntimeBridge using an in-memory channel on the same machine.

Returns:

See Also:

  • to this {https://www.hypertube.dev/guides/v2/ruby/foundations/in-memory-channel article on Hypertube Guides}


24
25
26
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 24

def self.in_memory
  Hypertube::Sdk::RuntimeFactory.new(Hypertube::Utils::ConnectionType::IN_MEMORY, nil)
end

.initialize_rc(config_name) ⇒ Hypertube::Sdk::RuntimeContext

Initializes Hypertube::Sdk::RuntimeContext for the given configuration name.

Parameters:

  • config_name (String)

    Name of the configuration.

Returns:



121
122
123
124
125
126
127
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 121

def self.initialize_rc(config_name)
  config = Hypertube::Sdk::Configuration::ConfigSourceResolver.get_config(config_name)
  Hypertube::Sdk::RuntimeContext.initialize_runtime_context(config)
rescue Exception => e
  Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkException', e.message)
  raise e
end

.set_config_source(config_source) ⇒ Object

Sets the configuration source for the Hypertube::Sdk::RuntimeBridge SDK.

Parameters:

  • config_source (String)

    The configuration source.



81
82
83
84
85
86
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 81

def self.set_config_source(config_source)
  Hypertube::Core::Transmitter::Transmitter.set_config_source(config_source)
rescue Exception => e
  Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkException', e.message)
  raise e
end

.set_working_directory(path) ⇒ Object

Sets the working directory for the Hypertube::Sdk::RuntimeBridge SDK.

Parameters:

  • path (String)

    The working directory path.



90
91
92
93
94
95
96
97
98
99
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 90

def self.set_working_directory(path)
  path.gsub!('\\', '/')
  path += '/' unless path.end_with?('/')
  FileUtils.mkdir_p(path, mode: 0o700)
  Hypertube::Sdk::Tools::ActivationHelper.working_directory = path
  Hypertube::Core::Transmitter::Transmitter.set_working_directory(path)
rescue Exception => e
  Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkException', e.message)
  raise e
end

.tcp(tcp_connection_data) ⇒ Hypertube::Sdk::RuntimeFactory

Initializes Hypertube::Sdk::RuntimeBridge with a TCP connection to a remote machine.

Parameters:

Returns:

See Also:

  • to this {https://www.hypertube.dev/guides/v2/ruby/foundations/tcp-channel article on Hypertube Guides}


32
33
34
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 32

def self.tcp(tcp_connection_data)
  Hypertube::Sdk::RuntimeFactory.new(Hypertube::Utils::ConnectionType::TCP, tcp_connection_data)
end

.web_socket(ws_connection_data) ⇒ Hypertube::Sdk::RuntimeFactory

Initializes Hypertube::Sdk::RuntimeBridge with a WebSocket connection to a remote machine.

Parameters:

Returns:

See Also:

  • to this {https://www.hypertube.dev/guides/v2/ruby/foundations/websocket-channel article on Hypertube Guides}


40
41
42
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 40

def self.web_socket(ws_connection_data)
  Hypertube::Sdk::RuntimeFactory.new(Hypertube::Utils::ConnectionType::WEB_SOCKET, ws_connection_data)
end

.with_config(path) ⇒ Hypertube::Sdk::ConfigRuntimeFactory

Initializes Hypertube::Sdk::RuntimeBridge with a custom configuration file.

Parameters:

  • path (String)

    Path to a configuration file.

Returns:

See Also:

  • to this {https://www.hypertube.dev/guides/v2/ruby/foundations/configure-channel article on Hypertube Guides}


55
56
57
58
59
60
# File 'lib/hypertube-ruby-sdk/sdk/runtime_bridge.rb', line 55

def self.with_config(path)
  Hypertube::Sdk::ConfigRuntimeFactory.new(path)
rescue Exception => e
  Hypertube::Sdk::Tools::SdkMessageHelper.send_message_to_app_insights('SdkException', e.message)
  raise e
end