Class: Api::Aoa::V1::RestaurantPackagesController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- Api::Aoa::V1::RestaurantPackagesController
- Defined in:
- app/controllers/api/aoa/v1/restaurant_packages_controller.rb
Constant Summary
Constants inherited from BaseController
BaseController::CACHE_NAMESPACE
Instance Method Summary collapse
Methods inherited from BaseController
Methods included from LogrageCustomLogger
Methods included from ResponseCacheConcern
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/api/aoa/v1/restaurant_packages_controller.rb', line 3 def index restaurant = Restaurant.fetch_by_id(params.require(:restaurant_id)) return render '/404', status: :not_found if restaurant.nil? rp_cache_key = restaurant.restaurant_packages.cache_key = restaurant..cache_key cache_key = "Api::Aoa::RestaurantPackage:#{rp_cache_key}:#{}:#{I18n.locale}:#{minor_version_param}" my_response_cache "#{self.class}:index:#{cache_key}", :json, public: true do restaurant_packages = restaurant.restaurant_packages. where(is_visible: true, is_visible_for_staff: false). where.not(package_type: 'HhPackage::Package::HungryAtHome') # channel_id 1000 is the current data in our production database booking_channel = Channel.find_by! channel_id: 1000 = { params: { minor_version: minor_version_param, support_dynamic_pricing_feature: booking_channel.support_dynamic_pricing, }, } serialized_data = Api::Aoa::V1::RestaurantPackageSerializer.new(restaurant_packages, ) serialized_data.serializable_hash.merge(success: true, message: nil) end end |