Sha256: e92a4521e90c71c74f5c42c1094432dbd27d4a560341ce6791aa2990351ccfcf

Contents?: true

Size: 885 Bytes

Versions: 4

Compression:

Stored size: 885 Bytes

Contents

module Pricefinder
  module Error
    class ResponseValidator

      def validate(response)
        return if successful_response?(response)
      end

      private

      def successful_response?(response)
        (200..399).include?(response.status)
      end
    end

    class Base < StandardError
      def initialize(msg,error=nil)
        super(msg)
      end
    end

    class AlreadyConfigured < Base
      def initialize(msg = 'Gem cannot be reconfigured.  Initialize a new ' +
          'instance of Pricefinder::Client.', error=nil)
        super
      end
    end

    class InvalidCredentials < Base
      def initialize(msg = "Invalid client_id or client_secret.", error=nil)
        super
      end
    end

    class MissingClientRequiredConfig < Base
      def initialize(msg = "Missing required client config", error=nil)
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pricefinder-1.0.1 lib/pricefinder/error.rb
pricefinder-1.0.0 lib/pricefinder/error.rb
pricefinder-0.1.1 lib/pricefinder/error.rb
pricefinder-0.1.0 lib/pricefinder/error.rb