Class: PartyProfileImageWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Status::Worker, Sidekiq::Worker
Defined in:
app/workers/party_profile_image_worker.rb

Overview

Background worker to lookup and attach profile images for parties.
Uses Clearbit Logo API for company logos.

Examples:

Single party lookup

PartyProfileImageWorker.perform_async(party_id: customer.id)

Force refresh

PartyProfileImageWorker.perform_async(party_id: customer.id, force: true)

Bulk enqueue all missing

PartyProfileImageWorker.perform_async

Instance Method Summary collapse

Instance Method Details

#perform(party_id = nil, options = {}) ⇒ Object

Parameters:

  • party_id (Integer, nil) (defaults to: nil)

    Party ID, or nil to bulk enqueue all missing

  • options (Hash) (defaults to: {})

    Additional options

Options Hash (options):

  • :force (Boolean)

    Force refresh even if image exists



24
25
26
27
28
29
30
31
32
# File 'app/workers/party_profile_image_worker.rb', line 24

def perform(party_id = nil, options = {})
  options = options.symbolize_keys

  if party_id.nil?
    bulk_enqueue(options)
  else
    process_party(party_id, options)
  end
end