Class: Workarea::Api::Storefront::RecentViewsController
- Inherits:
-
ApplicationController
- Object
- Workarea::ApplicationController
- ApplicationController
- Workarea::Api::Storefront::RecentViewsController
- Defined in:
- app/controllers/workarea/api/storefront/recent_views_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Methods included from UserActivity
#assert_current_user_activity_id, #current_user_activity_id, #user_activity
Methods included from Authentication
#authentication?, #current_user
Instance Method Details
#show ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/workarea/api/storefront/recent_views_controller.rb', line 7 def show if stale?( etag: user_activity, last_modified: user_activity.updated_at, public: true ) @recent_views = Workarea::Storefront::UserActivityViewModel.new( user_activity ) end end |
#update ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/workarea/api/storefront/recent_views_controller.rb', line 19 def update if params[:product_id].present? Recommendation::UserActivity.save_product( current_user_activity_id, params[:product_id] ) end if params[:category_id].present? Recommendation::UserActivity.save_category( current_user_activity_id, params[:category_id] ) end if params[:search].present? Recommendation::UserActivity.save_search( current_user_activity_id, params[:search] ) end head :ok end |