pioz / tvdb2

Ruby wrapper for TVDB api version 2
MIT License
4 stars 0 forks source link

handle data being nil on page=2 call #4

Closed klausmeyer closed 1 year ago

klausmeyer commented 1 year ago

Currently the pagination logic seems to not use the total number of pages available in the API but simply calling the endpoints for (e.g. episodes) until it gets a count of record less than the "per page" one (100).

This seems to have been working fine until a recent change in the API.

Now the 2nd page with no entries seems to return null instead of [] in data attribute.

Steps to reproduce:

TVDB.new(apikey: 'changeme').series(81189).episodes
# => NoMethodError undefined method `map' for nil:NilClass

This quick fix should address the issue without reworking the pagination logic.