Class: SpreeCmCommissioner::UserDeviceTokenDeregister

Inherits:
BaseInteractor
  • Object
show all
Defined in:
app/interactors/spree_cm_commissioner/user_device_token_deregister.rb

Instance Method Summary collapse

Instance Method Details

#callObject



5
6
7
# File 'app/interactors/spree_cm_commissioner/user_device_token_deregister.rb', line 5

def call
  remove_device_token
end

#remove_device_tokenObject



9
10
11
12
13
# File 'app/interactors/spree_cm_commissioner/user_device_token_deregister.rb', line 9

def remove_device_token
  context.device_token = context.user.device_tokens.find_by(registration_token: context.registration_token)
  context.fail!(message: 'Device token not found') if context.device_token.nil?
  context.fail!(message: 'Fail to remove device token') unless context.device_token.destroy
end