Sha256: b0277466575eedbb1f8737cdfb5d850b2a7738dcbb0b0f8a97df121673e20aa1

Contents?: true

Size: 462 Bytes

Versions: 8

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

module SolidusBacktracs
  module Api
    class RateLimitedError < RequestError
      attr_reader :retry_in

      class << self
        def options_from_response(response)
          super.merge(
            retry_in: response.headers['X-Rate-Limit-Reset'].to_i.seconds,
          )
        end
      end

      def initialize(retry_in:, **options)
        super(**options)

        @retry_in = retry_in
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
solidus_bactracs-3.0.0 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.6 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.5 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.4 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.3 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.2 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.1 lib/solidus_backtracs/api/rate_limited_error.rb
solidus_backtracs-2.2.0 lib/solidus_backtracs/api/rate_limited_error.rb