Class: GeocodeFirmJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/geocode_firm_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(firm) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/jobs/geocode_firm_job.rb', line 2

def perform(firm)
  Geocoder.coordinates(firm.full_street_address).tap do |coordinates|
    firm.geocode!(coordinates)

    if coordinates
      IndexFirmJob.perform_later(firm)
      stat :success
    else
      stat :failed
    end
  end
end