Class: WrAPI::RequestPagination::DefaultPager

Inherits:
Object
  • Object
show all
Defined in:
lib/wrapi/pagination.rb

Overview

Defaut pages asumes all data retrieved in a single go.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page_size = nil) ⇒ DefaultPager

initialize with page size



13
14
15
# File 'lib/wrapi/pagination.rb', line 13

def initialize(page_size=nil)
  @page = 0
end

Class Method Details

.data(body) ⇒ Object



33
34
35
# File 'lib/wrapi/pagination.rb', line 33

def self.data(body) 
  body
end

Instance Method Details

#more_pages?Boolean

assume single page

Returns:

  • (Boolean)


25
26
27
# File 'lib/wrapi/pagination.rb', line 25

def more_pages?
  @page < 1
end

#next_page!(data = nil) ⇒ Object

go to next page

Returns:

  • true if nore pages



19
20
21
22
# File 'lib/wrapi/pagination.rb', line 19

def next_page!(data=nil)
  @page += 1
  more_pages?
end

#page_optionsObject



29
30
31
# File 'lib/wrapi/pagination.rb', line 29

def page_options
  {}
end