Sha256: 688a47bba842f1ce8925beb841a2b46ccc8e169d8d0f4426090dfd78de01a9f0

Contents?: true

Size: 829 Bytes

Versions: 10

Compression:

Stored size: 829 Bytes

Contents

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

module RDStation
  class ErrorHandler
    class Unauthorized
      UNAUTHORIZED_ERRORS = [
        ErrorHandler::ExpiredAccessToken,
        ErrorHandler::ExpiredCodeGrant,
        ErrorHandler::InvalidCredentials,
        ErrorHandler::InvalidRefreshToken,
      ].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

10 entries across 10 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.8.2 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.8.1 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.8.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.7.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.6.0 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.5.3 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.5.2 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.5.1 lib/rdstation/error_handler/unauthorized.rb
rdstation-ruby-client-2.5.0 lib/rdstation/error_handler/unauthorized.rb