Class: Pusher::PushNotifications::UseCases::DeleteUser

Inherits:
Object
  • Object
show all
Defined in:
lib/pusher/push_notifications/use_cases/delete_user.rb

Defined Under Namespace

Classes: UserDeletionError

Class Method Summary collapse

Class Method Details

.delete_user(client, user:) ⇒ Object

Contacts the Beams service to remove all the devices of the given user.

Raises:



11
12
13
14
15
16
17
18
19
20
# File 'lib/pusher/push_notifications/use_cases/delete_user.rb', line 11

def self.delete_user(client, user:)
  raise UserDeletionError, 'User Id cannot be empty.' if user.empty?

  if user.length > UserId::MAX_USER_ID_LENGTH
    raise UserDeletionError, 'User id length too long ' \
    "(expected fewer than #{UserId::MAX_USER_ID_LENGTH + 1} characters)"
  end

  client.delete(user)
end