2024-09-02 14:51:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class PointSerializer
|
2025-02-21 18:32:30 -05:00
|
|
|
EXCLUDED_ATTRIBUTES = %w[
|
|
|
|
|
created_at updated_at visit_id id import_id user_id raw_data lonlat
|
2025-05-16 12:51:48 -04:00
|
|
|
reverse_geocoded_at country_id
|
2025-02-21 18:32:30 -05:00
|
|
|
].freeze
|
2024-09-02 14:51:34 -04:00
|
|
|
|
|
|
|
|
def initialize(point)
|
|
|
|
|
@point = point
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def call
|
2025-02-21 17:45:36 -05:00
|
|
|
point.attributes.except(*EXCLUDED_ATTRIBUTES).tap do |attributes|
|
|
|
|
|
attributes['latitude'] = point.lat.to_s
|
|
|
|
|
attributes['longitude'] = point.lon.to_s
|
|
|
|
|
end
|
2024-09-02 14:51:34 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
attr_reader :point
|
|
|
|
|
end
|