Sha256: b2e7353c08542e6a8ac5de6973333e18e3ec1deb2cff387d68f03ae385378932

Contents?: true

Size: 1.24 KB

Versions: 12

Compression:

Stored size: 1.24 KB

Contents

module Spree
  module Api
    module V2
      module Storefront
        module Account
          class OrdersController < ::Spree::Api::V2::ResourceController
            before_action :require_spree_current_user

            private

            def collection
              collection_finder.new(user: spree_current_user).execute
            end

            def resource
              resource = resource_finder.new(user: spree_current_user, number: params[:id]).execute.take
              raise ActiveRecord::RecordNotFound if resource.nil?

              resource
            end

            def allowed_sort_attributes
              super << :completed_at
            end

            def collection_serializer
              Spree::Api::Dependencies.storefront_order_serializer.constantize
            end

            def resource_serializer
              Spree::Api::Dependencies.storefront_order_serializer.constantize
            end

            def collection_finder
              Spree::Api::Dependencies.storefront_completed_order_finder.constantize
            end

            def resource_finder
              Spree::Api::Dependencies.storefront_completed_order_finder.constantize
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spree_api-4.2.7 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.6 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.5 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.4 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.3.1 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.3 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.2 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.1 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.0 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.0.rc5 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.0.rc4 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.2.0.rc3 app/controllers/spree/api/v2/storefront/account/orders_controller.rb