Class: Spree::Api::V2::Storefront::UserDeviceTokenRegistrationsController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Spree::Api::V2::Storefront::UserDeviceTokenRegistrationsController
- Defined in:
- app/controllers/spree/api/v2/storefront/user_device_token_registrations_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/spree/api/v2/storefront/user_device_token_registrations_controller.rb', line 8 def create = filter_params.merge(user: spree_current_user) context = SpreeCmCommissioner::UserDeviceTokenRegister.call() if context.success? render_serialized_payload { serialize_resource(context.device_token) } else render_error_payload(context.) end end |
#destroy ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/spree/api/v2/storefront/user_device_token_registrations_controller.rb', line 19 def destroy = { user: spree_current_user, registration_token: params[:id] } context = SpreeCmCommissioner::UserDeviceTokenDeregister.call() if context.success? render_serialized_payload { serialize_resource(context.device_token) } else render_error_payload(context.error) end end |
#filter_params ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/controllers/spree/api/v2/storefront/user_device_token_registrations_controller.rb', line 38 def filter_params { registration_token: params[:registration_token], device_type: params[:device_type], client_version: app_version, client_name: app_name } end |
#resource_serializer ⇒ Object
34 35 36 |
# File 'app/controllers/spree/api/v2/storefront/user_device_token_registrations_controller.rb', line 34 def resource_serializer Spree::V2::Storefront::UserDeviceTokenSerializer end |