Class: Rubyoverflow::PagedBase

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyoverflow/pagedBase.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

change_end_point, client, convert_if_array, convert_to_id_list, #find_parse_querystring, request, #request

Constructor Details

#initialize(dash, request_path) ⇒ PagedBase

Returns a new instance of PagedBase.



5
6
7
8
9
10
# File 'lib/rubyoverflow/pagedBase.rb', line 5

def initialize(dash, request_path)
  @total = dash.total
  @page = dash.page
  @pagesize = dash.pagesize
  @request_path,@query_parameters = find_parse_querystring(request_path)
end

Instance Attribute Details

#pageObject (readonly)

Returns the value of attribute page.



3
4
5
# File 'lib/rubyoverflow/pagedBase.rb', line 3

def page
  @page
end

#pagesizeObject (readonly)

Returns the value of attribute pagesize.



3
4
5
# File 'lib/rubyoverflow/pagedBase.rb', line 3

def pagesize
  @pagesize
end

#query_parametersObject (readonly)

Returns the value of attribute query_parameters.



3
4
5
# File 'lib/rubyoverflow/pagedBase.rb', line 3

def query_parameters
  @query_parameters
end

#request_pathObject (readonly)

Returns the value of attribute request_path.



3
4
5
# File 'lib/rubyoverflow/pagedBase.rb', line 3

def request_path
  @request_path
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/rubyoverflow/pagedBase.rb', line 3

def total
  @total
end

Instance Method Details

#next_page_parametersObject



12
13
14
15
16
17
18
19
20
# File 'lib/rubyoverflow/pagedBase.rb', line 12

def next_page_parameters()
  temp = @query_parameters
  if @page.respond_to?(:to_int)
    temp['page'] = @page.to_i + 1
  else
    temp["page"] = 2
  end
  return temp
end

#perform_next_page_requestObject



22
23
24
# File 'lib/rubyoverflow/pagedBase.rb', line 22

def perform_next_page_request()
  request(@request_path,next_page_parameters)
end