Sha256: 4c108e0268016b3b1aa1f13afd4897bbad3372f73a7f40af48f092aec34974b8

Contents?: true

Size: 668 Bytes

Versions: 24

Compression:

Stored size: 668 Bytes

Contents

module Spree
  module Api
    module V1
      class TagsController < Spree::Api::BaseController
        def index
          @tags =
            if params[:ids]
              Tag.where(id: params[:ids].split(",").flatten)
            else
              Tag.ransack(params[:q]).result
            end

          @tags = @tags.page(params[:page]).per(params[:per_page])

          expires_in 15.minutes, public: true
          headers['Surrogate-Control'] = "max-age=#{15.minutes}"
          respond_with(@tags)
        end

        private

        def tags_params
          params.require(:tag).permit(permitted_tags_attributes)
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
spree_api-3.2.0 app/controllers/spree/api/v1/tags_controller.rb
spree_api-3.2.0.rc3 app/controllers/spree/api/v1/tags_controller.rb
spree_api-3.2.0.rc2 app/controllers/spree/api/v1/tags_controller.rb
spree_api-3.2.0.rc1 app/controllers/spree/api/v1/tags_controller.rb