Module: Parasut::Paginated

Included in:
Account, Contact, ItemCategory, Product, SalesInvoice
Defined in:
lib/parasut/paginated.rb

Overview

Paginated

Instance Method Summary collapse

Instance Method Details

#new_collection(parsed_data) ⇒ Object


4
5
6
7
8
# File 'lib/parasut/paginated.rb', line 4

def new_collection(parsed_data)
  pagination = parsed_data[:metadata]
  collection = Her::Model::Attributes.initialize_collection(self, parsed_data)
  Kaminari.paginate_array(collection, total_count: pagination[:item_count]).page(pagination[:page_count]).per(pagination[:per_page])
end