Class: PostHog::Rails::InitConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/posthog/rails/railtie.rb

Overview

Configuration wrapper for the init block

Instance Method Summary collapse

Constructor Details

#initialize(base_options = {}) ⇒ InitConfig

Returns a new instance of InitConfig.

Parameters:

  • base_options (Hash) (defaults to: {})

    Initial core SDK options.



268
269
270
# File 'lib/posthog/rails/railtie.rb', line 268

def initialize(base_options = {})
  @base_options = base_options
end

Instance Method Details

#api_key=(value) ⇒ String

Core PostHog options

Parameters:

  • value (String)

Returns:

  • (String)


276
277
278
# File 'lib/posthog/rails/railtie.rb', line 276

def api_key=(value)
  @base_options[:api_key] = value
end

#before_send=(value) ⇒ Proc

Parameters:

  • value (Proc)

Returns:

  • (Proc)


346
347
348
# File 'lib/posthog/rails/railtie.rb', line 346

def before_send=(value)
  @base_options[:before_send] = value
end

#compress_request=(value) ⇒ Boolean

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


322
323
324
# File 'lib/posthog/rails/railtie.rb', line 322

def compress_request=(value)
  @base_options[:compress_request] = value
end

#feature_flag_request_timeout_seconds=(value) ⇒ Integer

Parameters:

  • value (Integer)

Returns:

  • (Integer)


340
341
342
# File 'lib/posthog/rails/railtie.rb', line 340

def feature_flag_request_timeout_seconds=(value)
  @base_options[:feature_flag_request_timeout_seconds] = value
end

#feature_flags_polling_interval=(value) ⇒ Integer

Parameters:

  • value (Integer)

Returns:

  • (Integer)


334
335
336
# File 'lib/posthog/rails/railtie.rb', line 334

def feature_flags_polling_interval=(value)
  @base_options[:feature_flags_polling_interval] = value
end

#host=(value) ⇒ String

Parameters:

  • value (String)

Returns:

  • (String)


298
299
300
# File 'lib/posthog/rails/railtie.rb', line 298

def host=(value)
  @base_options[:host] = value
end

#max_queue_size=(value) ⇒ Integer

Parameters:

  • value (Integer)

Returns:

  • (Integer)


304
305
306
# File 'lib/posthog/rails/railtie.rb', line 304

def max_queue_size=(value)
  @base_options[:max_queue_size] = value
end

#on_error=(value) ⇒ Proc

Parameters:

  • value (Proc)

Returns:

  • (Proc)


328
329
330
# File 'lib/posthog/rails/railtie.rb', line 328

def on_error=(value)
  @base_options[:on_error] = value
end

#personal_api_key=(value) ⇒ String?

Deprecated.

Use #secret_key= instead. Retained as an alias.

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


292
293
294
# File 'lib/posthog/rails/railtie.rb', line 292

def personal_api_key=(value)
  @base_options[:personal_api_key] = value
end

#secret_key=(value) ⇒ String?

The credential used for local feature flag evaluation and remote config. Accepts either a Personal API Key (phx_...) or a Project Secret API Key (phs_...).

Parameters:

  • value (String, nil)

Returns:

  • (String, nil)


285
286
287
# File 'lib/posthog/rails/railtie.rb', line 285

def secret_key=(value)
  @base_options[:secret_key] = value
end

#sync_mode=(value) ⇒ Boolean

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


316
317
318
# File 'lib/posthog/rails/railtie.rb', line 316

def sync_mode=(value)
  @base_options[:sync_mode] = value
end

#test_mode=(value) ⇒ Boolean

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


310
311
312
# File 'lib/posthog/rails/railtie.rb', line 310

def test_mode=(value)
  @base_options[:test_mode] = value
end

#to_client_optionsHash

Returns Core SDK options suitable for Client.new.

Returns:

  • (Hash)

    Core SDK options suitable for Client.new.



351
352
353
# File 'lib/posthog/rails/railtie.rb', line 351

def to_client_options
  @base_options
end