Class: Api::V5::HungryhubSpecialsController

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

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

#define_hh_specialsObject



13
14
15
16
# File 'app/controllers/api/v5/hungryhub_specials_controller.rb', line 13

def define_hh_specials
  @data = HhSpecial.active.order(rank: :asc)
  render json: { data: [{}] } if @data.blank?
end

#indexObject



3
4
5
6
7
8
9
10
11
# File 'app/controllers/api/v5/hungryhub_specials_controller.rb', line 3

def index
  expires_in DEFAULT_HTTP_PUBLIC_CACHE_EXPIRATION, public: true
  render json: ActiveModelSerializers::SerializableResource.new(
    @data,
    { serialization_context: serialization_context,
      each_serializer: Api::V5::HungryhubSpecialSerializer,
      adapter: :json_api },
  ).serializable_hash.merge(success: true, message: nil).as_json
end