Class: Trackguard::Adapters::Local

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

Instance Method Summary collapse

Methods inherited from Base

#track_page_view

Instance Method Details

#blocked_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


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

def blocked_path?(path)
  BlockedPath.blocked?(path)
end

#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)


18
19
20
# File 'lib/trackguard/adapters/local.rb', line 18

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

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



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

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

#whitelisted_ip?(ip) ⇒ Boolean

Returns:

  • (Boolean)


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

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