Class: Spree::Api::V3::Admin::Customers::AddressesController
- Inherits:
-
ResourceController
- Object
- ActionController::API
- BaseController
- ResourceController
- ResourceController
- Spree::Api::V3::Admin::Customers::AddressesController
- Defined in:
- app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
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
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
-
#create ⇒ Object
POST /api/v3/admin/customers/:customer_id/addresses.
-
#destroy ⇒ Object
DELETE /api/v3/admin/customers/:customer_id/addresses/:id.
-
#update ⇒ Object
PATCH /api/v3/admin/customers/:customer_id/addresses/:id.
Methods inherited from ResourceController
Methods included from Spree::Api::V3::ApiKeyAuthentication
#authenticate_api_key!, #authenticate_secret_key!
Methods included from JwtAuthentication
#authenticate_user, #require_authentication!
Instance Method Details
#create ⇒ Object
POST /api/v3/admin/customers/:customer_id/addresses
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/spree/api/v3/admin/customers/addresses_controller.rb', line 10 def create @resource = @parent.addresses.new(address_attrs) (@resource, :create) ApplicationRecord.transaction do if @resource.save apply_default_flags(@resource) render json: serialize_resource(@resource.reload), status: :created else render_validation_error(@resource.errors) raise ActiveRecord::Rollback end end end |
#destroy ⇒ Object
DELETE /api/v3/admin/customers/:customer_id/addresses/:id
41 42 43 44 45 |
# File 'app/controllers/spree/api/v3/admin/customers/addresses_controller.rb', line 41 def destroy (@resource) @resource.destroy head :no_content end |
#update ⇒ Object
PATCH /api/v3/admin/customers/:customer_id/addresses/:id
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/spree/api/v3/admin/customers/addresses_controller.rb', line 26 def update (@resource) ApplicationRecord.transaction do if @resource.update(address_attrs) apply_default_flags(@resource) render json: serialize_resource(@resource.reload) else render_validation_error(@resource.errors) raise ActiveRecord::Rollback end end end |