Sha256: ae0db7c85f1813b13a87c048cd750c676a3366c6915043df9ca9af59195ceed2

Contents?: true

Size: 745 Bytes

Versions: 6

Compression:

Stored size: 745 Bytes

Contents

require_relative 'expired_access_token'
require_relative 'expired_code_grant'
require_relative 'invalid_credentials'

module RDStation
  class ErrorHandler
    class Unauthorized
      UNAUTHORIZED_ERRORS = [
        ErrorHandler::ExpiredAccessToken,
        ErrorHandler::ExpiredCodeGrant,
        ErrorHandler::InvalidCredentials,
      ].freeze

      def initialize(array_of_errors)
        @array_of_errors = array_of_errors
      end

      def raise_error
        error_classes.each(&:raise_error)
        raise RDStation::Error::Unauthorized, @array_of_errors.first
      end

      private

      def error_classes
        UNAUTHORIZED_ERRORS.map do |error|
          error.new(@array_of_errors)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.4.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.3.1 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.3.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.2.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.1.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.0.0 lib/rdstation/error_handler/unauthorized.rb