Files
chatwoot/spec/factories/clearbit_response.rb
Shivam Mishra 657843960c feat: account onboarding with clearbit (#8857)
* feat: add clearbit lookup

* chore: fix typo in .env.example

* refactor: split lookup to reduce cognitive complexity

* feat: add more fields to lookup

* feat: extend accounts controller

* feat: save extra data to custom_attributes

* feat: allow v2 update with custom_attributes

* feat: add update route

* refactor: reduce complexity

* feat: move update to v1 controller

* test: add locale test

* feat: remove update from routes

* test: update API for custom attributes

* test: all custom attributes

* fix: v2 tests

* test: enterprise accounts controller

* fix: clearbit payload

* fix: with modified env

* feat: allow custom attributes updates to profile

* refactor: reduce complexity

* feat: allow clearbit api key in installation config

* refactor: move clearbit to internal

* feat: allow clearbit

* chore: add display_title for June

* feat: allow more internal options

* refactor: use globalconfig to fetch clearbit token

* test: move response body to a factory

* refactor: update ops

* chore: remove clearbit from .env.example

* chore: apply suggestions from code review

Co-authored-by: sojan-official <sojan@chatwoot.com>

---------

Co-authored-by: sojan-official <sojan@chatwoot.com>
2024-02-12 23:21:42 +05:30

30 lines
686 B
Ruby

# spec/factories/response_bodies.rb
FactoryBot.define do
factory :clearbit_combined_response, class: Hash do
skip_create
initialize_with do
{
'person' => {
'name' => {
'fullName' => 'John Doe'
},
'avatar' => 'https://example.com/avatar.png'
},
'company' => {
'name' => 'Doe Inc.',
'timeZone' => 'Asia/Kolkata',
'category' => {
'sector' => 'Technology',
'industryGroup' => 'Software',
'industry' => 'Software'
},
'metrics' => {
'employees' => '1-10'
}
}
}.to_json
end
end
end