Sha256: 291043d6c157248e6f25e4f255eb6e6a7dc86396811684c1e5ba0c5185ef7dc4

Contents?: true

Size: 569 Bytes

Versions: 8

Compression:

Stored size: 569 Bytes

Contents

module Spree
  module Api
    module V2
      class PricesController < Spree::Api::V2::BaseController
        skip_before_action :authenticate_user

        def index
          render_collection params[:variant_id] ? prices : prices.includes(:variant)
        end

        def show
          render_instance prices.find(params[:id])
        end

        private

        def prices
          if params[:variant_id]
            Spree::Variant.find(params[:variant_id]).prices
          else
            Spree::Price
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
solidus_json_api-0.3.1 app/controllers/spree/api/v2/prices_controller.rb
solidus_json_api-0.3.0 app/controllers/spree/api/v2/prices_controller.rb
spree_api_v2-0.2.2 app/controllers/spree/api/v2/prices_controller.rb
solidus_api_v2-0.2.2 app/controllers/spree/api/v2/prices_controller.rb
solidus_api_v2-0.2.1 app/controllers/spree/api/v2/prices_controller.rb
spree_api_v2-0.2.1 app/controllers/spree/api/v2/prices_controller.rb
spree_api_v2-0.2.0 app/controllers/spree/api/v2/prices_controller.rb
solidus_api_v2-0.2.0 app/controllers/spree/api/v2/prices_controller.rb