Class: Rubyoverflow::PagedBase
- Defined in:
- lib/rubyoverflow/pagedBase.rb
Direct Known Subclasses
Answers, Badges, Comments, PostTimelineEvents, Questions, RepChanges, Revisions, Tags, UserTimelineEvents, Users
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#pagesize ⇒ Object
readonly
Returns the value of attribute pagesize.
-
#query_parameters ⇒ Object
readonly
Returns the value of attribute query_parameters.
-
#request_path ⇒ Object
readonly
Returns the value of attribute request_path.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(dash, request_path) ⇒ PagedBase
constructor
A new instance of PagedBase.
- #next_page_parameters ⇒ Object
- #perform_next_page_request ⇒ Object
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
#page ⇒ Object (readonly)
Returns the value of attribute page.
3 4 5 |
# File 'lib/rubyoverflow/pagedBase.rb', line 3 def page @page end |
#pagesize ⇒ Object (readonly)
Returns the value of attribute pagesize.
3 4 5 |
# File 'lib/rubyoverflow/pagedBase.rb', line 3 def pagesize @pagesize end |
#query_parameters ⇒ Object (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_path ⇒ Object (readonly)
Returns the value of attribute request_path.
3 4 5 |
# File 'lib/rubyoverflow/pagedBase.rb', line 3 def request_path @request_path end |
#total ⇒ Object (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_parameters ⇒ Object
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_request ⇒ Object
22 23 24 |
# File 'lib/rubyoverflow/pagedBase.rb', line 22 def perform_next_page_request() request(@request_path,next_page_parameters) end |