FaradayMiddleware::Request::Retry

Gem Version Build Status Coverage Status Dependency Status Code Climate Scrutinizer Code Quality Downloads Docs License

Faraday middleware to manage request retries.

Description

This gem is Faraday middleware that adds retry handling for 429 and 503 errors.

Installation

Add this line to your application's Gemfile:

gem 'faraday_middleware-request-retry'

And then execute:

$ bundle

Or install it yourself as:

$ gem install faraday_middleware-request-retry

Usage

require 'faraday'
require 'faraday_middleware-request-retry'
require 'logger'

conn = Faraday.new(url: "http://example.com") do |builder|
  builder.use FaradayMiddleware::Refresh::Retry, logger: Logger.new(STDOUT)
  builder.adapter Faraday.default_adapter
end

conn.get "/foo" # sends token

Change Log

See CHANGELOG.md

Project Repo

Problems, Comments, Suggestions, Contributions?

Any reports of problems, comments or suggestions are most welcome.

Please report these on Github

Credits

This code is extracted from the Zendesk Ruby SDK's ZendeskAPI::Middleware::Request::Retry class.

Copyright © 2015 Zendesk, 2016 John Wang

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.