minimul / qbo_api

Ruby JSON-only client for QuickBooks Online API v3. Built on top of the Faraday gem.
MIT License
85 stars 46 forks source link

Add support for custom middleware and parallel requests #43

Closed ntippie closed 6 years ago

ntippie commented 6 years ago

This PR stores the connection as an instance variable so that the Faraday middleware can be edited (before first use of the connection). In my case it was to add the :retry middleware, and custom middleware to sleep and retry when QboApi::TooManyRequests is encountered.

As far as I could tell, there is no reason for the connection to be instantiated on each request, hence the minimal change. It seems that even when doing a successful #reconnect, the tokens, keys, and secrets are not swapped out, and a new QboApi instance must be created because there is not attr_writer for those variables. Please let me know if there's some necessary case for re-instantiated connections and I will accomodate.

minimul commented 6 years ago

Perfect.

Released => v1.5.5