Class: Api::V5::HungryhubSpecialsController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- Api::V5::HungryhubSpecialsController
show all
- Defined in:
- app/controllers/api/v5/hungryhub_specials_controller.rb
Constant Summary
BaseController::CACHE_NAMESPACE, BaseController::INTERNAL_SERVER_ERROR_MESSAGE, BaseController::ResponseSchema
Instance Method Summary
collapse
#identity_cache_memoization
#append_info_to_payload
#my_response_cache
Instance Method Details
#define_hh_specials ⇒ Object
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
|
#index ⇒ Object
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
|