class Pusher::PushNotifications::UseCases::DeleteUser

Attributes

user[R]

Public Class Methods

delete_user(*args, **kwargs) click to toggle source
# File lib/pusher/push_notifications/use_cases/delete_user.rb, line 10
def delete_user(*args, **kwargs)
  new(*args, **kwargs).delete_user
end
new(user:) click to toggle source
# 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

Public Instance Methods

delete_user() click to toggle source

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

# File lib/pusher/push_notifications/use_cases/delete_user.rb, line 29
def delete_user
  client.delete(user)
end

Private Instance Methods

client() click to toggle source
# File lib/pusher/push_notifications/use_cases/delete_user.rb, line 37
def client
  @client ||= PushNotifications::Client.new
end