Updated

app/use_cases/accounts/apps/chatwoots/webhooks / process_webhook.rb

A
24 lines of codes
1 methods
15.9 complexity/method
7 churn
15.94 complexity
0 duplications
class Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook
  1. Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook has no descriptive comment
def self.call(webhook)
  1. Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook#self.call has approx 7 statements
chatwoot = Apps::Chatwoot.find_by(embedding_token: webhook['token']) return { error: 'Chatwoot integration not found' } if chatwoot.blank? return { error: 'Chatwoot integration inactive' } if chatwoot.inactive? if webhook['event'].include?('contact_')
  1. Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook#self.call calls 'webhook['event']' 3 times Locations: 0 1 2
Accounts::Apps::Chatwoots::Webhooks::Events::Contact.call( chatwoot, webhook ) elsif webhook['event'] == 'conversation_updated'
  1. Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook#self.call calls 'webhook['event']' 3 times Locations: 0 1 2
Accounts::Apps::Chatwoots::Webhooks::Events::ConversationUpdated.call( chatwoot, webhook ) elsif webhook['event'].include?('message_')
  1. Accounts::Apps::Chatwoots::Webhooks::ProcessWebhook#self.call calls 'webhook['event']' 3 times Locations: 0 1 2
Accounts::Apps::Chatwoots::Webhooks::Events::Message.call( chatwoot, webhook ) end { ok: chatwoot } end end