Class: Tanker::Core::Options

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/tanker/core/options.rb

Overview

Options that can be given when opening a Tanker session

Constant Summary collapse

SDK_TYPE =
'client-ruby'
SDK_VERSION =
CTanker.new_cstring Core::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_id:, url: nil, sdk_type: SDK_TYPE, persistent_path: nil, cache_path: nil, faraday_adapter: nil) ⇒ Options

rubocop:disable Metrics/ParameterLists



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/tanker/core/options.rb', line 27

def initialize(app_id:, url: nil, sdk_type: SDK_TYPE, persistent_path: nil, cache_path: nil, faraday_adapter: nil) # rubocop:disable Metrics/ParameterLists
  super()

  # NOTE: Instance variables are required to keep the CStrings alive
  @c_app_id = CTanker.new_cstring app_id
  @c_url = CTanker.new_cstring url
  @c_persistent_path = CTanker.new_cstring persistent_path
  @c_cache_path = CTanker.new_cstring cache_path
  @sdk_type = sdk_type
  @c_sdk_type = CTanker.new_cstring sdk_type
  @faraday_adapter = faraday_adapter

  self[:version] = 4
  self[:app_id] = @c_app_id
  self[:url] = @c_url
  self[:persistent_path] = @c_persistent_path
  self[:cache_path] = @c_cache_path
  self[:sdk_type] = @c_sdk_type
  self[:sdk_version] = SDK_VERSION
end

Instance Attribute Details

#faraday_adapterObject (readonly)

Returns the value of attribute faraday_adapter.



25
26
27
# File 'lib/tanker/core/options.rb', line 25

def faraday_adapter
  @faraday_adapter
end

#sdk_typeObject (readonly)

Returns the value of attribute sdk_type.



24
25
26
# File 'lib/tanker/core/options.rb', line 24

def sdk_type
  @sdk_type
end