Class: Api::V5::GroupLandingPageSerializer

Inherits:
BaseSerializer show all
Defined in:
app/serializers/api/v5/group_landing_page_serializer.rb

Overview

group landing page attributes

Constant Summary collapse

GROUP =
{ 'Top' => 'top', 'New' => 'new', 'Featured' => 'rank', 'Budget' => 'budget' }.freeze

Instance Method Summary collapse

Methods inherited from BaseSerializer

#full_attachment_url, #safe_translation_attr

Methods inherited from ApplicationSerializer

decorate_attributes, decorator, #object_cache_key

Instance Method Details

#budget(object) ⇒ Object



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'app/serializers/api/v5/group_landing_page_serializer.rb', line 122

def budget(object)
  if object.budget_min_cents.present? && object.budget_max_cents.present?
    {
      min: object.budget_min.amount.to_i,
      max: object.budget_max.amount.to_i,
      currency: object.budget_min_currency,
    }
  else
    {
      min: 0,
      max: 0,
      currency: object.budget_min_currency,
    }
  end
end