Class: Edools::PaginatedCollection

Inherits:
ActiveResource::Collection
  • Object
show all
Defined in:
lib/edools/paginated_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parsed = {}) ⇒ PaginatedCollection

The initialize method will receive the ActiveResource parsed result and set @elements.



11
12
13
14
15
16
17
# File 'lib/edools/paginated_collection.rb', line 11

def initialize(parsed = {})
  @elements = parsed[resource_key(parsed.keys)]
  @total_pages = parsed["total_pages"]
  @per_page = parsed["per_page"]
  @total_count = parsed["total_count"]
  @current_page = parsed["current_page"]
end

Instance Attribute Details

#current_pageObject

Our custom array to handle pagination methods



7
8
9
# File 'lib/edools/paginated_collection.rb', line 7

def current_page
  @current_page
end

#per_pageObject

Our custom array to handle pagination methods



7
8
9
# File 'lib/edools/paginated_collection.rb', line 7

def per_page
  @per_page
end

#total_countObject

Our custom array to handle pagination methods



7
8
9
# File 'lib/edools/paginated_collection.rb', line 7

def total_count
  @total_count
end

#total_pagesObject

Our custom array to handle pagination methods



7
8
9
# File 'lib/edools/paginated_collection.rb', line 7

def total_pages
  @total_pages
end