Class: QuickbooksCustomerInvoicesPollJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/quickbooks_customer_invoices_poll_job.rb

Overview

QuickbooksCustomerInvoicesPollJob fetches and processes invoices for a specific customer from QuickBooks

This job retrieves all invoices for a given customer from QuickBooks and then enqueues a QuickbooksInvoiceHeaderResolverJob for each invoice to process it asynchronously. It also handles error conditions and logs information about the polling process.

This job is typically triggered after a customer is synchronized or as part of a scheduled polling process.

Examples:

QuickbooksCustomerInvoicesPollJob.perform_later(
  company_id: 123,
  customer_id: 456,
  customer_code: 'QB-789'
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#company_idObject (readonly)

Returns the value of attribute company_id.



21
22
23
# File 'app/jobs/quickbooks_customer_invoices_poll_job.rb', line 21

def company_id
  @company_id
end

#customer_codeObject (readonly)

Returns the value of attribute customer_code.



21
22
23
# File 'app/jobs/quickbooks_customer_invoices_poll_job.rb', line 21

def customer_code
  @customer_code
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



21
22
23
# File 'app/jobs/quickbooks_customer_invoices_poll_job.rb', line 21

def customer_id
  @customer_id
end

Instance Method Details

#perform(company_id:, customer_id:, customer_code:) ⇒ void

This method returns an undefined value.

Performs the invoice polling process for a specific customer

Parameters:

  • company_id (Integer)

    ID of the company in the application

  • customer_id (Integer)

    ID of the customer in the application

  • customer_code (String)

    The customer code in QuickBooks (used for API queries)



29
30
31
32
33
34
35
# File 'app/jobs/quickbooks_customer_invoices_poll_job.rb', line 29

def perform(company_id:, customer_id:, customer_code:)
  @company_id = company_id
  @customer_id = customer_id
  @customer_code = customer_code

  resolve_invoices
end