Class: Item::SynchronizeRefurbSpecs
- Inherits:
-
BaseService
- Object
- BaseService
- Item::SynchronizeRefurbSpecs
- Defined in:
- app/services/item/synchronize_refurb_specs.rb
Overview
Synchronizes item description, pricing and cogs to the refurbished version of
these items
Instance Method Summary collapse
-
#process(base_scope: nil, limit: nil) ⇒ Object
Process refurished item, optionally specify: a base_scope to use, e.g Item.controls a limit to the number of records to process.
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #options, #tagged_logger
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#process(base_scope: nil, limit: nil) ⇒ Object
Process refurished item, optionally specify:
a base_scope to use, e.g Item.controls
a limit to the number of records to process
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/item/synchronize_refurb_specs.rb', line 9 def process(base_scope: nil, limit: nil) base_scope ||= Item.all base_scope = base_scope.condition_refurbished.where.not(new_item_id: nil) base_scope = base_scope.limit(limit) if limit = [] Item.transaction do base_scope.find_each { |item| << propagate_specs(item) } end logger.info "SynchronizeRefurbSpecs results: #{.join(', ')}" end |