Class: Api::V5::BranchController

Inherits:
BaseController
  • Object
show all
Includes:
Concerns::GetRestaurantList
Defined in:
app/controllers/api/v5/branch_controller.rb

Overview

Branch

Constant Summary

Constants inherited from BaseController

Api::V5::BaseController::CACHE_NAMESPACE, Api::V5::BaseController::INTERNAL_SERVER_ERROR_MESSAGE, Api::V5::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

#restaurantsObject



10
11
12
13
14
15
16
17
# File 'app/controllers/api/v5/branch_controller.rb', line 10

def restaurants
  params[:branch_id_eq] = params.require(:branch_id)
  now = Time.use_zone('Asia/Bangkok') { Time.zone.now }
  hour = now.strftime('%H').to_i
  date = now.strftime('%Y-%m-%d')
  cache_key = "#{CACHE_NAMESPACE}:#{self.class}|#{CityHash.hash32(params)}|restaurants|#{I18n.locale}|#{date}|#{hour}"
  restaurant_list(cache_key)
end