Class: Spree::Api::V3::Admin::ChannelsController
- Inherits:
-
ResourceController
- Object
- ActionController::API
- BaseController
- ResourceController
- Spree::Api::V3::Admin::ChannelsController
- Defined in:
- app/controllers/spree/api/v3/admin/channels_controller.rb
Constant Summary
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
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
-
#add_products ⇒ Object
POST /api/v3/admin/channels/:id/add_products Body: { product_ids: […], published_at: nil, unpublished_at: nil }.
-
#remove_products ⇒ Object
POST /api/v3/admin/channels/:id/remove_products Body: { product_ids: […] }.
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
#add_products ⇒ Object
POST /api/v3/admin/channels/:id/add_products Body: { product_ids: […], published_at: nil, unpublished_at: nil }
10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/spree/api/v3/admin/channels_controller.rb', line 10 def add_products channel = find_resource :update, channel count = channel.add_products( scoped_product_ids, published_at: params[:published_at].presence, unpublished_at: params[:unpublished_at].presence ) render json: { product_count: count } end |
#remove_products ⇒ Object
POST /api/v3/admin/channels/:id/remove_products Body: { product_ids: […] }
24 25 26 27 28 29 30 |
# File 'app/controllers/spree/api/v3/admin/channels_controller.rb', line 24 def remove_products channel = find_resource :update, channel removed = channel.remove_products(scoped_product_ids) render json: { product_count: removed } end |