Sha256: 8bf67278d71cf2db312a6764b097a4d5da1d7928bdcae28ef88b7b24b48e1f44

Contents?: true

Size: 461 Bytes

Versions: 15

Compression:

Stored size: 461 Bytes

Contents

# frozen_string_literal: true

module SolidusBactracs
  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

15 entries across 15 versions & 1 rubygems

Version Path
solidus_bactracs-4.0.1 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-4.0.0 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.5.2 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.5.1 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.5.0 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.4.0 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.3.2 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.3.1 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.3.0 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.2.2 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.2.1 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.2.0 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.1.2 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.1.1 lib/solidus_bactracs/api/rate_limited_error.rb
solidus_bactracs-3.1.0 lib/solidus_bactracs/api/rate_limited_error.rb