retriable_proxy

Creates an object wrapper on top of Retriable. The accepted keyword arguments are the same as for Retriable itself.

network_interface = API.new(unreliable_server: 'https://api-server.com')
stubborn_interface = RetriableProxy.for_object(network_interface, on: Net::TimeoutError)
stubborn_interface.create(id: 123, name: 'Some object that gets created') # Will retry

If you only want to wrap certain methods, add the :methods option and pass in an Array of symbols.

network_interface = API.new(unreliable_server: 'https://api-server.com')
stubborn_interface = RetriableProxy.for_object(network_interface, on: Net::TimeoutError, methods: [:fetch_comments])
stubborn_interface.create(id: 123, name: 'Some object that gets created') # Will not retry
stubborn_interface.fetch_comments # Will do retry

Contributing to retriable_proxy

Copyright © 2015 Julik Tarkhanov. See LICENSE.txt for further details.