Class: SessionVision::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/sessionvision/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_token:, ingest_host: "https://app.sessionvision.com", flush_size: 10, flush_interval: 5, max_retries: 3, retry_delays: [1, 2, 4], gzip_threshold: 1024, debug: false, on_error: nil) ⇒ Config

Returns a new instance of Config.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/sessionvision/config.rb', line 8

def initialize(
  project_token:,
  ingest_host: "https://app.sessionvision.com",
  flush_size: 10,
  flush_interval: 5,
  max_retries: 3,
  retry_delays: [1, 2, 4],
  gzip_threshold: 1024,
  debug: false,
  on_error: nil
)
  raise ArgumentError, "project_token is required" if project_token.nil? || project_token.empty?

  @project_token = project_token
  @ingest_host = ingest_host.chomp("/")
  @flush_size = flush_size
  @flush_interval = flush_interval
  @max_retries = max_retries
  @retry_delays = retry_delays
  @gzip_threshold = gzip_threshold
  @debug = debug
  @on_error = on_error
end

Instance Attribute Details

#debugObject (readonly)

Returns the value of attribute debug.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def debug
  @debug
end

#flush_intervalObject (readonly)

Returns the value of attribute flush_interval.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def flush_interval
  @flush_interval
end

#flush_sizeObject (readonly)

Returns the value of attribute flush_size.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def flush_size
  @flush_size
end

#gzip_thresholdObject (readonly)

Returns the value of attribute gzip_threshold.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def gzip_threshold
  @gzip_threshold
end

#ingest_hostObject (readonly)

Returns the value of attribute ingest_host.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def ingest_host
  @ingest_host
end

#max_retriesObject (readonly)

Returns the value of attribute max_retries.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def max_retries
  @max_retries
end

#on_errorObject (readonly)

Returns the value of attribute on_error.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def on_error
  @on_error
end

#project_tokenObject (readonly)

Returns the value of attribute project_token.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def project_token
  @project_token
end

#retry_delaysObject (readonly)

Returns the value of attribute retry_delays.



5
6
7
# File 'lib/sessionvision/config.rb', line 5

def retry_delays
  @retry_delays
end