Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env ruby
- location = [44.84044, -0.5805]
- stores = DriveStore.nearest_stores_from_location(location)
- data = stores.map do |s|
- {
- 'id' => s.store_import_id,
- 'type' =>'pickup',
- 'distance' => "#{Geocoder::Calculations.distance_between(location,s.location).round(2)} km",
- 'logo' => s.drive_brand.image,
- 'brand' => s.drive_brand_id,
- 'name' => s.name,
- 'latitude' => s.latitude,
- 'longitude' => s.longitude
- }
- end
- File.open('tmp/stores.yml', 'w') {|f| f.write data.to_yaml }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement