Class: UserPattern::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/userpattern/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/userpattern/configuration.rb', line 16

def initialize
  @tracked_models = [{ name: 'User', current_method: :current_user }]
  @flush_interval = 30
  @buffer_size = 100
  @retention_period = 30
  @dashboard_auth = nil
  @anonymous_salt = nil
  @session_detection = :auto
  @enabled = true
  @ignored_paths = []
  initialize_alert_defaults
end

Instance Attribute Details

#anonymous_saltObject

Returns the value of attribute anonymous_salt.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def anonymous_salt
  @anonymous_salt
end

#block_unknown_endpointsObject

Returns the value of attribute block_unknown_endpoints.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def block_unknown_endpoints
  @block_unknown_endpoints
end

#buffer_sizeObject

Returns the value of attribute buffer_size.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def buffer_size
  @buffer_size
end

#dashboard_authObject



33
34
35
# File 'lib/userpattern/configuration.rb', line 33

def dashboard_auth
  @dashboard_auth || default_dashboard_auth
end

#enabledObject

Returns the value of attribute enabled.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def enabled
  @enabled
end

#flush_intervalObject

Returns the value of attribute flush_interval.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def flush_interval
  @flush_interval
end

#ignored_pathsObject

Returns the value of attribute ignored_paths.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def ignored_paths
  @ignored_paths
end

#logout_methodObject

Returns the value of attribute logout_method.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def logout_method
  @logout_method
end

#modeObject

Returns the value of attribute mode.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def mode
  @mode
end

#on_threshold_exceededObject

Returns the value of attribute on_threshold_exceeded.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def on_threshold_exceeded
  @on_threshold_exceeded
end

#rate_limiter_storeObject

Returns the value of attribute rate_limiter_store.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def rate_limiter_store
  @rate_limiter_store
end

#retention_periodObject

Returns the value of attribute retention_period.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def retention_period
  @retention_period
end

#session_detectionObject

Returns the value of attribute session_detection.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def session_detection
  @session_detection
end

#threshold_multiplierObject

Returns the value of attribute threshold_multiplier.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def threshold_multiplier
  @threshold_multiplier
end

#threshold_refresh_intervalObject

Returns the value of attribute threshold_refresh_interval.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def threshold_refresh_interval
  @threshold_refresh_interval
end

#tracked_modelsObject

Returns the value of attribute tracked_models.



5
6
7
# File 'lib/userpattern/configuration.rb', line 5

def tracked_models
  @tracked_models
end

#violation_actionsObject

Returns the value of attribute violation_actions.



7
8
9
# File 'lib/userpattern/configuration.rb', line 7

def violation_actions
  @violation_actions
end

Instance Method Details

#alert_mode?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/userpattern/configuration.rb', line 29

def alert_mode?
  @mode == :alert
end

#ignored?(path) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
52
# File 'lib/userpattern/configuration.rb', line 45

def ignored?(path)
  ignored_paths.any? do |pattern|
    case pattern
    when Regexp then pattern.match?(path)
    when String then pattern == path
    end
  end
end