Sha256: ca28bd12014aa084e3562c4fbcf862f57bd1cee509cbf506f59355b24163427a

Contents?: true

Size: 424 Bytes

Versions: 5

Compression:

Stored size: 424 Bytes

Contents

# frozen_string_literal: true
module Usps
  module Api
    module Errors
      class TooManyRequestsError < ::Faraday::Error
        attr_reader :response

        def initialize(response)
          @response = response
        end

        def message
          "Retry after #{retry_after} seconds"
        end

        def retry_after
          response.headers['retry-after'].to_i
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
usps-ruby-client-0.2.0 lib/usps/api/errors/too_many_requests_error.rb
usps-ruby-client-0.1.3 lib/usps/api/errors/too_many_requests_error.rb
usps-ruby-client-0.1.2 lib/usps/api/errors/too_many_requests_error.rb
usps-ruby-client-0.1.1 lib/usps/api/errors/too_many_requests_error.rb
usps-ruby-client-0.1.0 lib/usps/api/errors/too_many_requests_error.rb