Updated

app/use_cases/accounts/apps/chatwoots / search_contact.rb

A
19 lines of codes
2 methods
6.4 complexity/method
4 churn
12.8 complexity
16 duplications
class Accounts::Apps::Chatwoots::SearchContact
  1. Accounts::Apps::Chatwoots::SearchContact has no descriptive comment
def self.call(chatwoot, params) request = Faraday.get(
  1. Similar code found in 2 nodes Locations: 0 1
"#{chatwoot.chatwoot_endpoint_url}/api/v1/accounts/#{chatwoot.chatwoot_account_id}/contacts/search", build_body(params), chatwoot.request_headers ) body = JSON.parse(request.body) return body['payload'].first if body['payload'].present?
  1. Accounts::Apps::Chatwoots::SearchContact#self.call calls 'body['payload']' 2 times
return { error: 'Contact not found' } end def self.build_body(content) { "q": content, } end end