Class: Item::ImageLibraryRetriever

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

Overview

Builds the Image Profile Manager "Image Library" list in priority order:

  1. Images linked directly to the item
  2. PL×PC ladder — for each PL node (leaf→root on primary PL, then constellation PLs), each PC
    node (leaf→root), then PL-only for that node (see Item::ImageLibraryPlPcLadder)
  3. Images linked to sibling items (same primary PL + same product category)

Constant Summary collapse

DEFAULT_LIMIT =
200

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseService

#log_debug, #log_error, #log_info, #log_warning, #logger, #options, #process, #tagged_logger

Constructor Details

#initialize(item:, tag_filter: nil, limit: DEFAULT_LIMIT) ⇒ ImageLibraryRetriever

Returns a new instance of ImageLibraryRetriever.



16
17
18
19
20
21
# File 'app/services/item/image_library_retriever.rb', line 16

def initialize(item:, tag_filter: nil, limit: DEFAULT_LIMIT)
  super({})
  @item = item
  @tag_filter = tag_filter
  @limit = limit
end

Class Method Details

.call(item, tag_filter: nil, limit: DEFAULT_LIMIT) ⇒ Object



12
13
14
# File 'app/services/item/image_library_retriever.rb', line 12

def self.call(item, tag_filter: nil, limit: DEFAULT_LIMIT)
  new(item: item, tag_filter: tag_filter, limit: limit).call
end

Instance Method Details

#callObject



23
24
25
26
27
28
# File 'app/services/item/image_library_retriever.rb', line 23

def call
  chain = []
  seen = Set.new
  append_tiers!(chain, seen)
  chain
end