Sha256: e338a244d047374c9a703eb8fdcbb38d6f447b2cae2a3b7e144f90ce80ea9396

Contents?: true

Size: 840 Bytes

Versions: 3

Compression:

Stored size: 840 Bytes

Contents

module Spree
  module Api
    module V2
      module Platform
        class ProductsController < ResourceController
          include ::Spree::Api::V2::ProductListIncludes

          private

          def model_class
            Spree::Product
          end

          def scope_includes
            product_list_includes
          end

          def allowed_sort_attributes
            super.push(:available_on, :make_active_at)
          end

          def sorted_collection
            collection_sorter.new(collection, current_currency, params, allowed_sort_attributes).call
          end

          def spree_permitted_attributes
            super + [:price]
          end

          def collection_sorter
            Spree::Api::Dependencies.platform_products_sorter.constantize
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
atkhayar-dev-spree-api-0.0.1 app/controllers/spree/api/v2/platform/products_controller.rb
atkhayar-dev-spree-api-0.0.0 app/controllers/spree/api/v2/platform/products_controller.rb
atkhayar-spree-dev-api-0.0.0 app/controllers/spree/api/v2/platform/products_controller.rb