Feature: SignIn with Twitter (#479)
* Add Twitter SignIn flow Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
20
app/services/twitter/webhook_subscribe_service.rb
Normal file
20
app/services/twitter/webhook_subscribe_service.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class Twitter::WebhookSubscribeService
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
pattr_initialize [:inbox_id]
|
||||
|
||||
def perform
|
||||
register_response = twitter_client.register_webhook(url: webhooks_twitter_url)
|
||||
twitter_client.subscribe_webhook if register_response.status == '200'
|
||||
Rails.logger.info 'TWITTER_REGISTER_WEBHOOK_FAILURE: ' + register_response.body.to_s
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
delegate :channel, to: :inbox
|
||||
delegate :twitter_client, to: :channel
|
||||
|
||||
def inbox
|
||||
Inbox.find_by!(id: inbox_id)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user