Feature: Twitter DM Integration (#451)
An initial version of twitter integration Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
@@ -3,7 +3,7 @@ class Api::V1::WebhooksController < ApplicationController
|
||||
skip_before_action :set_current_user
|
||||
skip_before_action :check_subscription
|
||||
|
||||
before_action :login_from_basic_auth
|
||||
before_action :login_from_basic_auth, only: [:chargebee]
|
||||
def chargebee
|
||||
chargebee_consumer.consume
|
||||
head :ok
|
||||
@@ -12,6 +12,18 @@ class Api::V1::WebhooksController < ApplicationController
|
||||
head :ok
|
||||
end
|
||||
|
||||
def twitter_crc
|
||||
render json: { response_token: "sha256=#{$twitter.generate_crc(params[:crc_token])}" }
|
||||
end
|
||||
|
||||
def twitter_events
|
||||
twitter_consumer.consume
|
||||
head :ok
|
||||
rescue StandardError => e
|
||||
Raven.capture_exception(e)
|
||||
head :ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def login_from_basic_auth
|
||||
@@ -21,6 +33,10 @@ class Api::V1::WebhooksController < ApplicationController
|
||||
end
|
||||
|
||||
def chargebee_consumer
|
||||
@consumer ||= ::Webhooks::Chargebee.new(params)
|
||||
@chargebee_consumer ||= ::Webhooks::Chargebee.new(params)
|
||||
end
|
||||
|
||||
def twitter_consumer
|
||||
@twitter_consumer ||= ::Webhooks::Twitter.new(params)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user