Sha256: 6b1a616e77ab65e2e11955decc2c4c1de55c91b9efc9c89ab6144a7c0ca531fd

Contents?: true

Size: 1.35 KB

Versions: 35

Compression:

Stored size: 1.35 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, store: current_store).execute
            end

            def resource
              resource = resource_finder.new(user: spree_current_user, number: params[:id], store: current_store).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

            def model_class
              Spree::Order
            end
          end
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
spree_api-4.10.1 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.10.0 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.9.0 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.8.3 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.8.2 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.7.3 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.6 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.5.5 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.3.3 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.4.1 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.5.4 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.5 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.7.2 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.7.1 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.4 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.7.0 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.3 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.2 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.1 app/controllers/spree/api/v2/storefront/account/orders_controller.rb
spree_api-4.6.0 app/controllers/spree/api/v2/storefront/account/orders_controller.rb