Class: AmazonPricingAutomationWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job, Workers::StatusBroadcastable
Defined in:
app/workers/amazon_pricing_automation_worker.rb

Instance Attribute Summary

Attributes included from Workers::StatusBroadcastable

#broadcast_status_updates

Instance Method Summary collapse

Methods included from Workers::StatusBroadcastable::Overrides

#at, #store, #total

Instance Method Details

#perform(options = {}) ⇒ Object

Runs pricing automation for Amazon Seller Central US (76) and Canada (77) catalog items



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/workers/amazon_pricing_automation_worker.rb', line 10

def perform(options = {})
  options = options.symbolize_keys
  options[:catalog_ids] = [CatalogConstants::AMAZON_SC_US_CATALOG_ID, CatalogConstants::AMAZON_SC_CA_CATALOG_ID] unless options[:catalog_ids].present?

  result = Catalog::AmazonPricingAutomationService.new.process(options) do |status|
    at 0, "Processing catalog item #{status[:catalog_item].id} (#{status[:catalog_item].sku})" if status[:catalog_item]
  end

  logger.info "Amazon Pricing Automation completed: #{result.processed_count} processed, #{result.price_increased_count} prices increased, #{result.price_lowered_count} prices lowered, #{result.flagged_count} flagged"

  store redirect_to: options[:redirect_to]
end