Method: OpenapiClient::Document#valid?

Defined in:
lib/openapi_client/models/document.rb

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



112
113
114
115
116
117
118
119
120
# File 'lib/openapi_client/models/document.rb', line 112

def valid?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["NATIONAL_IDENTITY", "SINGLE_TAX_IDENTIFICATION", "SINGLE_CODE_OF_LABOR_IDENTIFICATION", "BOOK_ENLISTMENT", "CIVIC_NOTEBOOK", "PASSPORT"])
  return false unless type_validator.valid?(@type)
  return false if @number.nil?
  return false if @number.to_s.length > 30
  return false if @number !~ Regexp.new(/^(?!\s*$).+/)
  true
end