Class: PartyProfileImageLookupService
- Inherits:
-
Object
- Object
- PartyProfileImageLookupService
- Defined in:
- app/services/party_profile_image_lookup_service.rb
Overview
Service to lookup and attach profile images for Customers and Contacts.
For Customers (companies):
Uses Logo.dev API to fetch company logos based on domain
For Contacts (people):
- Tries Gravatar based on email
- Falls back to parent customer's company logo
Requires a Logo.dev API key stored in Rails credentials:
logo_dev:
publishable_key: pk_xxx...
Constant Summary collapse
- LOGO_DEV_URL =
'https://img.logo.dev'- GRAVATAR_URL =
'https://www.gravatar.com/avatar'- HTTP_TIMEOUT =
seconds
5
Instance Method Summary collapse
-
#call ⇒ Image?
Perform the lookup and attach image if found.
-
#initialize(party, force: false, logger: nil) ⇒ PartyProfileImageLookupService
constructor
A new instance of PartyProfileImageLookupService.
Constructor Details
#initialize(party, force: false, logger: nil) ⇒ PartyProfileImageLookupService
Returns a new instance of PartyProfileImageLookupService.
30 31 32 33 34 |
# File 'app/services/party_profile_image_lookup_service.rb', line 30 def initialize(party, force: false, logger: nil) @party = party @force = force @logger = logger || Rails.logger end |