def validate_attributes!
      # Check for required attributes
      self.class.required_attributes.each do |matcher|
        matched = self.attributes.any? do |key, value|
          key = key.to_s
          Rxhp::AttributeValidator.match? matcher, key, value
        end
        if !matched
          raise MissingRequiredAttributeError.new(self, matcher)
        end
      end

      # Check other attributes are acceptable
      return true if self.attributes.empty?
      self.attributes.each do |key, value|
        key = key.to_s
        matched = self.class.acceptable_attributes.any? do |matcher|
          Rxhp::AttributeValidator.match? matcher, key, value
        end

        if !matched
          raise UnacceptableAttributeError.new(self, key, value)
        end
      end
      true
    end
def validate_attributes!
      # Check for required attributes
      self.class.required_attributes.each do |matcher|
        matched = self.attributes.any? do |key, value|
          key = key.to_s
          Rxhp::AttributeValidator.match? matcher, key, value
        end
        if !matched
          raise MissingRequiredAttributeError.new(self, matcher)
        end
      end

      # Check other attributes are acceptable
      return true if self.attributes.empty?
      self.attributes.each do |key, value|
        key = key.to_s
        matched = self.class.acceptable_attributes.any? do |matcher|
          Rxhp::AttributeValidator.match? matcher, key, value
        end

        if !matched
          raise UnacceptableAttributeError.new(self, key, value)
        end
      end
      true
    end
Check if attributes are valid, and raise an exception if they're not.

 @raise {MissingRequiredAttributeError} if an attribute that is
   required was not provided.
 @raise {UnacceptableAttributeError} if a non-whitelisted attribute
   was provided.
 @return [true] if the attribute are all valid, and all required
   attributes are provided.