lib/flexmls_api/request.rb in flexmls_api-0.4.5 vs lib/flexmls_api/request.rb in flexmls_api-0.6.4

- old
+ new

@@ -123,13 +123,17 @@ # Errors built from API responses class InvalidResponse < StandardError; end class ClientError < StandardError attr_reader :code, :status - def initialize (code, status) - @code = code - @status = status + def initialize (options = {}) + # Support the standard initializer for errors + opts = options.is_a?(Hash) ? options : {:message => options.to_s} + @code = opts[:code] + @status = opts[:status] + super(opts[:message]) end + end class NotFound < ClientError; end class PermissionDenied < ClientError; end class NotAllowed < ClientError; end class BadResourceRequest < ClientError; end