Class: BoatLocationSerializer

Inherits:
AbstractSerializer show all
Defined in:
app/serializers/boat_location_serializer.rb

Class Method Summary collapse

Methods inherited from AbstractSerializer

opts, serialize

Class Method Details

.address(location) ⇒ Object



27
28
29
# File 'app/serializers/boat_location_serializer.rb', line 27

def address(location)
  { address: location.address }
end

.available_attributesObject



4
5
6
7
8
9
10
11
12
13
# File 'app/serializers/boat_location_serializer.rb', line 4

def available_attributes
  %i[
    id
    latitude
    longitude
    address
    is_main
    radius
  ]
end

.id(location) ⇒ Object



15
16
17
# File 'app/serializers/boat_location_serializer.rb', line 15

def id(location)
  { id: location.id }
end

.is_main(location) ⇒ Object



31
32
33
# File 'app/serializers/boat_location_serializer.rb', line 31

def is_main(location)
  { is_main: location.is_main }
end

.latitude(location) ⇒ Object



19
20
21
# File 'app/serializers/boat_location_serializer.rb', line 19

def latitude(location)
  { latitude: location.latitude }
end

.longitude(location) ⇒ Object



23
24
25
# File 'app/serializers/boat_location_serializer.rb', line 23

def longitude(location)
  { longitude: location.longitude }
end

.radius(location) ⇒ Object



35
36
37
# File 'app/serializers/boat_location_serializer.rb', line 35

def radius(location)
  { radius: location.radius }
end