instructure / pandarus

A Ruby library for the Canvas API (and code generator for other languages, eventually)
34 stars 24 forks source link

```next_page``` for records that you only get chunks of #8

Closed eriko closed 9 years ago

eriko commented 10 years ago

client.list_enrollments_sections(c_section.id, {type: 'StudentEnrollment', state: 'active'})

list_enrollments_sections only returns the first ten records. In the code there is something about sending next_page and I have tried client.list_enrollments_sections(c_section.id, {type: 'StudentEnrollment',state: 'active',next_page: true}) to no avail. How do you get the next pages?

canadaduane commented 10 years ago

That is the intended usage. I will have to look in to this.

On Wed, Nov 12, 2014 at 5:21 PM, Erik Ordway notifications@github.com wrote:

client.list_enrollments_sections(c_section.id, {type: 'StudentEnrollment', state: 'active'})

list_enrollments_sections only returns the first ten records. In the code there is something about sending next_page and I have tried client.list_enrollments_sections(c_section.id, {type: 'StudentEnrollment',state: 'active',next_page: true}) to no avail. How do you get the next pages?

— Reply to this email directly or view it on GitHub https://github.com/instructure/pandarus/issues/8.

eriko commented 10 years ago

I still think I may be doing something wrong as I can not figure out how to do it in the context of earlier requests.

eriko commented 10 years ago

In looking through the pandarus code I do not see any thing handling the link headers https://canvas.instructure.com/doc/api/file.pagination.html . One of the things the canvas_api project did was use those and add a conditional .more? to the arrays and then be able to call .next_page! and .last_page!, etc on the array of values.

canadaduane commented 10 years ago

It's handled by Footrest pagination.rb, using link_header

On Thu, Nov 13, 2014 at 10:18 AM, Erik Ordway notifications@github.com wrote:

In looking through the pandarus code I do not see any thing handling the link headers https://canvas.instructure.com/doc/api/file.pagination.html . One of the things the canvas_api project did was use those and add a conditional .more? to the arrays and then be able to call .next_page! and .last_page!, etc on the array of values.

— Reply to this email directly or view it on GitHub https://github.com/instructure/pandarus/issues/8#issuecomment-62930082.

eriko commented 10 years ago

Ok I am a partial idiot. I was testing against a course that was too small. That said when there is no more, in this case enrollments, it keeps returning the last set. This makes it hard to stop asking for more.

eriko commented 9 years ago

The new paging code in remote_collections seems to be much nicer. Thanks.