Class: QuickbooksCustomersPollJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/quickbooks_customers_poll_job.rb

Overview

QuickbooksCustomersPollJob fetches and processes customers from QuickBooks Online

This job connects to the QuickBooks API for a specific company, retrieves all customers, and enqueues individual resolver jobs to process each customer. It tracks the success or failure of the operation via reference events.

Example usage:

# Poll customers for a specific company with a suffix code
QuickbooksCustomersPollJob.perform_later(
  company_id: 123,
  suffix_code: 'QB'
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#company_idObject (readonly)

Returns the value of attribute company_id.



18
19
20
# File 'app/jobs/quickbooks_customers_poll_job.rb', line 18

def company_id
  @company_id
end

#suffix_codeObject (readonly)

Returns the value of attribute suffix_code.



18
19
20
# File 'app/jobs/quickbooks_customers_poll_job.rb', line 18

def suffix_code
  @suffix_code
end

Instance Method Details

#perform(company_id:, suffix_code:) ⇒ void

This method returns an undefined value.

Performs the customer polling process

Parameters:

  • company_id (Integer)

    The ID of the company to poll customers for

  • suffix_code (String)

    The prefix/suffix code to use for customer codes



25
26
27
28
29
# File 'app/jobs/quickbooks_customers_poll_job.rb', line 25

def perform(company_id:, suffix_code:)
  @company_id = company_id
  @suffix_code = suffix_code
  resolve_customers
end