Class: Rudder::Analytics::Configuration

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/rudder/analytics/configuration.rb

Constant Summary

Constants included from Utils

Utils::UTC_OFFSET_WITHOUT_COLON, Utils::UTC_OFFSET_WITH_COLON

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#check_string, #date_in_iso8601, #datetime_in_iso8601, #formatted_offset, #isoify_dates, #isoify_dates!, #seconds_to_utc_offset, #stringify_keys, #symbolize_keys, #symbolize_keys!, #time_in_iso8601, #uid

Constructor Details

#initialize(settings = {}) ⇒ Configuration

Returns a new instance of Configuration.

Raises:

  • (ArgumentError)


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rudder/analytics/configuration.rb', line 12

def initialize(settings = {})
  symbolized_settings = symbolize_keys(settings)

  @test = symbolized_settings[:test]
  @write_key = symbolized_settings[:write_key]
  @data_plane_url = symbolized_settings[:data_plane_url]
  @max_queue_size = symbolized_settings[:max_queue_size] || Defaults::Queue::MAX_SIZE
  @ssl = symbolized_settings[:ssl]
  @on_error = symbolized_settings[:on_error] || proc { |status, error| }
  @on_error_with_messages = symbolized_settings[:on_error_with_messages] || proc { |status, error, messages| }
  @stub = symbolized_settings[:stub]
  @batch_size = symbolized_settings[:batch_size] || Defaults::MessageBatch::MAX_SIZE
  @gzip = symbolized_settings[:gzip]
  @backoff_policy = symbolized_settings[:backoff_policy]
  @retries = symbolized_settings[:retries]
  raise ArgumentError, 'Missing required option :write_key' \
    unless @write_key
  raise ArgumentError, 'Data plane url must be initialized' \
    unless @data_plane_url
end

Instance Attribute Details

#backoff_policyObject (readonly)

Returns the value of attribute backoff_policy.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def backoff_policy
  @backoff_policy
end

#batch_sizeObject (readonly)

Returns the value of attribute batch_size.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def batch_size
  @batch_size
end

#data_plane_urlObject (readonly)

Returns the value of attribute data_plane_url.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def data_plane_url
  @data_plane_url
end

#gzipObject (readonly)

Returns the value of attribute gzip.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def gzip
  @gzip
end

#max_queue_sizeObject (readonly)

Returns the value of attribute max_queue_size.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def max_queue_size
  @max_queue_size
end

#on_errorObject (readonly)

Returns the value of attribute on_error.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def on_error
  @on_error
end

#on_error_with_messagesObject (readonly)

Returns the value of attribute on_error_with_messages.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def on_error_with_messages
  @on_error_with_messages
end

#retriesObject (readonly)

Returns the value of attribute retries.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def retries
  @retries
end

#sslObject (readonly)

Returns the value of attribute ssl.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def ssl
  @ssl
end

#stubObject (readonly)

Returns the value of attribute stub.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def stub
  @stub
end

#testObject (readonly)

Returns the value of attribute test.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def test
  @test
end

#write_keyObject (readonly)

Returns the value of attribute write_key.



10
11
12
# File 'lib/rudder/analytics/configuration.rb', line 10

def write_key
  @write_key
end