Sha256: 7833e9eb4f0c8fdce26d25a309b777d725e6f6ea1c0517562560664ba7bff5ef

Contents?: true

Size: 811 Bytes

Versions: 4

Compression:

Stored size: 811 Bytes

Contents

module Zumata

  class ZumataError < StandardError; end

  class TestConfigError < ZumataError; end
  class ClientConfigError < ZumataError; end
  
  # Messages for non-200 responses
  class GeneralError < ZumataError; end
  class InvalidApiKeyError < ZumataError; end
  class InvalidBookingKeyError < ZumataError; end
  class TransactionError < ZumataError; end

  module ErrorHelper
    def self.handle_type message
      case message
      when "Invalid Api Key."
        raise InvalidApiKeyError, message
      when "Invalid/Expired Booking key"
        raise InvalidBookingKeyError, message
      when "Payment & Booking Transactions are not successful. Please contact us for more details."
        raise TransactionError, message
      else
        raise GeneralError, message
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zumata-0.0.4 lib/zumata/errors.rb
zumata-0.0.3 lib/zumata/errors.rb
zumata-0.0.2 lib/zumata/errors.rb
zumata-0.0.1 lib/zumata/errors.rb