Class: Trackguard::Adapters::Local

Inherits:
Base
  • Object
show all
Defined in:
lib/trackguard/adapters/local.rb

Instance Method Summary collapse

Instance Method Details

#blocked_user_agent?(user_agent) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/trackguard/adapters/local.rb', line 6

def blocked_user_agent?(user_agent)
  BlockedUserAgent.blocked?(user_agent)
end

#flagged_visitor?(ip) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/trackguard/adapters/local.rb', line 14

def flagged_visitor?(ip)
  Visitor.flagged?(ip)
end

#track_blocked_request(ip:, user_agent:, path:, http_method:, block_reason:) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/trackguard/adapters/local.rb', line 32

def track_blocked_request(ip:, user_agent:, path:, http_method:, block_reason:)
  TrackBlockedRequestJob.perform_later(
    ip: ip,
    user_agent: user_agent,
    path: path,
    http_method: http_method,
    block_reason: block_reason
  )
end

#track_page_view(path:, ip:, user_agent:, referer:, session_id:, trace_id:, source:, initial:, http_method:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/trackguard/adapters/local.rb', line 18

def track_page_view(path:, ip:, user_agent:, referer:, session_id:, trace_id:, source:, initial:, http_method:)
  TrackPageViewJob.perform_later(
    path: path,
    ip: ip,
    user_agent: user_agent,
    referer: referer,
    session_id: session_id,
    trace_id: trace_id,
    source: source,
    initial: initial,
    http_method: http_method
  )
end

#whitelisted_ip?(ip) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/trackguard/adapters/local.rb', line 10

def whitelisted_ip?(ip)
  WhitelistedIp.whitelisted?(ip)
end