-
Notifications
You must be signed in to change notification settings - Fork 630
Add pagination and ratelimit support for responses from Instagram #76
base: master
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😞
+1 for the ratelimit hash |
+1 nice to have |
+1 ratelimit |
ratelimit info is easily accessible now, see the sample app |
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. |
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. |
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.