Class: SpreeSquare::CatalogWebhookJob

Inherits:
BaseJob
  • Object
show all
Defined in:
app/jobs/spree_square/catalog_webhook_job.rb

Overview

Handles catalog.version.updated. Square's payload is deliberately coarse — it says the catalog changed, not what changed — so the handler just re-runs a full import. Fine for a restaurant-sized catalog; would need to become a scoped/incremental fetch for a larger one.

Instance Method Summary collapse

Instance Method Details

#perform(webhook_event_id) ⇒ Object



15
16
17
18
# File 'app/jobs/spree_square/catalog_webhook_job.rb', line 15

def perform(webhook_event_id)
  SpreeSquare::CatalogImporter.call
  SpreeSquare::WebhookEvent.find(webhook_event_id).mark_processed!
end