Class: Api::V5::LoyaltyLevelsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/api/v5/loyalty_levels_controller.rb

Overview

typed: ignore frozen_string_literal: true

Constant Summary

Constants inherited from BaseController

BaseController::CACHE_NAMESPACE, BaseController::INTERNAL_SERVER_ERROR_MESSAGE, BaseController::ResponseSchema

Instance Method Summary collapse

Methods inherited from BaseController

#identity_cache_memoization

Methods included from LogrageCustomLogger

#append_info_to_payload

Methods included from ResponseCacheConcern

#my_response_cache

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/api/v5/loyalty_levels_controller.rb', line 5

def index
  cache_key = "#{CACHE_NAMESPACE}:#{self.class}:index:#{LoyaltyLevel.maximum(:updated_at)}:#{MyLocaleManager.normalize_locale}"

  my_response_cache cache_key, :json, public: true do
    json = render_to_string json: LoyaltyLevel.all,
                            each_serializer: Api::V5::LoyaltyLevelSerializer,
                            adapter: :json_api
    Oj.load(json).merge(success: true, message: nil)
  end
end