Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Add pagination and ratelimit support for responses from Instagram #76

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

weyus
Copy link

@weyus weyus commented Jun 17, 2013

By default, Instagram provides a pagination scheme to allow users to request multiple data sets. This adds support for those requests by adding a "next" method to Instagram::Response. This automatically calls the next URL provided by Instagram and provides a shorter way to request the next page of data from an Instagram response.

In addition, each response now has the ratelimit header information provided by Instagram per https://groups.google.com/forum/#!msg/instagram-api-developers/u5dvkdye-BI/Tb-Dh8zJLDkJ in object.ratelimit.

Due to the architecture of this gem, there is no shared information regarding the Instagram client in either the request or the response, so I had to create a new Instagram::Client object to request the next dataset. Although this works, it doesn't feel ideal.

def next
if pagination.next_url
client = Instagram.client(Instagram.options)
pagination.next_url.sub!('http://', 'https://') #Make the URL secure if it isn't already
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a problem? Aren't all of the API methods limited to https?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next URLs that were returned to me in result sets were 'http'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

@jbaudanza
Copy link

+1 for the ratelimit hash

@sufleR
Copy link

sufleR commented Apr 17, 2014

+1 nice to have

@jonfer
Copy link

jonfer commented Apr 25, 2014

+1 ratelimit

@heatonjb
Copy link
Contributor

heatonjb commented May 6, 2014

ratelimit info is easily accessible now, see the sample app

@jonfer
Copy link

jonfer commented May 25, 2014

Thanks Jonathan, the problem is, that to request the ratelimit it will generate another request. Would be really good to be able to get it from the response as its already available in its header.

@ghost
Copy link

ghost commented Aug 4, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants