Class: Workarea::Api::Storefront::OrdersController
- Inherits:
-
ApplicationController
- Object
- Workarea::ApplicationController
- ApplicationController
- Workarea::Api::Storefront::OrdersController
- Defined in:
- app/controllers/workarea/api/storefront/orders_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#assert_current_metrics_id, #cache_page, #skip_session
Methods included from Authentication
#authentication?, #current_user, find_user
Instance Method Details
#index ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/workarea/api/storefront/orders_controller.rb', line 5 def index models = Order.recent( current_user.id, Workarea.config.storefront_user_order_display_count ) statuses = Fulfillment.find_statuses(*models.map(&:id)) @orders = models.map do |order| Workarea::Storefront::OrderViewModel.new( order, fulfillment_status: statuses[order.id] ) end end |
#show ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/workarea/api/storefront/orders_controller.rb', line 20 def show model = Order.find(params[:id]) if model.user_id != current_user.id.to_s head :forbidden else @order = Workarea::Storefront::OrderViewModel.new(model) end end |