Module: Trackguard

Defined in:
lib/trackguard.rb,
lib/trackguard/engine.rb,
lib/trackguard/version.rb,
lib/trackguard/rack_attack.rb,
app/models/trackguard/visit.rb,
lib/trackguard/adapters/hub.rb,
lib/trackguard/adapters/base.rb,
app/models/trackguard/visitor.rb,
lib/trackguard/adapters/local.rb,
app/models/trackguard/page_view.rb,
app/models/trackguard/blocked_path.rb,
lib/trackguard/trace_id_middleware.rb,
app/models/trackguard/whitelisted_ip.rb,
app/models/trackguard/blocked_request.rb,
app/jobs/trackguard/track_page_view_job.rb,
app/services/trackguard/analytics_query.rb,
app/services/trackguard/track_page_view.rb,
app/models/trackguard/blocked_user_agent.rb,
app/helpers/trackguard/application_helper.rb,
app/services/trackguard/application_service.rb,
lib/generators/trackguard/install_generator.rb,
app/jobs/trackguard/hub/submit_page_view_job.rb,
app/jobs/trackguard/track_blocked_request_job.rb,
app/services/trackguard/track_blocked_request.rb,
app/controllers/concerns/trackguard/page_tracker.rb,
app/controllers/trackguard/admin/base_controller.rb,
app/controllers/trackguard/page_views_controller.rb,
app/controllers/trackguard/admin/visits_controller.rb,
app/jobs/trackguard/detect_suspicious_visitors_job.rb,
app/jobs/trackguard/hub/submit_blocked_request_job.rb,
app/controllers/trackguard/admin/visitors_controller.rb,
app/controllers/concerns/trackguard/admin/overridable.rb,
app/controllers/trackguard/admin/analytics_controller.rb,
app/controllers/trackguard/admin/dashboards_controller.rb,
app/controllers/trackguard/admin/blocked_paths_controller.rb,
app/controllers/trackguard/admin/whitelisted_ips_controller.rb,
app/controllers/trackguard/admin/blocked_user_agents_controller.rb

Defined Under Namespace

Modules: Adapters, Admin, ApplicationHelper, Hub, PageTracker, RackAttack Classes: AnalyticsQuery, ApplicationService, BlockedPath, BlockedRequest, BlockedUserAgent, ConfigurationError, DetectSuspiciousVisitorsJob, Engine, InstallGenerator, PageView, PageViewsController, TraceIdMiddleware, TrackBlockedRequest, TrackBlockedRequestJob, TrackPageView, TrackPageViewJob, Visit, Visitor, WhitelistedIp

Constant Summary collapse

VERSION =
"0.30.0".freeze

Class Method Summary collapse

Class Method Details

.adapterObject



127
128
129
# File 'lib/trackguard.rb', line 127

def adapter
  @adapter ||= Trackguard::Adapters::Local.new
end

.adapter=(value) ⇒ Object



79
80
81
82
# File 'lib/trackguard.rb', line 79

def adapter=(value)
  deprecated_direct_setter(:adapter)
  @adapter = resolve_adapter(value)
end

.admin_layoutObject



95
96
97
# File 'lib/trackguard.rb', line 95

def admin_layout
  @admin_layout ||= "trackguard/admin"
end

.admin_layout=(value) ⇒ Object



29
30
31
32
# File 'lib/trackguard.rb', line 29

def admin_layout=(value)
  deprecated_direct_setter(:admin_layout)
  @admin_layout = value
end

.admin_pathObject



99
100
101
# File 'lib/trackguard.rb', line 99

def admin_path
  @admin_path ||= "/admin"
end

.admin_path=(value) ⇒ Object



34
35
36
37
# File 'lib/trackguard.rb', line 34

def admin_path=(value)
  deprecated_direct_setter(:admin_path)
  @admin_path = value
end

.authenticate_admin_withObject

Readers



91
92
93
# File 'lib/trackguard.rb', line 91

def authenticate_admin_with
  @authenticate_admin_with ||= proc {}
end

