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

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

Defined Under Namespace

Classes: UserDeletionError

Instance Method Summary collapse

Constructor Details

#initialize(user:) ⇒ DeleteUser

Returns a new instance of DeleteUser.

Raises:



15
16
17
18
19
20
21
22
23
24
# File 'lib/pusher/push_notifications/use_cases/delete_user.rb', line 15

def initialize(user:)
  @user = user
  @user_id = Pusher::PushNotifications::UserId.new

  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
end

Instance Method Details

#delete_userObject

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



28
29
30
# File 'lib/pusher/push_notifications/use_cases/delete_user.rb', line 28

def delete_user
  client.delete(user)
end