1
0

unsubscribe_service.rb 397 B

123456789101112131415
  1. # frozen_string_literal: true
  2. class Pubsubhubbub::UnsubscribeService < BaseService
  3. def call(account, callback)
  4. return ['Invalid topic URL', 422] if account.nil?
  5. subscription = Subscription.where(account: account, callback_url: callback)
  6. unless subscription.nil?
  7. Pubsubhubbub::ConfirmationWorker.perform_async(subscription.id, 'unsubscribe')
  8. end
  9. ['', 202]
  10. end
  11. end