.authenticate_admin_with=(value) ⇒ Object

Setters — use configure block; direct assignment is deprecated.



24
25
26
27
# File 'lib/trackguard.rb', line 24

def authenticate_admin_with=(value)
  deprecated_direct_setter(:authenticate_admin_with)
  @authenticate_admin_with = value
end

.back_labelObject



103
104
105
# File 'lib/trackguard.rb', line 103

def back_label
  @back_label ||= "Back to app"
end

.back_label=(value) ⇒ Object



39
40
41
42
# File 'lib/trackguard.rb', line 39

def back_label=(value)
  deprecated_direct_setter(:back_label)
  @back_label = value
end

.configureObject



15
16
17
18
19
20
# File 'lib/trackguard.rb', line 15

def configure
  @_configuring = true
  yield self
ensure
  @_configuring = false
end

.disable_on_developmentObject



131
132
133
# File 'lib/trackguard.rb', line 131

def disable_on_development
  @disable_on_development.nil? || @disable_on_development
end

.disable_on_development=(value) ⇒ Object



84
85
86
87
# File 'lib/trackguard.rb', line 84

def disable_on_development=(value)
  deprecated_direct_setter(:disable_on_development)
  @disable_on_development = value
end

.hub_api_keyObject



124
# File 'lib/trackguard.rb', line 124

def hub_api_key    = @hub_api_key.to_s

.hub_api_key=(value) ⇒ Object



69
70
71
72
# File 'lib/trackguard.rb', line 69

def hub_api_key=(value)
  deprecated_direct_setter(:hub_api_key)
  @hub_api_key = value
end

.hub_rules_ttlObject



125
# File 'lib/trackguard.rb', line 125

def hub_rules_ttl  = @hub_rules_ttl ||= 5.minutes

.hub_rules_ttl=(value) ⇒ Object



74
75
76
77
# File 'lib/trackguard.rb', line 74

def hub_rules_ttl=(value)
  deprecated_direct_setter(:hub_rules_ttl)
  @hub_rules_ttl = value
end

.hub_secret_keyObject



123
# File 'lib/trackguard.rb', line 123

def hub_secret_key = @hub_secret_key.to_s

.hub_secret_key=(value) ⇒ Object



64
65
66
67
# File 'lib/trackguard.rb', line 64

def hub_secret_key=(value)
  deprecated_direct_setter(:hub_secret_key)
  @hub_secret_key = value
end

.hub_urlObject



119
120
121
# File 'lib/trackguard.rb', line 119

def hub_url
  @hub_url ||= "https://app.trackguard.dev"
end

.hub_url=(value) ⇒ Object



59
60
61
62
# File 'lib/trackguard.rb', line 59

def hub_url=(value)
  deprecated_direct_setter(:hub_url)
  @hub_url = value
end

.local_api_tokenObject



107
108
109
# File 'lib/trackguard.rb', line 107

def local_api_token
  @local_api_token.to_s
end

.local_api_token=(value) ⇒ Object



44
45
46
47
# File 'lib/trackguard.rb', line 44

def local_api_token=(value)
  deprecated_direct_setter(:local_api_token)
  @local_api_token = value
end

.throttle_limitObject



111
112
113
# File 'lib/trackguard.rb', line 111

def throttle_limit
  @throttle_limit ||= 100
end

.throttle_limit=(value) ⇒ Object



49
50
51
52
# File 'lib/trackguard.rb', line 49

def throttle_limit=(value)
  deprecated_direct_setter(:throttle_limit)
  @throttle_limit = value
end

.throttle_periodObject



115
116
117
# File 'lib/trackguard.rb', line 115

def throttle_period
  @throttle_period ||= 60
end

.throttle_period=(value) ⇒ Object



54
55
56
57
# File 'lib/trackguard.rb', line 54

def throttle_period=(value)
  deprecated_direct_setter(:throttle_period)
  @throttle_period = value
end

.tracking_enabled?Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/trackguard.rb', line 135

def tracking_enabled?
  !disable_on_development || !Rails.env.development?
end