chrismagnacca/newegg-api — pull request #3 by bencpeters (2014-01-07 16:58:07+00:00)
Title: Fix categories method

As written, `Api::categories` relied on caching results in private variable `self._categories`. However, it used the `<<` operator to add to this array, resulting in duplicate entries being pushed to this array on subsequence calls to `categories`. Furthermore, there was no way to tell which categories belonged to which `store_id`, so calling `categories` with different `store_id` paramters would cause incorrect results to be returned.

For this fix, I removed any category caching, since the requests are quick to complete. An alternative implementation could be to have `self._categories` be a hash with `store_id`s as keys and Sets for each store's categories; however, I don't think it's really necessary for the use case.