2018-09-20 13:59:13 -06:00
|
|
|
class PlantSerializer < BasePointSerializer
|
2019-11-14 14:36:04 -07:00
|
|
|
attributes :openfarm_slug, :plant_stage, :planted_at, :radius, :meta
|
2018-04-07 15:04:33 -06:00
|
|
|
|
2020-04-27 14:05:53 -06:00
|
|
|
def planted_at
|
|
|
|
object.planted_at || object.created_at
|
|
|
|
end
|
|
|
|
|
2018-04-07 15:04:33 -06:00
|
|
|
def x
|
|
|
|
object.x.round
|
|
|
|
end
|
|
|
|
|
|
|
|
def y
|
|
|
|
object.y.round
|
|
|
|
end
|
|
|
|
|
|
|
|
def z
|
|
|
|
object.z.round
|
|
|
|
end
|
|
|
|
|
|
|
|
def meta
|
|
|
|
object.meta || {}
|
|
|
|
end
|
|
|
|
end
|