Using count -1 is not reliable as the payment sources returned by the API are filtered, but maintain their original index.
Also ensures that @values is initialised if it doesn't exist.
context:
we've discovered the issue is related to users who've added 6 or more payment sources.
I've submitted a PR for the new release that prevents the error: #78
That said, be aware that the API only returns 5 payment sources. In the raw response there is a has_more attribute and a link to the next_page_url, but the gem does not seem make use of it...
Using
count -1
is not reliable as the payment sources returned by the API are filtered, but maintain their original index.Also ensures that
@values
is initialised if it doesn't exist.context:
resource : https://github.com/conekta/conekta-ruby/issues/68