Sha256: d29fb204b50b31afab914f0225089d0d47aaba905079690287666c5499961c13

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

module Paysio
  module Errors
    class Base < Exception
      alias_method :exception_body, :message
      def attributes
        @attributes ||= Paysio::JSON.decode(exception_body)['error']
      end

      def type
        attributes['type']
      end

      def message
        attributes['message']
      rescue
        exception_body
      end

      def params
        attributes['params']
      end
    end
    class Unauthorized < Base; end;
    class InternalError < Base; end;
    class Forbidden < Base; end;
    class BadRequest < Base; end;
    class NotFound < Base; end;
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paysio-1.0.10 lib/paysio/errors.rb
paysio-1.0.9 lib/paysio/errors.rb