Class: PhisherPhinder::CachedGeoipClient

Inherits:
Object
  • Object
show all
Defined in:
lib/phisher_phinder/cached_geoip_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, expiry_time) ⇒ CachedGeoipClient

Returns a new instance of CachedGeoipClient.



5
6
7
8
9
# File 'lib/phisher_phinder/cached_geoip_client.rb', line 5

def initialize(client, expiry_time)
  @client = client
  @expiry_time = expiry_time
  @lang = 'en'
end

Instance Method Details

#lookup(ip_address) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/phisher_phinder/cached_geoip_client.rb', line 11

def lookup(ip_address)
  cached_record = retrieve_cached_record(ip_address)
  if cached_record && cached_record_valid?(cached_record)
    cached_record
  else
    refresh_cache(ip_address, cached_record)
  end
end