Class: Ramazon::ProductCollection

Inherits:
WillPaginate::Collection
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/ramazon/product_collection.rb

Class Method Summary collapse

Class Method Details

.create_from_results(page, per_page, body) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/ramazon/product_collection.rb', line 6

def self.create_from_results(page, per_page, body)
  results = Items.parse(body, {})[0]
  col = create(page, 10, results.total_results || 0) do |pager|
    pager.replace(results.products)
  end
  
  col.search_bin_sets = Ramazon::SearchBinSet.parse(body)
  col
end