Class: TheCity::ApiList
- Inherits:
-
Object
- Object
- TheCity::ApiList
- Defined in:
- lib/api/api_list.rb
Overview
This class is the base class for all TheCity objects and is meant to be inherited.
Direct Known Subclasses
AddressList, CampusList, CheckinList, CheckinListByCallboardNumber, CheckinListByPagerNumber, DonationExportList, DonationList, FundList, GroupAddressList, GroupCheckinEventsList, GroupCheckinList, GroupEventAttendanceList, GroupExportList, GroupInvitationList, GroupList, GroupRoleList, GroupTagList, InvitationList, MetricList, MetricMeasurementList, PledgeList, RoleList, SkillList, SkilledUserIdList, SkilledUserList, TagGroupList, TagList, TerminologyList, UserAddressList, UserAdminPrivilegeList, UserFamilyList, UserInvitationList, UserList, UserNoteList, UserProcessAnswerList, UserProcessList, UserRoleList, UserSkillList, WebHookList
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
-
#total_entries ⇒ Object
readonly
Returns the value of attribute total_entries.
-
#total_pages ⇒ Object
readonly
Returns the value of attribute total_pages.
Class Method Summary collapse
Instance Method Summary collapse
-
#next_page ⇒ UserList
Gets the next page of results.
-
#next_page! ⇒ Object
Loads the next page of results and replaces self with the results.
-
#next_page? ⇒ Boolean
Checks if there is a next page.
Instance Attribute Details
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
7 8 9 |
# File 'lib/api/api_list.rb', line 7 def current_page @current_page end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
7 8 9 |
# File 'lib/api/api_list.rb', line 7 def per_page @per_page end |
#total_entries ⇒ Object (readonly)
Returns the value of attribute total_entries.
7 8 9 |
# File 'lib/api/api_list.rb', line 7 def total_entries @total_entries end |
#total_pages ⇒ Object (readonly)
Returns the value of attribute total_pages.
7 8 9 |
# File 'lib/api/api_list.rb', line 7 def total_pages @total_pages end |
Class Method Details
.load(options = {}) ⇒ Object
9 10 11 |
# File 'lib/api/api_list.rb', line 9 def self.load( = {}) self.new() end |
Instance Method Details
#next_page ⇒ UserList
Gets the next page of results.
23 24 25 26 |
# File 'lib/api/api_list.rb', line 23 def next_page return nil unless next_page? self.class.new( @options.merge({:page => @options[:page]+1}) ) end |
#next_page! ⇒ Object
Loads the next page of results and replaces self with the results.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/api/api_list.rb', line 31 def next_page! return false unless next_page? @options[:page] += 1 @options[:reader] = @options[:reader].class.new(@options) @json_data = @options[:reader].load_feed @total_entries = @json_data['total_entries'] @total_pages = @json_data['total_pages'] @per_page = @json_data['per_page'] @current_page = @json_data['current_page'] return true end |
#next_page? ⇒ Boolean
Checks if there is a next page.
16 17 18 |
# File 'lib/api/api_list.rb', line 16 def next_page? @current_page < @total_pages end |