/extended-httparty

An extension for the HTTParty gem ( Adds ability to retry on failures and connection errors)

Primary LanguageRuby

extended-httparty

An extension to HTTParty ( Adds Retry capabilities).

Retries HTTP request upto 3 times by default in case of failures and timeouts.

Default Trials : 3

Default Sleep Interval : 3 seconds

Pre-requisites

Install HTTParty.

 gem install httparty

How It Works

Does everything that HTTParty does.

All you got to do is replace the name from HTTParty to ExtendedHttparty.

From :

response = HTTParty.get('http://api.stackexchange.com/2.2/questions?site=stackoverflow')

To :

response = ExtendedHttparty.get('http://api.stackexchange.com/2.2/questions?site=stackoverflow')

Update Trials

You can update the number of trials by passing an integer value as the parameter.

response = ExtendedHttparty.get('your-url', tries: 5)

References