I noticed while testing the new direct_messages_events method that the method doesn't seem to abide by the count param. E.g:
# Create client.
c = Twitter::REST::Client.new(...)
# Fetch DM events with a limit of 100.
r = c.direct_messages_events(count: 100)
r.as_json.count
# => 238
It looks as though the Twitter::Cursor#reached_limit? method never returns true and so keeps fetching new data from the Twitter DM events endpoint until there is no more to fetch.
Proposed solution
The reached_limit? method uses the length of the @collection variable as this is a cumulative collection the data retrieved from all API calls.
Problem
I noticed while testing the new
direct_messages_events
method that the method doesn't seem to abide by thecount
param. E.g:It looks as though the
Twitter::Cursor#reached_limit?
method never returns true and so keeps fetching new data from the Twitter DM events endpoint until there is no more to fetch.Proposed solution
The
reached_limit?
method uses the length of the@collection
variable as this is a cumulative collection the data retrieved from all API calls.