Method: Akeneo::ProductModelService#all

Defined in:
lib/akeneo/product_model_service.rb

#all(with_family: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/akeneo/product_model_service.rb', line 13

def all(with_family: nil)
  Enumerator.new do |product_models|
    path = "/product-models?#{pagination_param}&#{limit_param}"
    path += search_with_family_param(with_family) if with_family

    loop do
      response = get_request(path)
      extract_collection_items(response).each { |product_model| product_models << product_model }
      path = extract_next_page_path(response)
      break unless path
    end
  end
end