2018-07-19 14:43:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-11-22 05:46:02 -05:00
|
|
|
class AnalyticsSummaryEntity < Grape::Entity
|
|
|
|
expose :value, safe: true
|
2017-05-03 22:05:38 -04:00
|
|
|
expose :title
|
2020-04-08 08:09:42 -04:00
|
|
|
expose :unit, if: { with_unit: true }
|
2020-04-21 11:21:10 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def value
|
|
|
|
return object.value if object.value.is_a? String
|
|
|
|
|
|
|
|
object.value&.nonzero? ? object.value.to_s : '-'
|
|
|
|
end
|
2016-11-22 05:46:02 -05:00
|
|
|
end
|