Class: BotVerification::IpRangeFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/bot_verification/ip_range_fetcher.rb

Overview

Fetches IP ranges from official sources Can be called manually or scheduled via cron/Sidekiq

Examples:

Run manually

BotVerification::IpRangeFetcher.refresh!

Refresh specific bot type

BotVerification::IpRangeFetcher.refresh!(:google)

Class Method Summary collapse

Class Method Details

.refresh!(bot_type = nil) ⇒ Hash

Refresh IP ranges from official sources

Parameters:

  • (defaults to: nil)

    Specific bot type, or nil for all

Returns:

  • Results for each bot type



19
20
21
22
23
24
25
# File 'lib/bot_verification/ip_range_fetcher.rb', line 19

def refresh!(bot_type = nil)
  if bot_type
    { bot_type.to_sym => refresh_bot_type(bot_type.to_s) }
  else
    refresh_all
  end
end