Class: Item::SpecificationsRetriever

Inherits:
BaseService show all
Defined in:
app/services/item/specifications_retriever.rb

Overview

Retrieves specifications for an item, including item-specific, product line, and product category specifications.

Returns:

  • (Result)

    a struct containing the retrieved specifications

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

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(item, filters = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/services/item/specifications_retriever.rb', line 11

def process(item, filters = {})
  @item = item
  @filters = filters
  @specs = {}
  @items = [item, item.new_item].compact
  @kit_component_items = item.get_kit_items(spec_only: true)

  preload_item_associations(@items + @kit_component_items)
   = 
  fetch_specifications
  process_specifications

  Result.new(specifications: @specs.values.compact.sort_by(&:render_priority), item_metadata: )
end