Class: Spree::Api::V3::Admin::PromotionRulesController

Inherits:
ResourceController show all
Includes:
SubclassedResource
Defined in:
app/controllers/spree/api/v3/admin/promotion_rules_controller.rb

Overview

CRUD for ‘Spree::PromotionRule` STI subclasses. Same shape as PromotionActionsController — only the registry differs (`Spree.promotions.rules` instead of `Spree.promotions.actions`).

Constant Summary

Constants included from ScopedAuthorization

ScopedAuthorization::READ_ACTIONS

Constants inherited from BaseController

BaseController::RATE_LIMIT_RESPONSE

Constants included from Idempotent

Idempotent::IDEMPOTENCY_HEADER, Idempotent::IDEMPOTENCY_TTL, Idempotent::MAX_KEY_LENGTH, Idempotent::MUTATING_METHODS

Constants included from ErrorHandler

ErrorHandler::ERROR_CODES

Constants included from JwtAuthentication

JwtAuthentication::JWT_AUDIENCE_ADMIN, JwtAuthentication::JWT_AUDIENCE_STORE, JwtAuthentication::JWT_ISSUER, JwtAuthentication::USER_TYPE_ADMIN, JwtAuthentication::USER_TYPE_CUSTOMER

Instance Method Summary collapse

Methods included from SubclassedResource

#create, #update

Methods inherited from ResourceController

#create, #destroy, #index, #show, #update

Methods included from Spree::Api::V3::ApiKeyAuthentication

#authenticate_api_key!, #authenticate_secret_key!

Methods included from JwtAuthentication

#authenticate_user, #require_authentication!

Instance Method Details

#typesObject



16
17
18
19
20
# File 'app/controllers/spree/api/v3/admin/promotion_rules_controller.rb', line 16

def types
  authorize! :read, model_class

  render json: { data: model_class.subclasses_with_preference_schema }
end