Skip to content

Add pagination to acitities feed#9

Open
adammck wants to merge 2 commits into
kennyma:masterfrom
adammck:pagination
Open

Add pagination to acitities feed#9
adammck wants to merge 2 commits into
kennyma:masterfrom
adammck:pagination

Conversation

@adammck
Copy link
Copy Markdown
Contributor

@adammck adammck commented May 10, 2012

This adds :next_page and :previous_page methods to FitnessActitiesFeed, which return new instances of the same class. The existing :next and :previous accessors work as before, although they're not very useful now that pagination is available.

For example, to fetch every item ever posted:
(This would obviously be a very bad idea in production)

feed = @user.fitness_activities
items = []

while feed
  items += feed.items
  feed = feed.next_page
end

This involved a minor refactoring of the test fixtures. Hope you don't mind.

/cc @andrewpbrett

adammck added 2 commits May 10, 2012 18:21
This adds :next_page and :previous_page methods to FitnessActitiesFeed,
which return new instances. The existing :next and :previous accessors
work as before, although they're not very useful now that pagination
is available.

For example, to fetch every item ever posted:

  feed = @user.fitness_activities
  items = []

  while feed
    items += feed.items
    feed = feed.next_page
  end

This would obviously be a very bad idea in production.
naveed-ahmad pushed a commit to naveed-ahmad/health_graph that referenced this pull request Nov 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant