Sha256: 229c30e8a8322976c1f348afe4ffd216bde8a1129be78296b75689739e444d65
Contents?: true
Size: 756 Bytes
Versions: 1
Compression:
Stored size: 756 Bytes
Contents
module Ahoy class GeocodeV2Job < ActiveJob::Base queue_as { Ahoy.job_queue } def perform(visit_token, ip) location = begin Geocoder.search(ip).first rescue => e $stderr.puts e.message nil end if location data = { visit_token: visit_token, country: location.try(:country).presence, region: location.try(:state).presence, city: location.try(:city).presence, postal_code: location.try(:postal_code).presence, latitude: location.try(:latitude).presence, longitude: location.try(:longitude).presence } Ahoy::Tracker.new(visit_token: visit_token).geocode(data) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ahoy_matey-2.0.0 | app/jobs/ahoy/geocode_v2_job.rb |